Public report — datafusion, published 29 Sep 2026. Concrete security findings (which rule fired, in which file, on which line; CVE IDs, secret matches, dependency versions) are REDACTED in this version; ask the repo owner for the full report.
Public
Codebase survey Measured under the Code Assurance Index · rubric rubric-2026.09.17 (frozen) · verify this survey Filed cd_386e7c31791b4b59973ee6d11e855c67 Filed 29 September 2026, 06:01 UTC Public

Apache/datafusion

Measured 29 September 2026, 05:09 UTC

73% Strong
CriticalWeakAdequateStrongExemplary

Very large · 744,597 LoC · 48 projects · rebuild ~9.0 person-years · weakest lens: Maturity (67%)

Findings by grade

50 critical 2155 serious 23 minor 47 could not be resolved — could be critical — see Limitations

This survey was produced by

Watchdog
Producer
Canine Development
Analyzer
Watchdog engine 1.0.0
Measured
29 September 2026, 05:09 UTC

A measurement, not a certificate. The Code Assurance Index does not certify, approve or guarantee this codebase; it records a reproducible number and the evidence it was computed from. The standard is authored by Canine Development, who also build Watchdog — its only implementation today. That is said here so the number is checked rather than believed.

Grounded in facts. Every number here is computed, not narrated — reproducible, tool-backed, and traceable to a line of code. How to trust this ▸

38/42dimensions tool-verifieddeterministic · confidence 1.0 · 4 LLM-assisted, advisory
2194findings with an exact file:lineof 2228 — the remainder are repo-wide signals (a dimension-level measurement, not a single line); open any file:line and verify
42/121dimensions across the health lenses744597 LoC · 48 projects — wide & deep
Chapters

Executive summary

The system holds a strong overall standing with a health score of 73%, indicating a robust asset that delivers value but carries manageable risks. This score reflects a mature architecture and high performance, yet it masks underlying maintenance burdens that could erode long-term agility if left unaddressed. The organization benefits from a highly stable foundation, but the cost of keeping it running is higher than necessary due to documentation gaps and code complexity.

The scale of this investment is substantial, encompassing nearly 750,000 lines of production code and 188,000 lines of tests. Rebuilding this system from scratch would require approximately nine person-years and cost around €1.3 million, highlighting the significant value tied up in the current implementation. While the code is not boilerplate, the sheer volume means that even small inefficiencies compound quickly, making efficiency gains critical for protecting the bottom line.

The primary risk is a hidden velocity tax. Code quality signals suggest that changes in weaker areas cost 4–8% more effort than in clean code. This inefficiency acts as a recurring drag on the team, costing hundreds of engineer-days annually. Without intervention, this tax compounds as the codebase grows, directly impacting delivery speed and increasing operational costs for every feature release.

A secondary concern is the lack of architectural memory. The absence of recorded decisions means new teams struggle to understand context, leading to repeated mistakes and slower onboarding. This maturity gap increases the risk of defects and delays, as engineers must rediscover design rationales rather than building on established knowledge. This uncertainty exposes the business to unnecessary rework and potential security oversights.

Genuinely good news includes perfect performance metrics and a highly resilient architecture that rarely ripples with changes. The codebase is well-structured, allowing for safe, isolated modifications. These strengths provide a solid platform for growth, provided the maintenance overhead is reduced.

Focus first on documenting key architectural decisions and adding a quick-start guide. This low-effort action pays for itself within months by reducing onboarding time and preventing costly misunderstandings. It is the highest-leverage move to unlock immediate value and stabilize the system’s long-term health.

How the score is built — each lens's share of the headline Width is the lens's weight in the worst-heaviest fold (the weakest area pulls hardest); colour is that lens's own band. A lens fixes the score in proportion to its width.
Maturity 67% · 46% weightSecurity 71% · 25% weightReadiness 77% · 14% weightCode Health 83% · 8% weightArchitecture 95% · 4% weightPerformance 100% · 2% weight

Raise Maturity 67 → 70 (the Healthy floor) ⇒ headline 73 → ~74.

Code composition — where the lines go
Tests 100%
New since the last scan (100+)

155 finding(s) are new versus the previous scan (2026-09-12) — surfaced by this scheduled scan itself, no pull request required. Showing the first 100; the full set is in the report.

  • D1 · datafusion_physical_optimizer::ensure_requirements::enforce_distribution::ensure_distribution_with_stats (cyclomatic 42) datafusion/physical-optimizer/src/ensure_requirements/enforce_distribution.rs
  • D1 · AsOfJoinNode::deserialize (cyclomatic 25) datafusion/proto-models/src/generated/pbjson.rs
  • D1 · datafusion_optimizer::push_down_limit::topk_through_join::push_topk_through_join (cyclomatic 23) datafusion/optimizer/src/push_down_limit/topk_through_join.rs
  • D1 · CsvWriterOptions::try_from (cyclomatic 22) datafusion/proto-common/src/from_proto/mod.rs
  • D1 · AsOfJoinExecNode::deserialize (cyclomatic 22) datafusion/proto-models/src/generated/pbjson.rs
  • D1 · check_asf_yaml_status_checks.check_post_merge_conditions (cyclomatic 22) ci/scripts/check_asf_yaml_status_checks.py
  • D1 · datafusion_optimizer::push_down_limit::rewrite_limit (cyclomatic 18) datafusion/optimizer/src/push_down_limit.rs
  • D1 · MultiLevelMergeBuilder::split_spill_file_in_half (cyclomatic 18) datafusion/physical-plan/src/sorts/multi_level_merge.rs
  • D1 · SqlToRel::insert_to_plan (cyclomatic 18) datafusion/sql/src/statement.rs
  • D1 · AsOfJoinNode::serialize (cyclomatic 17) datafusion/proto-models/src/generated/pbjson.rs
  • D1 · HashJoinStream::process_probe_batch (cyclomatic 16) datafusion/physical-plan/src/joins/hash_join/stream.rs
  • D1 · PhysicalBinaryExprNode::deserialize (cyclomatic 16) datafusion/proto-models/src/generated/pbjson.rs
  • D2 · datafusion_physical_optimizer::ensure_requirements::enforce_distribution::ensure_distribution_with_stats (cognitive 66) datafusion/physical-optimizer/src/ensure_requirements/enforce_distribution.rs
  • D2 · CsvWriterOptions::try_from (cognitive 31) datafusion/proto-common/src/from_proto/mod.rs
  • D2 · check_asf_yaml_status_checks.check_post_merge_conditions (cognitive 30) ci/scripts/check_asf_yaml_status_checks.py
  • D2 · GroupsAccumulatorAdapter::invoke_per_accumulator_with_scratch (cognitive 29) datafusion/functions-aggregate-common/src/aggregate/groups_accumulator.rs
  • D2 · MultiLevelMergeBuilder::split_spill_file_in_half (cognitive 29) datafusion/physical-plan/src/sorts/multi_level_merge.rs
  • D2 · AsOfJoinNode::deserialize (cognitive 28) datafusion/proto-models/src/generated/pbjson.rs
  • D2 · datafusion_optimizer::push_down_limit::topk_through_join::push_topk_through_join (cognitive 26) datafusion/optimizer/src/push_down_limit/topk_through_join.rs
  • D2 · MultiLevelMergeBuilder::merge_sorted_runs_within_mem_limit (cognitive 25) datafusion/physical-plan/src/sorts/multi_level_merge.rs
  • D2 · AsOfJoinExecNode::deserialize (cognitive 25) datafusion/proto-models/src/generated/pbjson.rs
  • D2 · datafusion_functions_nested::cosine_distance::general_cosine_distance (cognitive 24) datafusion/functions-nested/src/cosine_distance.rs
  • D2 · datafusion_physical_plan::joins::hash_join::exec::array_map_key_range (cognitive 24) datafusion/physical-plan/src/joins/hash_join/exec.rs
  • D2 · datafusion_optimizer::push_down_limit::rewrite_limit (cognitive 22) datafusion/optimizer/src/push_down_limit.rs
  • D2 · datafusion_functions_nested::array_normalize::general_array_normalize (cognitive 21) datafusion/functions-nested/src/array_normalize.rs
  • D2 · DecorrelatePredicateSubquery::rewrite (cognitive 21) datafusion/optimizer/src/decorrelate_predicate_subquery.rs
  • D2 · datafusion_catalog::memory::table::update_rows (cognitive 19) REDACTED
  • D2 · datafusion_functions::utils::map_lookup (cognitive 18) datafusion/functions/src/utils.rs
  • D2 · ProjectionExprs::project_statistics_impl (cognitive 18) datafusion/physical-expr/src/projection.rs
  • D2 · check_asf_yaml_status_checks.main (cognitive 18) ci/scripts/check_asf_yaml_status_checks.py
  • D2 · OrderSensitiveArrayAggAccumulator::store_batch (cognitive 17) datafusion/functions-aggregate/src/array_agg.rs
  • D2 · datafusion_optimizer::analyzer::type_coercion::coerce_window_frame (cognitive 17) datafusion/optimizer/src/analyzer/type_coercion.rs
  • D2 · NestedLoopJoinStream::handle_emit_left_unmatched_memory_limited (cognitive 17) datafusion/physical-plan/src/joins/nested_loop_join.rs
  • D2 · DerivedRelationBuilder::build (cognitive 17) datafusion/sql/src/unparser/ast.rs
  • D2 · BinaryTypeCoercer::signature_inner (cognitive 16) datafusion/expr-common/src/type_coercion/binary.rs
  • D2 · PartitionedTopKDenseRank::emit (cognitive 16) datafusion/physical-plan/src/topk/mod.rs
  • D2 · AsOfJoinNode::serialize (cognitive 16) datafusion/proto-models/src/generated/pbjson.rs
  • D2 · PhysicalRangePartitioning::deserialize (cognitive 16) datafusion/proto-models/src/generated/pbjson.rs
  • D3 · FunctionTooLong: datafusion_physical_optimizer::ensure_requirements::enforce_distribution::ensure_distribution_with_stats datafusion/physical-optimizer/src/ensure_requirements/enforce_distribution.rs
  • D3 · MethodTooLong: ParquetMorselizer.prepare_open_file datafusion/datasource-parquet/src/opener/mod.rs
  • D3 · FileTooLong: REDACTED REDACTED
  • D3 · FunctionTooLong: datafusion_physical_plan::joins::hash_join::stream::mark_null_candidates_for_probe_batch datafusion/physical-plan/src/joins/hash_join/stream.rs
  • D3 · ClassTooLong: AsOfJoinExec datafusion/physical-plan/src/joins/asof_join.rs
  • D3 · MethodTooLong: GroupsAccumulatorAdapter.invoke_per_accumulator_with_scratch datafusion/functions-aggregate-common/src/aggregate/groups_accumulator.rs
  • D3 · FileTooLong: logical_plan/ddl.rs datafusion/expr/src/logical_plan/ddl.rs
  • D3 · MethodTooLong: MultiLevelMergeBuilder.merge_sorted_runs_within_mem_limit datafusion/physical-plan/src/sorts/multi_level_merge.rs
  • D3 · FileTooLong: sorts/partial_sort.rs datafusion/physical-plan/src/sorts/partial_sort.rs
  • D3 · FileTooLong: aggregate_hash_table/common.rs datafusion/physical-plan/src/aggregates/aggregate_hash_table/common.rs
  • D3 · FileTooLong: src/partitioning.rs datafusion/physical-expr/src/partitioning.rs
  • D3 · ClassTooLong: MultiLevelMergeBuilder datafusion/physical-plan/src/sorts/multi_level_merge.rs
  • D3 · FileTooLong: operator_statistics/mod.rs datafusion/physical-plan/src/operator_statistics/mod.rs
  • D4 · Edited copy of a member (18 corresponding lines) datafusion/common/src/config.rs
  • D4 · Members sharing a duplicated core (11 members, 50+ identical tokens) datafusion/physical-plan/src/aggregates/mod.rs
  • D4 · Members sharing a duplicated core (5 members, 50+ identical tokens) datafusion/datasource/src/memory.rs
  • D4 · Members sharing a duplicated core (4 members, 50+ identical tokens) datafusion/common/src/scalar/mod.rs
  • D4 · Members sharing a duplicated core (4 members, 50+ identical tokens) datafusion/core/src/execution/session_state.rs
  • D4 · Members sharing a duplicated core (4 members, 50+ identical tokens) datafusion/core/src/execution/session_state.rs
  • D4 · Members sharing a duplicated core (4 members, 50+ identical tokens) datafusion/functions-aggregate/src/covariance.rs
  • D4 · Members sharing a duplicated core (4 members, 50+ identical tokens) datafusion/physical-expr/src/aggregate.rs
  • D4 · Members sharing a duplicated core (4 members, 50+ identical tokens) datafusion/physical-plan/src/filter.rs
  • D4 · Members sharing a duplicated core (4 members, 50+ identical tokens) datafusion/physical-plan/src/joins/asof_join.rs
  • D4 · Members sharing a duplicated core (4 members, 50+ identical tokens) datafusion/physical-plan/src/topk/mod.rs
  • D4 · Duplicated block (20–21 lines × 2) REDACTED
  • D4 · Duplicated block (19–20 lines × 2) datafusion/datasource-arrow/src/file_format.rs
  • D4 · Duplicated block (19 lines × 2) datafusion/sql/src/select.rs
  • D4 · Duplicated block (15–18 lines × 2) datafusion/functions/src/regex/regexpcount.rs
  • D4 · Duplicated block (18 lines × 2) datafusion/physical-plan/src/aggregates/mod.rs
  • D4 · Duplicated block (13–18 lines × 2) datafusion/physical-plan/src/aggregates/ordered_single_stream.rs
  • D4 · Duplicated block (17 lines × 2) datafusion/functions/src/regex/regexpcount.rs
  • D4 · Duplicated block (16 lines × 2) datafusion/functions/src/regex/regexpcount.rs
  • D4 · Duplicated block (16 lines × 2) datafusion/optimizer/src/analyzer/function_rewrite.rs
  • D4 · Duplicated block (16 lines × 2) datafusion/physical-plan/src/aggregates/ordered_single_stream.rs
  • D4 · Duplicated block (14 lines × 3) datafusion/physical-plan/src/joins/asof_join.rs
  • D4 · Duplicated block (14 lines × 2) datafusion/functions/src/regex/regexpcount.rs
  • D4 · Duplicated block (14 lines × 2) datafusion/functions/src/regex/regexpcount.rs
  • D4 · Duplicated block (14 lines × 2) datafusion/functions/src/regex/regexpcount.rs
  • D4 · Duplicated block (14 lines × 2) datafusion/functions-nested/src/position.rs
  • D4 · Duplicated block (14 lines × 2) datafusion/physical-plan/src/aggregates/ordered_final_stream.rs
  • D4 · Duplicated block (11–13 lines × 3) datafusion/physical-plan/src/aggregates/ordered_single_stream.rs
  • D4 · Duplicated block (13 lines × 2) datafusion/functions-nested/src/position.rs
  • D4 · Duplicated block (13 lines × 2) datafusion/functions-nested/src/range.rs
  • D4 · Duplicated block (11–13 lines × 2) datafusion/physical-plan/src/aggregates/ordered_final_stream.rs
  • D4 · Duplicated block (12–13 lines × 2) datafusion/physical-plan/src/aggregates/ordered_single_stream.rs
  • D4 · Duplicated block (12 lines × 3) datafusion/datasource-csv/src/file_format.rs
  • D4 · Duplicated block (12 lines × 2) datafusion/functions/src/core/arrow_field.rs
  • D4 · Duplicated block (12 lines × 2) datafusion/functions/src/string/levenshtein.rs
  • D4 · Duplicated block (12 lines × 2) datafusion/physical-plan/src/aggregates/ordered_single_stream.rs
  • D4 · Duplicated block (11 lines × 3) datafusion/functions/src/regex/regexpcount.rs
  • D4 · Duplicated block (11 lines × 2) datafusion/physical-plan/src/aggregates/mod.rs
  • D4 · Duplicated block (11 lines × 2) datafusion/physical-plan/src/aggregates/ordered_final_stream.rs
  • D4 · Duplicated block (10–11 lines × 2) datafusion/physical-plan/src/aggregates/ordered_final_stream.rs
  • D4 · Duplicated block (11 lines × 2) datafusion/physical-plan/src/joins/nested_loop_join.rs
  • D4 · Duplicated block (10 lines × 2) datafusion/common/src/hash_utils.rs
  • D4 · Duplicated block (10 lines × 2) datafusion/physical-plan/src/aggregates/ordered_single_stream.rs
  • D4 · Duplicated block (10 lines × 2) datafusion/physical-plan/src/joins/asof_join.rs
  • D4 · Duplicated block (9–10 lines × 2) datafusion/physical-plan/src/joins/asof_join.rs
  • D4 · Duplicated block (9 lines × 2) datafusion/physical-plan/src/aggregates/ordered_single_stream.rs
  • D4 · Duplicated block (8 lines × 3) datafusion/functions/src/string/levenshtein.rs
  • D4 · Duplicated block (8 lines × 3) datafusion/functions-table/src/generate_series.rs
  • D4 · Duplicated block (8 lines × 2) datafusion/physical-plan/src/joins/nested_loop_join.rs

A full-fidelity diff against the previous run's complete recorded findings — line-move tolerant: a finding that only shifted line counts as unchanged, only genuinely new titles/files surface here.

Rebuild cost & value ~ Modeled — €430,000–€2,200,000
Cost to rebuild€430,000–€2,200,000 (4.3–13.7 person-years (7,237–22,958 h), ~5–18 engineers)
Domain complexityStandard — harder problems cost more per line
Quality factor1.1× (at 73% quality) — the last 20% of quality is most of the work
Size & shapeVery large · effort split not classified (source measured from disk; the effort-tier breakdown is a C#-only syntax walk)

This codebase represents roughly ~9.0 person-years of build effort (about ~€1,300,000 to rebuild). Its weakest lens is Maturity at 67% — the part of that asset most exposed by the findings below.

How we model this: boilerplate at a scaffolding rate + logic × domain Standard (×1.0) — standard service × a 1.1× quality factor, at €60–95/h; indicative, ±~30% · size measured directly from source · effort from total production LoC as straight-line logic (the tier split is a C#-only syntax walk), a conservative lower bound. Indicative only — most sensitive to the hourly rate and the domain tier (both tunable in config).

Top priorities

The highest-leverage moves; the full ranked list is in the Roadmap below.

1
Resolve the 1 No ADRs found finding(s) in ADR Quality.
+5.1 pts · Low effort · ADR Quality
2
Resolve the 2 Documentation finding(s) in Documentation Quality — start with README.md (2).
+2.6 pts · Low effort · Documentation Quality
3
Record significant decisions one document per decision — dated, stating the context, the decision and its consequences — and keep them together wherever your design docs already live (a conventional `docs/adr/` tree, with each file named `NNNN-title` in whatever markup those docs already use, is the most discoverable form).
+5.1 pts · Medium effort · Architecture documentation

Diagnosis — what's actually going on

The top fix pays for itself · High · Economics
The top-ranked fix costs roughly 1–3 engineer-days once. Not doing it costs about 130.2–781 engineer-days every year, paid as drag on the ~1,450,295 lines this team changes annually — a bill that arrives whether or not anyone books it. On those figures the fix breaks even in roughly 1–2 months and is free after that. Method, stated so this is not read as a quotation: debt from the ranked task's effort band; interest = annual changed lines (measured, annualised from the 90-day window) ÷ an ASSUMED 150–400 lines per engineer-day × the 4–8% drag implied by the code-quality signals; breaking point = debt ÷ annual interest. A modelled planning range built from measured inputs and one named assumption — not a quotation, a valuation, or a certified figure.
Evidence: D15 churn: 357,607 line(s) changed over a 90-day window ⇒ ~1,450,295/year · D1/D2/D4 code quality: averaging 6.6/10 ⇒ a 4–8% drag on each change · top-ranked remediation: Low effort ⇒ about 1–3 engineer-day(s)
→ Do the top-ranked fix now if this code will still be yours in 2 months.
Highest-leverage move · Medium · Leverage
Of everything flagged, the best return on effort is: Resolve the 1 No ADRs found finding(s) in ADR Quality. The rest can wait behind it.
Evidence: priority ranking: top of 5 ranked by impact/effort
→ Resolve the 1 No ADRs found finding(s) in ADR Quality.
A velocity tax on every change · Medium · Economics
The code-quality signals (complexity, duplication, cohesion) average 6.6/10, which acts as a tax on every change in the weaker areas: modifications there plausibly cost on the order of 4–8% more than in clean code, and the tax compounds as the codebase grows. (A modelled estimate, not a measured fact.)
Evidence: D1/D2/D4 code quality: averaging 6.6/10 across the code-quality signals actually measured
→ Pay it down where churn is highest — the hotspots — not everywhere; that's where the tax is actually paid.

Architecture — module dependency graph

Project dependencies, layered top-to-bottom; arrows show direction. Any dashed red edge points upward or sideways — a layering smell or cycle. A clean layered graph has none.

arch datafusion datafusion datafusion-catalog datafusion-catalog datafusion->datafusion-catalog datafusion-catalog-listing datafusion-catalog-listing datafusion->datafusion-catalog-listing datafusion-common datafusion-common datafusion->datafusion-common datafusion-datasource datafusion-datasource datafusion->datafusion-datasource datafusion-datasource-avro datafusion-datasource-avro datafusion->datafusion-datasource-avro datafusion-datasource-parquet datafusion-datasource-parquet datafusion->datafusion-datasource-parquet datafusion-execution datafusion-execution datafusion->datafusion-execution datafusion-expr datafusion-expr datafusion->datafusion-expr datafusion-expr-common datafusion-expr-common datafusion->datafusion-expr-common datafusion-functions datafusion-functions datafusion->datafusion-functions datafusion-functions-aggregate datafusion-functions-aggregate datafusion->datafusion-functions-aggregate datafusion-functions-nested datafusion-functions-nested datafusion->datafusion-functions-nested datafusion-physical-expr datafusion-physical-expr datafusion->datafusion-physical-expr datafusion-physical-expr-common datafusion-physical-expr-common datafusion->datafusion-physical-expr-common datafusion-physical-plan datafusion-physical-plan datafusion->datafusion-physical-plan datafusion-session datafusion-session datafusion->datafusion-session datafusion-catalog->datafusion-common datafusion-catalog->datafusion-datasource datafusion-catalog->datafusion-execution datafusion-catalog->datafusion-expr datafusion-catalog->datafusion-physical-expr datafusion-catalog->datafusion-physical-plan datafusion-catalog->datafusion-session datafusion-catalog-listing->datafusion-catalog datafusion-catalog-listing->datafusion-common datafusion-catalog-listing->datafusion-datasource datafusion-catalog-listing->datafusion-execution datafusion-catalog-listing->datafusion-expr datafusion-catalog-listing->datafusion-physical-expr datafusion-catalog-listing->datafusion-physical-expr-common datafusion-catalog-listing->datafusion-physical-plan datafusion-datasource->datafusion-common datafusion-datasource->datafusion-execution datafusion-datasource->datafusion-expr datafusion-datasource->datafusion-physical-expr datafusion-datasource->datafusion-physical-expr-common datafusion-datasource->datafusion-physical-plan datafusion-proto-models datafusion-proto-models datafusion-datasource->datafusion-proto-models datafusion-datasource->datafusion-session datafusion-datasource-avro->datafusion-common datafusion-datasource-avro->datafusion-datasource datafusion-datasource-avro->datafusion-execution datafusion-datasource-avro->datafusion-expr datafusion-datasource-avro->datafusion-physical-expr-common datafusion-datasource-avro->datafusion-physical-plan datafusion-datasource-avro->datafusion-proto-models datafusion-datasource-avro->datafusion-session datafusion-datasource-parquet->datafusion-common datafusion-datasource-parquet->datafusion-datasource datafusion-datasource-parquet->datafusion-execution datafusion-datasource-parquet->datafusion-expr datafusion-datasource-parquet->datafusion-functions datafusion-datasource-parquet->datafusion-physical-expr datafusion-datasource-parquet->datafusion-physical-expr-common datafusion-datasource-parquet->datafusion-physical-plan datafusion-datasource-parquet->datafusion-proto-models datafusion-datasource-parquet->datafusion-session datafusion-execution->datafusion-common datafusion-execution->datafusion-expr datafusion-execution->datafusion-physical-expr-common datafusion-expr->datafusion-common datafusion-expr->datafusion-expr-common datafusion-expr->datafusion-physical-expr-common datafusion-expr->datafusion-proto-models datafusion-expr-common->datafusion-common datafusion-ffi datafusion-ffi datafusion-ffi->datafusion-catalog datafusion-ffi->datafusion-common datafusion-ffi->datafusion-datasource datafusion-ffi->datafusion-execution datafusion-ffi->datafusion-expr datafusion-ffi->datafusion-functions datafusion-ffi->datafusion-functions-aggregate datafusion-ffi->datafusion-physical-expr datafusion-ffi->datafusion-physical-expr-common datafusion-ffi->datafusion-physical-plan datafusion-proto datafusion-proto datafusion-ffi->datafusion-proto datafusion-ffi->datafusion-session datafusion-functions->datafusion-common datafusion-functions->datafusion-execution datafusion-functions->datafusion-expr datafusion-functions->datafusion-expr-common datafusion-functions->datafusion-physical-expr-common datafusion-functions-aggregate->datafusion-common datafusion-functions-aggregate->datafusion-execution datafusion-functions-aggregate->datafusion-expr datafusion-functions-aggregate->datafusion-physical-expr datafusion-functions-aggregate->datafusion-physical-expr-common datafusion-functions-nested->datafusion-common datafusion-functions-nested->datafusion-execution datafusion-functions-nested->datafusion-expr datafusion-functions-nested->datafusion-expr-common datafusion-functions-nested->datafusion-functions datafusion-functions-nested->datafusion-functions-aggregate datafusion-functions-nested->datafusion-physical-expr-common datafusion-physical-expr->datafusion-common datafusion-physical-expr->datafusion-expr datafusion-physical-expr->datafusion-expr-common datafusion-physical-expr->datafusion-physical-expr-common datafusion-physical-expr->datafusion-proto-models datafusion-physical-expr-common->datafusion-common datafusion-physical-expr-common->datafusion-expr-common datafusion-physical-expr-common->datafusion-proto-models datafusion-physical-plan->datafusion-common datafusion-physical-plan->datafusion-execution datafusion-physical-plan->datafusion-expr datafusion-physical-plan->datafusion-expr-common datafusion-physical-plan->datafusion-functions datafusion-physical-plan->datafusion-physical-expr datafusion-physical-plan->datafusion-physical-expr-common datafusion-physical-plan->datafusion-proto-models datafusion-proto->datafusion-catalog datafusion-proto->datafusion-catalog-listing datafusion-proto->datafusion-common datafusion-proto->datafusion-datasource datafusion-proto->datafusion-datasource-avro datafusion-proto->datafusion-datasource-parquet datafusion-proto->datafusion-execution datafusion-proto->datafusion-expr datafusion-proto->datafusion-physical-expr datafusion-proto->datafusion-physical-expr-common datafusion-proto->datafusion-physical-plan datafusion-proto->datafusion-proto-models datafusion-proto-models->datafusion-common datafusion-session->datafusion-common datafusion-session->datafusion-execution datafusion-session->datafusion-expr datafusion-session->datafusion-physical-plan __more__ +28 more projects

Architecture — module dependency matrix

Rows and columns are the same modules, ordered so that a module only depends on ones above it. A cell means the row depends on the column, and its number is how many type pairs create that dependency. Read one thing: is anything above the diagonal? A mark there is a dependency cycle. (A cycle is all this shows — an unusual but cycle-free dependency sits below the diagonal like any other.)

1205 modules, 4352 dependencies. 10 dependency cycles across 188 modules, marked above the diagonal.

Showing the 40 most-connected modules; 1165 more are not drawn.

Module dependency matrix. The row depends on the column; the number is how many type pairs create the dependency. A cell above the diagonal is part of a dependency cycle.
depends on →1 datafusion_doc2 datafusion_execution.memory_pool3 datafusion_execution.stream4 datafusion_expr_common.accumulator5 datafusion_expr_common.groups_accumulator6 datafusion_common.dfschema7 datafusion_common.join_type8 datafusion_common.stats9 datafusion_expr.simplify10 datafusion_expr_common.columnar_value11 datafusion_expr_common.operator12 datafusion_expr_common.signature13 datafusion_functions_aggregate_common.accumulator14 datafusion_physical_expr_common.metrics15 datafusion_physical_expr_common.sort_expr16 datafusion_expr.logical_plan.plan17 datafusion_expr.udaf18 datafusion_expr.udf19 datafusion_expr.udwf20 datafusion_physical_expr_common.metrics.baseline21 datafusion_execution.task22 datafusion_physical_plan.joins.utils23 datafusion_proto_models.generated.prost24 datafusion_expr.expr25 datafusion_common.scalar26 datafusion_expr_common.statistics27 datafusion_spark.function.string.format_string28 datafusion_common.table_reference29 datafusion_physical_plan.display30 datafusion_common.column31 datafusion_proto_common.generated.prost32 datafusion_common.config33 datafusion_physical_expr_common.physical_expr34 datafusion_physical_plan.proto35 datafusion.execution.session_state36 datafusion_physical_plan.projection37 datafusion.execution.context38 datafusion_physical_plan.execution_plan39 datafusion_datasource.file_scan_config40 datafusion_physical_plan.aggregates
1 datafusion_doc
2 datafusion_execution.memory_pool
3 datafusion_execution.stream
4 datafusion_expr_common.accumulator
5 datafusion_expr_common.groups_accumulator
6 datafusion_common.dfschema1223
7 datafusion_common.join_type2
8 datafusion_common.stats122
9 datafusion_expr.simplify12
10 datafusion_expr_common.columnar_value11
11 datafusion_expr_common.operator1
12 datafusion_expr_common.signature6
13 datafusion_functions_aggregate_common.accumulator1
14 datafusion_physical_expr_common.metrics4
15 datafusion_physical_expr_common.sort_expr131
16 datafusion_expr.logical_plan.plan431146323
17 datafusion_expr.udaf313361931
18 datafusion_expr.udf331333
19 datafusion_expr.udwf3311
20 datafusion_physical_expr_common.metrics.baseline5
21 datafusion_execution.task11111
22 datafusion_physical_plan.joins.utils351112122
23 datafusion_proto_models.generated.prost232135134412
24 datafusion_expr.expr22142111111211
25 datafusion_common.scalar12
26 datafusion_expr_common.statistics15
27 datafusion_spark.function.string.format_string1131
28 datafusion_common.table_reference21
29 datafusion_physical_plan.display8
30 datafusion_common.column11
31 datafusion_proto_common.generated.prost315512
32 datafusion_common.config94
33 datafusion_physical_expr_common.physical_expr111
34 datafusion_physical_plan.proto222242
35 datafusion.execution.session_state14333222261
36 datafusion_physical_plan.projection11221112121125
37 datafusion.execution.context1211121113
38 datafusion_physical_plan.execution_plan1321212111
39 datafusion_datasource.file_scan_config3123111122121
40 datafusion_physical_plan.aggregates32211111122134
Dependency, pointing down the layeringAbove the diagonal — part of a cycleThe module itself
datafusion_doc…execution.memory_pool…sion_execution.stream…pr_common.accumulator…on.groups_accumulator…usion_common.dfschema…sion_common.join_type…tafusion_common.stats…afusion_expr.simplify…common.columnar_value…_expr_common.operator…expr_common.signature…te_common.accumulator…l_expr_common.metrics…expr_common.sort_expr…xpr.logical_plan.plandatafusion_expr.udafdatafusion_expr.udfdatafusion_expr.udwf…mmon.metrics.baseline…fusion_execution.task…ical_plan.joins.utils…odels.generated.prostdatafusion_expr.expr…afusion_common.scalar…xpr_common.statistics….string.format_string…ommon.table_reference…physical_plan.display…afusion_common.column…ommon.generated.prost…afusion_common.config…_common.physical_expr…n_physical_plan.proto…ecution.session_state…sical_plan.projection…ion.execution.context…l_plan.execution_plan…urce.file_scan_config…sical_plan.aggregatesdatafusion_doc1…execution.memory_pool2…sion_execution.stream3…pr_common.accumulator4…on.groups_accumulator5…usion_common.dfschema6…sion_common.join_type7…tafusion_common.stats8…afusion_expr.simplify9…common.columnar_value10…_expr_common.operator11…expr_common.signature12…te_common.accumulator13…l_expr_common.metrics14…expr_common.sort_expr15…xpr.logical_plan.plan16datafusion_expr.udaf17datafusion_expr.udf18datafusion_expr.udwf19…mmon.metrics.baseline20…fusion_execution.task21…ical_plan.joins.utils22…odels.generated.prost23datafusion_expr.expr24…afusion_common.scalar25…xpr_common.statistics26….string.format_string27…ommon.table_reference28…physical_plan.display29…afusion_common.column30…ommon.generated.prost31…afusion_common.config32…_common.physical_expr33…n_physical_plan.proto34…ecution.session_state35…sical_plan.projection36…ion.execution.context37…l_plan.execution_plan38…urce.file_scan_config39…sical_plan.aggregates401223212212111614131431146323313361931331333331151111135111212223213513441222142111111211121511312181131551294111222242143332222611122111212112512111211131321212111312311112212132211111122134+1165 more modules (most-connected shown)

At a glance — Code Health · 83% · Strong ·

At a glance — Architecture · 95% · Exemplary ·

At a glance — Maturity · 67% · Adequate · gated by M2 ·

At a glance — Readiness · 77% · Strong ·

At a glance — Security · 71% · Adequate · gated by D29, D36 ·

At a glance — Performance · 100% · Exemplary ·

Security & Compliance — OWASP Top-10 mapping

Findings mapped to OWASP categories; the specific CVEs/secrets are in the Security dimension cards below and findings.md (redacted only on the public version of this report).

OWASP categoryFindingsSeverity
A03:2021 — Injection57High / Critical
A06:2021 — Vulnerable & Outdated Components7Medium
A05:2021 — Security Misconfiguration6High / Critical
A02:2021 — Cryptographic Failures2High / Critical

Roadmap

First, establish a robust architecture decision record system by documenting significant choices with context and consequences in a standard directory structure. Simultaneously, enhance onboarding and documentation quality by adding a quick-start section to the root README and resolving existing documentation gaps. Finally, implement a draft release or approval gate to prevent bad builds from reaching users, ensuring a safe and controlled deployment process.

Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.

Do thisHelpsEffortDimension
Resolve the 1 No ADRs found finding(s) in ADR Quality.+5.1 ptsLowADR Quality
Resolve the 2 Documentation finding(s) in Documentation Quality — start with README.md (2).+2.6 ptsLowDocumentation Quality
Record significant decisions one document per decision — dated, stating the context, the decision and its consequences — and keep them together wherever your design docs already live (a conventional `docs/adr/` tree, with each file named `NNNN-title` in whatever markup those docs already use, is the most discoverable form).+5.1 ptsMediumArchitecture documentation
Add a build/run (quick start) section to the root README — the first thing a newcomer needs.+4.5 ptsMediumDocumentation (README)
Resolve the 9 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (2), REDACTED (2), REDACTED.+0.7 ptsLowStatic Analysis (SAST)
Nothing pauses a release for a human: publish as a draft release (or gate the release job on a protected tag/manual dispatch) so a bad build can be stopped before users can download it.+2.0 ptsMediumDeployment & Rollback
Dependabot is configured but does not watch `pip`, `gitsubmodule` — add those `package-ecosystem` entries to REDACTED so those dependencies get the same automatic update and advisory pressure as the ones it already covers.+1.9 ptsMediumSecurity & performance tooling
Fix the release pipeline's version hand-off — read back the variable the step actually assigns, and add `set -euo pipefail` to the step so an unset variable fails the job instead of quietly publishing an empty version.+1.9 ptsMediumRelease Hygiene

File quality

Per-file score 0–10 — a quality signature. Of 538 files carrying findings, judged against the Production bar: 0% slop · 66% mixed · 34% near-clean.

FileScoreBandWorst signal
REDACTED0.7SlopStatic Analysis (SAST): High: REDACTED
REDACTED0.7SlopStatic Analysis (SAST): High: REDACTED
REDACTED4.1MixedIaC & Container Security: High IaC: REDACTED
REDACTED4.6MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.6MixedStatic Analysis (SAST): High: REDACTED
REDACTED5.1MixedStatic Analysis (SAST): High: REDACTED
REDACTED5.1MixedStatic Analysis (SAST): High: REDACTED
datafusion/proto-common/src/from_proto/mod.rs5.5MixedCyclomatic Complexity: ScalarValue::try_from (cyclomatic 57)
datafusion/proto/src/logical_plan/from_proto.rs5.5MixedCyclomatic Complexity: datafusion_proto::logical_plan::from_proto::parse_expr (cyclomatic 48)
datafusion/physical-plan/src/aggregates/grouped_hash_stream.rs5.5MixedCyclomatic Complexity: GroupedHashAggregateStream::poll_next (cyclomatic 27)
datafusion/proto-common/src/to_proto/mod.rs5.7MixedCyclomatic Complexity: ScalarValue::try_from (cyclomatic 64)
datafusion/datasource-csv/src/source.rs5.7MixedCode Duplication: Near-duplicate member pair (38 shared lines)
REDACTED5.8MixedStatic Analysis (SAST): High: REDACTED
REDACTED5.8MixedStatic Analysis (SAST): High: REDACTED
REDACTED5.8MixedStatic Analysis (SAST): High: REDACTED
datafusion/proto/src/logical_plan/to_proto.rs5.9MixedCyclomatic Complexity: datafusion_proto::logical_plan::to_proto::serialize_expr (cyclomatic 45)
REDACTED5.9MixedDependency Vulnerabilities: Medium advisory (unmaintained): REDACTED
datafusion/sql/src/statement.rs6.0MixedExplicit Debt: TodoComment
datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs6.0MixedExplicit Debt: TodoComment
datafusion/common/src/scalar/mod.rs6.0MixedExplicit Debt: TodoComment

How the grades work

Every finding carries one of four grades. Three say how serious it is. The fourth says this survey could not settle it — and it is a grade, not a gap.

Critical — 50

A definite problem that already costs you something and drags the score down: a missing authorisation check, a dependency with a known exploit, a build that does not reproduce. Failure here tends to cause failures elsewhere.

Serious — 2155

Likely wrong, but not failing yet. It degrades the codebase over a longer horizon and can cause failures elsewhere — not urgent this week, not something to carry for two years either.

Minor — 23

Recorded, with no effect on how the codebase functions. Present so the survey is complete, not because it needs doing.

Could not be resolved — 47

Something this survey could not settle from the outside, and which could be critical or serious. Either a control was required and no positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean result. These are excluded from the score rather than awarded a pass, so the number on the cover neither rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each one is named under Limitations.

Methodology & how to trust this report

Watchdog is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. 38 of 42 evaluated dimensions are computed purely by tools and static analysis (confidence 1.0); 4 documentation/naming judgement(s) are LLM-assisted and labelled advisory. Overall confidence is 0.9 — the weighted average across measured dimensions; it falls as more of the score leans on LLM-assisted judgement and rises when it's fully tool-backed.

Every figure here is one of three kinds, and we label which: ✓ Measured — a deterministic fact (LoC, complexity, coverage); ~ Modeled — an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact; ◐ Advisory — an LLM prose judgement. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): ✓ Tool-verified means the property itself was measured across the surface; ○ Nothing flagged means the probes came back clean — a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence — absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10; ◐ Sampled · advisory marks an LLM verdict over a bounded sample — advisory, never a deterministic measurement.

What we checked — 42 dimensions across the health lenses
D1D2D3D4D5D9D12D13D14D15D16D17D19D20D21D22D23D26D28D29D30D31D34D35D36D43D44AX10AX3AX4AX8AX9M1M2M3M4P1P2P3P4P6PF3

Each chip is a dimension scored from real signals across architecture, testing, dependencies, security & compliance, documentation, git-history and code quality — in one coherent pass. A surface report typically covers a handful.

How to trust any code-health report — three questions
  1. Can you open the finding? Real findings cite a repo-relative file and line you can open at the cited line — never an absolute scratch path. Here, 2194 of 2228 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
  2. Is there a tool behind the number? Every score below names the method that produced it — Roslyn, git, a scanner, or (for a handful of documentation/naming dimensions) an LLM labelled sampled · advisory — not a narrative.
  3. Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.

This report answers yes to all three. That's the bar to hold any assessment to.

Tools & methods

The actual versions used this run (captured at analysis time) — re-run on the same commit for the identical score.

MethodBacksVersionEvaluator
Roslyn static analysisComplexity, cohesion, coupling, dead code, API surface, layering5.3.0✓ deterministic
Native secret scannerHardcoded secrets / credentials1.0.0✓ deterministic
Watchdog duplication detector (in-process)Code duplication1.0.0✓ deterministic
Coverage (coverlet / dotnet-coverage)Line & branch coverage10.0.400✓ deterministic
NuGet / dotnetOutdated, vulnerable & deprecated dependencies10.0.400✓ deterministic
git / LibGit2SharpChurn hotspots, knowledge concentration, history2.43.0 · 0.31.0✓ deterministic
gitleaks · semgrep · trivy · checkovSecrets in history, SAST, CVEs, IaC & container, PII / GDPR1.86.0 · 0.69.3 · 3.2.533✓ deterministic
LLM (sampled · advisory)Documentation quality, ADR conformance, naming — sampled over a bounded sample; advisory, never a deterministic measurementLocal LLM◐ LLM · sampled · advisory

Every finding is locatable in findings.md. Run 01a0eb90-f54e-762f-8bbb-300f24e70c28.

The exact command behind every deep-scan dimension — tool, version, invocation and retained raw output — is in Appendix B — Reproduction & audit trail.

Run transparency — what happened this run

What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.

  • D6 Cohesion (LCOM4) — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover the language this repository's product is written in, so it had nothing of the product to read. That is a gap in this analyzer's language reach — not a finding about this repository.
  • D8 Code Coverage — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT READ here — but this repository measures it: a coverage step in CI (`codecov/codecov-action`) shows that coverage is collected and tracked in your own CI. The built-in collector has no runner for this ecosystem (.rs), so the analyzer could not read the number — a gap in the analyzer's language coverage, not an unmeasured repo. Not scored. To have the real number read, produce a coverage report in a standard format (lcov — `cargo install cargo-llvm-cov`, then `cargo llvm-cov --lcov --output-path lcov.info`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures. You can widen what we reach: optional: produce a coverage report in a standard format (lcov — `cargo install cargo-llvm-cov`, then `cargo llvm-cov --lcov --output-path lcov.info`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures — then the real number is read on the next scan.
  • D11 Test Reliability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test source is present (.rs) and this repository declares a Cargo test suite (repository root, 829 test files), but it was not re-run: no test result was produced. Not scored — this is a gap in the analyzer's language coverage, not a finding about this repository.
  • D14 License Compliance — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository declares a Python pyproject.toml/requirements.txt (pip/uv/Poetry), but the licence verdict published here was taken over its crate dependencies. Nothing was read about its Python dependencies' licensing in either direction, and a clean score on this card must not be read as covering them.
  • AX1 Captive dependencies — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • AX2 Stateful singletons — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • AX6 Interface segregation — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is computed over the public interfaces this run's compilations declare, and none was loaded, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • C1 Data Protection — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These personal data controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks personal data controls.
  • C2 Access Controls — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These authorization controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks authorization controls.
  • C3 Audit Trail — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These audit controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks audit controls.
  • C4 Data Retention — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These retention controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks retention controls.
  • C5 Data-Subject Rights — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These data-subject rights controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks data-subject rights controls.
  • ED5 Idempotency — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check finds retry-prone mutations by walking the repository's declared types, and NONE was loaded on this run, so it had nothing to look at. That is a limit of the analyzer's reach — it reads .NET projects — not a finding that this repository has no command handlers or message consumers.
  • GD1 Unfinished & placeholder code — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • IC1 Incompleteness & stubs — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • P10 Library API & versioning — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads NuGet packaging and C# public API only, and no .NET project was loaded for this repository, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • PF1 Benchmark discipline — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • PF2 Allocation hygiene — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • S1 Web-Security Posture — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These web-security controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks web-security controls.
  • X1 Async correctness — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X10 Duplicated predicate — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X12 Unreachable branch — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X13 Undrained process stream — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X14 Bypassable address classification — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X15 Unvalidated length from an untrusted reader — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X16 Unfloored truncation loop — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X17 Uncapped recursion over a caller-supplied document — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X18 Disposal-pattern correctness — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X19 Unrestored process-global state — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X2 Cancellation propagation — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X20 Mistyped argument guard — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X21 Side-effecting pattern guard — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X22 Contradicted release guard — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X23 Unguarded diagnostic materialisation — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X24 Document value interpolated into markup unescaped — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X25 Inert configuration knob — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X26 Unsynchronised callback handoff — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X27 Collection changed while being enumerated — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X28 Index access outside its own emptiness guard — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X29 Per-element action decided by a fixed element — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X3 Exception handling — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X30 Support guard that admits what it rejects — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X32 Type resolved by simple name across every loaded assembly — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X4 Structured logging — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X5 Nullable reference types — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X6 Hand-rolled structured-format parsing — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X7 Silent fallback defaults — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.

Repo exclusion declarations: 2 pattern(s) declared (.gitattributes linguist-generated/vendored, .editorconfig generated_code) excluded 0 source file(s) from code-quality scoring. Declarations are the repo's own visible statement that a tree is machine-written or vendored — auditable in any diff, honored by GitHub the same way.

Limitations & what we did not check

Watchdog assesses the repository exactly as committed, and only the repository. By design it does not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.

Per-dimension blind spots

For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.

  • D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
  • D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
  • D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
  • D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
  • D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
  • D9 Test Distribution: The test-pyramid shape is inferred from project/folder naming and references, with a single test host bucketed per-file by its path tier and content signals — a suite that names tiers unconventionally and gives no per-file signal can still be mis-bucketed.
  • D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
  • D13 REDACTED Scanning: REDACTED detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
  • D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
  • D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
  • D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
  • D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
  • D19 Documentation Quality: Documentation quality is judged by an LLM over a bounded sample of docs — it reads what is written, not whether the docs match the running system, and it is advisory, not a measurement. Its critique rows are drawn from a closed category vocabulary and each row means the same thing in every run, so two scans can be compared row by row; the SET that fires is still a sample, and does not repeat exactly. Measured on one frozen input, six scans at one engine SHA: 2-5 critique rows per scan, 8 distinct rows across the six, 3 of those 8 seen in only one scan. So a D19 row is evidence about the documentation, but a COUNT of D19 rows is not a quantity — never read a change in it as an improvement or a regression.
  • D20 ADR Quality: ADR quality is an LLM read of the decision records present — it cannot know about decisions made and never recorded, and its verdict is sampled and advisory.
  • D21 Naming Consistency: Naming quality is an LLM judgement over a bounded sample — it assesses clarity/consistency of the names it sees, not domain-correctness, and is advisory.
  • D22 Internal API Consistency: API-surface coherence is an LLM judgement over a sample of the public surface — consistency of intent across the whole API is approximated, not exhaustively verified.
  • D23 Boundary Type-Coupling: Boundary leakage is detected from type references across detected contexts — leaks that flow through primitives, serialization or shared infrastructure may not surface as a typed reference.
  • D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
  • D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
  • D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
  • D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
  • D31 IaC & Container Security: IaC scanning checks Dockerfiles/Terraform/Kubernetes against best-practice rules — it cannot see the live cloud account, runtime configuration, or drift between the committed config and what is actually deployed.
  • D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
  • D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
  • D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
  • D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a REDACTED (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (go.mod, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
  • AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
  • AX9 CQS / query purity: Handlers are found by interface/name convention — a query handler using neither is not seen. Mutation is a resolved write/publish invocation (SaveChanges/repository/bus), so a write hidden behind a hand-rolled wrapper, reflection, or a string-keyed service locator resolves to a non-persistence type and isn't flagged; it detects that a query writes state, not whether the write is a legitimate read-side cache update. Clean means "no resolved write/publish in a query body", not a proof of CQS purity.
  • M4 Documentation accuracy: Onboarding quality is an LLM read of the docs/setup present — it cannot run the onboarding or measure how long a real new joiner takes; the verdict is sampled and advisory.
  • P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
  • P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.

The LLM boundary

LLM-set scores this run (4): D19, D21, D22, M4 (model: Local LLM). For these, a model reads a bounded sample and sets the numeric score; each names its own sample and method on its card. They are sampled and advisory by design: they vary at the margins between runs and are never a deterministic measurement. Every other score in this report is tool-computed at confidence 1.0.

Dimensions

D1 · Cyclomatic Complexity5.2 / 10Adequate✓ Tool-verified

What it measures: How tangled the control flow is — methods with many branches are hard to test and change.

Method: Cyclomatic complexity per method (1 + decision points), computed exhaustively across production source; test projects separated by convention. Deterministic.

Maturity: Documented → Verified → Prevented · effective 5.2 / 10 · rule-coverage 100% · ceiling Prevented

245 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was SqlToRel::sql_statement_to_plan_with_context_impl at 215. A further 95 method(s) were over the threshold but excluded as flat dispatchers (a long switch/match over independent cases: many branches, almost no nesting), the largest being Unparser::scalar_to_sql at 82 — they are counted neither in the figure above nor in this dimension's score. 35 files carry no cyclomatic complexity row at all for this reason — every one of their over-threshold functions was excluded, so the exclusion is disclosed nowhere in the file itself: datafusion/common/src/heap_size.rs (ScalarValue::heap_size at 51), datafusion/functions-aggregate-common/src/min_max.rs (datafusion_functions_aggregate_common::min_max::min_max_scalar_same_variant at 45), datafusion/sql/src/expr/binary_op.rs (SqlToRel::parse_sql_binary_op at 45), datafusion/expr-common/src/operator.rs (Operator::fmt at 43), datafusion/substrait/src/logical_plan/producer/expr/scalar_function.rs (datafusion_substrait::logical_plan::producer::expr::scalar_function::operator_to_name at 43), and 30 more not listed here. They are named here because the per-file figures other dimensions report are taken BEFORE this exclusion, so such a file can show a high maximum complexity elsewhere in this report and nothing here, with nothing to reconcile the two.

ScalarValue::deserialize (cyclomatic 136) · ×11datafusion/proto-common/src/generated/pbjson.rs:8805
SqlToRel::sql_statement_to_plan_with_context_impl (cyclomatic 215) · ×9datafusion/sql/src/statement.rs:267
datafusion_functions::datetime::date_bin::date_bin_impl (cyclomatic 37) · ×9datafusion/functions/src/datetime/date_bin.rs:517
datafusion_spark::function::math::round::spark_round (cyclomatic 45) · ×8datafusion/spark/src/function/math/round.rs:421
datafusion_substrait::logical_plan::consumer::expr::literal::from_substrait_literal (cyclomatic 96) · ×7datafusion/substrait/src/logical_plan/consumer/expr/literal.rs:69

+ 134 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 11 ScalarValue finding(s) in Cyclomatic Complexity — start with mod.rs (10), pbjson.rs. — One of this dimension's main actionable groups (11 warning-level).
  2. Resolve the 9 SqlToRel finding(s) in Cyclomatic Complexity — start with statement.rs (4), function.rs, mod.rs. — One of this dimension's main actionable groups (9 warning-level).
  3. Resolve the 9 datafusion_functions finding(s) in Cyclomatic Complexity — start with date_bin.rs, regexpcount.rs, round.rs. — One of this dimension's main actionable groups (9 warning-level).
  4. Enforce Cyclomatic Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.

D2 · Cognitive Complexity4.9 / 10Weak✓ Tool-verified

What it measures: How hard the code is for a person to follow, beyond raw branching.

Method: Cognitive complexity per method (Sonar-style nesting-penalized score), computed exhaustively over production code, excluding test projects. Deterministic.

Maturity: Documented → Verified → Prevented · effective 4.9 / 10 · rule-coverage 100% · ceiling Prevented

466 method(s) exceeded the cognitive complexity threshold of 15; the worst was Unparser::select_to_sql_recursively at 268.

datafusion_functions::unicode::lpad::lpad_impl (cognitive 111) · ×22datafusion/functions/src/unicode/lpad.rs:366
datafusion_physical_plan::windows::window_equivalence_properties (cognitive 102) · ×19datafusion/physical-plan/src/windows/mod.rs:380
SqlToRel::sql_statement_to_plan_with_context_impl (cognitive 238) · ×18datafusion/sql/src/statement.rs:267
datafusion_optimizer::decorrelate_lateral_join::rewrite_internal (cognitive 37) · ×16datafusion/optimizer/src/decorrelate_lateral_join.rs:76
datafusion_functions_nested::string::compute_array_to_string (cognitive 47) · ×15datafusion/functions-nested/src/string.rs:592

+ 239 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 22 datafusion_functions finding(s) in Cognitive Complexity — start with common.rs (5), lpad.rs (2), rpad.rs (2). — One of this dimension's main actionable groups (22 warning-level).
  2. Resolve the 19 datafusion_physical_plan finding(s) in Cognitive Complexity — start with utils.rs (6), mod.rs (4), exec.rs (2). — One of this dimension's main actionable groups (19 warning-level).
  3. Resolve the 18 SqlToRel finding(s) in Cognitive Complexity — start with statement.rs (5), select.rs (5), mod.rs (3). — One of this dimension's main actionable groups (18 warning-level).
  4. Enforce Cognitive Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.

D3 · God Classes8.9 / 10Strong✓ Tool-verified

What it measures: Over-large classes that try to do too much ("god classes").

Method: God-class detection by line and method-count thresholds per logical type (partial classes unified), filtered for generated code and registration/contract false positives. Deterministic.

Maturity: Documented → Verified → Prevented · effective 8.9 / 10 · rule-coverage 100% · ceiling Prevented

304 god class(es) detected.

FileTooLong: scalar/mod.rs · ×118datafusion/common/src/scalar/mod.rs
MethodTooLong: SqlToRel.sql_statement_to_plan_with_context_impl · ×82datafusion/sql/src/statement.rs:267
FunctionTooLong: datafusion_physical_expr::planner::create_physical_expr · ×45datafusion/physical-expr/src/planner.rs:133
ClassTooLong: ScalarValue · ×36datafusion/common/src/scalar/mod.rs:358
TooManyMethods: SqlToRel · ×18datafusion/sql/src/planner.rs:454

+ 2 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 118 FileTooLong finding(s) in God Classes — start with mod.rs (19), exec.rs (3), utils.rs (3). — One of this dimension's main actionable groups (118 warning-level).
  2. Resolve the 82 MethodTooLong finding(s) in God Classes — start with mod.rs (18), expr.rs (7), plan.rs (6). — One of this dimension's main actionable groups (82 warning-level).
  3. Resolve the 45 FunctionTooLong finding(s) in God Classes — start with mod.rs (3), enforce_distribution.rs (3), literal.rs (2). — One of this dimension's main actionable groups (45 warning-level).
  4. Enforce God Classes in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.

D4 · Code Duplication9.6 / 10Stronggated by 643 serious findings✓ Tool-verified

What it measures: Copy-pasted code that should be shared instead.

Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), density-scored per KLoC of production code. Deterministic.

Maturity: Documented → Verified → Prevented · effective 9.6 / 10 · rule-coverage 100% · ceiling Verified

609 duplicated block group(s) detected. A further 34 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted. 10 of the 643 are in trees this repository does not ship — vendored, example/demo, fixture and benchmark code — and are ranked below the shipped groups rather than excluded from them: the duplication there is real and is still counted in this dimension's score. The dimensions that publish a production-file census leave those trees out of theirs, so this count is deliberately drawn over the wider population.

Duplicated block (9 lines × 2) · ×56datafusion/catalog/src/information_schema.rs:1046
Duplicated block (8 lines × 2) · ×42datafusion/core/src/dataframe/mod.rs:1066
Duplicated block (7 lines × 2) · ×42datafusion/common/src/dfschema.rs:729
Duplicated block (10 lines × 2) · ×38datafusion/common/src/dfschema.rs:717
Duplicated block (6 lines × 2) · ×34datafusion/catalog/src/information_schema.rs:1331

+ 129 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 56 Duplicated block (9 lines × 2) finding(s) in Code Duplication — start with mod.rs (7), logical_extension_codec.rs (3), lpad.rs (3). — One of this dimension's main actionable groups (56 warning-level).
  2. Resolve the 42 Duplicated block (8 lines × 2) finding(s) in Code Duplication — start with mod.rs (5), logical_extension_codec.rs (3), interval_arithmetic.rs (2). — One of this dimension's main actionable groups (42 warning-level).
  3. Resolve the 42 Duplicated block (7 lines × 2) finding(s) in Code Duplication — start with logical_extension_codec.rs (3), bitmap_bit_position.rs (3), first_last.rs (2). — One of this dimension's main actionable groups (42 warning-level).
  4. Enforce Code Duplication in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.

Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.

D5 · Coupling7.7 / 10Strong✓ Tool-verified

What it measures: Whether volatile projects sit underneath others that depend on them (so their churn ripples upward), and whether project dependencies form cycles. A widely-depended-on but stable shared/kernel project is healthy, not penalised.

Method: Dependency cycles via elementary-DFS over real .csproj references, plus Martin instability (afferent/efferent) per project. Exhaustive over the reference graph, deterministic.

Coverage: Exhaustive · type-level: afferent/efferent coupling + cycles computed over every production type — the population is all types, not a name convention.

Maturity: Documented → Verified → Prevented · effective 7.7 / 10 · rule-coverage 100% · ceiling Prevented

48 production modules (Cargo+npm+Python), 0 dependency cycle(s), 10 unstable depended-on module(s). Read from the build's own module declarations; 3 module(s) off the main sequence, with abstractness counted on 41 of the 48 (the rest declare no modelled class or interface, export only macros, or have no source directory of their own).

Off the main sequence: datafusion-doc · ×3
Unstable project datafusion
Unstable project datafusion-catalog-listing
Unstable project datafusion-datasource-arrow
Unstable project datafusion-datasource-avro

+ 6 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 3 Off the main sequence finding(s) in Coupling. — One of this dimension's main actionable groups (3 warning-level).
  2. Resolve the 1 Unstable project datafusion finding(s) in Coupling. — One of this dimension's main actionable groups (1 warning-level).
  3. Resolve the 1 Unstable project datafusion-catalog-listing finding(s) in Coupling. — One of this dimension's main actionable groups (1 warning-level).
  4. Enforce Coupling in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

Detailed fixes: d5_recommendation.md · top locations in Appendix A, every location in findings.md.

D9 · Test Distribution10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether the test suite has a healthy mix of unit / integration / end-to-end tests.

Method: Test projects classified (Unit/Integration/BDD/E2E) from compiled metadata; test methods counted exhaustively across projects with placement-agnostic disk fallback. Deterministic.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

10138 test methods: 7229 unit, 2909 integration, 0 BDD, 0 e2e. The Rust suite contributes 10138 `#[test]` function(s) across 829 file(s) declaring at least one; its unit/integration split is Cargo's own — 162 of those file(s) are integration-test targets under a crate's tests/ directory, and the rest are #[test] functions compiled into the crate they test.

✓ On the Gold path — maintain.

Detailed fixes: d9_recommendation.md.

D12 · Dependency Hygiene9.9 9.7 / 10Exemplary✓ Tool-verified

What it measures: Whether dependencies are current, secure, and not bloated.

Method: Manifest scan via dotnet list package across all projects; worst-signal-per-package deduction (saturating for vulnerabilities, capped-linear for deprecation/outdated) per KLoC. Exhaustive, deterministic.

Maturity: Documented → Verified → Prevented · effective 9.7 / 10 · rule-coverage 98% · ceiling Verified

2 outdated, 0 yanked direct Cargo dependencies. 48 of 49 direct crates were graded against crates.io (0 not published there, 1 not resolved by a committed REDACTED). Only DIRECT edges are graded: a transitive crate cannot be moved past what its parent's requirement admits, so reporting one would be advice its owner cannot take. A newer release is reported only where this repository's OWN requirement already admits it, so the remedy is `cargo update` and never a manifest edit — which means a release outside the declared range is deliberately NOT charged, because a written-down constraint is a decision rather than a defect. Note that a bare requirement is a CARET, and for a 0.x crate its ceiling is the minor. Whether any crate is UNMAINTAINED is not graded — crates.io publishes no maintenance status, and release age does not stand in for one. Known CVEs in this dependency graph are D30's question, read from REDACTED there.

Outdated: thiserror · ×2

✓ On the Gold path — maintain.

Detailed fixes: d12_recommendation.md · top locations in Appendix A, every location in findings.md.

D13 · REDACTED Scanning10.0 / 10Exemplary○ Nothing flagged

What it measures: Whether any secrets (keys, tokens, passwords) have leaked into the code.

Method: In-process native secret scanner (entropy plus signature patterns) across all tracked files; no external tool. A clean result is a measured 10, not no-data zero. Deterministic.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Prevented

REDACTED scan ran and found no leaked secrets.

✓ On the Gold path — maintain.

Detailed fixes: d13_recommendation.md.

D14 · License Compliance10.0 / 10Exemplary○ Nothing flagged

What it measures: Whether the licenses of third-party packages are compatible with your policy.

Method: Third-party package licenses resolved from declared package metadata and checked against the configured policy (allow/deny/copyleft). Deterministic; clean = no incompatible license found at metadata depth.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Verified

0 of 581 shipped crate(s) use a banned license. Licences were resolved from crates.io over the crates a consumer compiles — this repository's REDACTED closed over its manifests' `[dependencies]` and `[build-dependencies]`. Crates it asks for ONLY under `[dev-dependencies]` are excluded: they are not compiled by anything that depends on this repository. This repository publishes itself under Apache-2.0, which is its own choice and is not judged here. ★ COVERAGE OF THIS VERDICT: it grades this repository's crate dependencies and nothing else. The repository also declares a Python pyproject.toml/requirements.txt (pip/uv/Poetry), and the licences of those dependencies were NOT read by this pass — a gap in this engine's coverage, not a statement about them. So this result says the graded closure carries no banned licence; it does NOT say this repository's licensing is clear.

✓ On the Gold path — maintain.

Detailed fixes: d14_recommendation.md.

D15 · Churn × Complexity Hotspots9.6 / 10Stronggated by 90 serious findings✓ Tool-verified

What it measures: Files that change often and are also complex — the riskiest hotspots.

Method: Per production file churn times cyclomatic complexity over a rolling window, computed from git and Roslyn/JS/Razor analysis. Exhaustive, deterministic per commit date.

Maturity: Documented → Verified → Prevented · effective 9.6 / 10 · rule-coverage 100% · ceiling Documented

Top hotspots: REDACTED (28×121=3388); datafusion/sql/src/statement.rs (13×215=2795); datafusion/proto-models/src/generated/pbjson.rs (23×121=2783) Repeated repair below the complexity floor: datafusion/functions-aggregate/src/average.rs (6 of 9 changes were fixes); datafusion/functions/src/regex/regexpinstr.rs (5 of 8 changes were fixes); datafusion/functions-nested/src/extract.rs (5 of 8 changes were fixes)

Hotspot: REDACTED · ×74REDACTED:574
Repeated repair: datafusion/functions-aggregate/src/average.rs · ×16datafusion/functions-aggregate/src/average.rs:292

What to do

  1. Resolve the 74 Hotspot finding(s) in Churn × Complexity Hotspots — start with mod.rs (7), plan.rs (2), expr.rs (2). — One of this dimension's main actionable groups (74 warning-level).
  2. Resolve the 16 Repeated repair finding(s) in Churn × Complexity Hotspots — start with average.rs, regexpinstr.rs, extract.rs. — One of this dimension's main actionable groups (16 warning-level).

Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.

D16 · Bus Factor9.6 / 10Exemplary✓ Tool-verified

What it measures: Whether knowledge is concentrated in too few people (the "bus factor").

Method: Living knowledge per author via time-decayed commit attribution (6-month half-life, focus weighting) across largest source files. Deterministic, avoids blame's mechanical-refactor false positives.

Maturity: Documented → Verified → Prevented · effective 9.6 / 10 · rule-coverage 100% · ceiling Documented

43 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is datafusion/spark/src/function/conversion/cast.rs. Counted over 1096 of the 1246 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

Off-boarding risk: anonymized user #1 · ×4
Further sole-owners (lower concentration)

✓ On the Gold path — maintain.

Detailed fixes: d16_recommendation.md · top locations in Appendix A, every location in findings.md.

D17 · Explicit Debt9.9 / 10Stronggated by 348 serious findings✓ Tool-verified

What it measures: Acknowledged debt left in the code — TODOs, dead code, suppressed warnings.

Method: Roslyn syntactic debt markers (suppressions/TODO/FIXME/HACK/empty-catch/commented-code/Obsolete) plus SymbolFinder dead-code analysis; weighted-debt-per-KLoC density deducted 2.0x per unit. Deterministic, exhaustive.

Maturity: Documented → Verified → Prevented · effective 9.9 / 10 · rule-coverage 100% · ceiling Prevented

418 deducted task-comment markers across 744597 LoC (0.1/KLoC) → score 9.9. Task comments only: this repository's language is read without a compiler, so D17's suppression, dead-code and commented-out-code arms did not run and this score counts fewer marker kinds than a .NET repository's would.

TodoComment · ×324benchmarks/src/nlj.rs:39
HackComment · ×11benchmarks/src/imdb/run.rs:47
FixmeComment · ×10datafusion/core/tests/user_defined/user_defined_scalar_functions.rs:1128
TodoComment repeated across 11 filesdatafusion/catalog-listing/src/helpers.rs:127
TodoComment repeated across 19 filesREDACTED:5198

+ 1 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 324 TodoComment finding(s) in Explicit Debt — start with mod.rs (27), enforce_sorting.rs (11), statistics.rs (10). — One of this dimension's main actionable groups (324 warning-level).
  2. Resolve the 11 HackComment finding(s) in Explicit Debt — start with run.rs (3), nested_loop_join.rs (3), mod.rs (2). — One of this dimension's main actionable groups (11 warning-level).
  3. Resolve the 10 FixmeComment finding(s) in Explicit Debt — start with sql_integration.rs (3), producer.rs (3), value.rs (2). — One of this dimension's main actionable groups (10 warning-level).
  4. Enforce Explicit Debt in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.

D19 · Documentation QualityStrong◐ Sampled · advisory

What it measures: Whether the project's documentation is clear, complete, and useful.

Method: Judged by language model at low temperature (0.0-0.1) on a deterministic doc sample (READMEs plus first 25 architecture docs), with two-pass stability filtering. Advisory, sampled.

Maturity: Documented → Verified → Prevented · effective Strong / 10 · rule-coverage 100% · ceiling Documented

The repository's root README and the docs/README are both excellent at conveying what DataFusion is (an extensible Rust query engine using Apache Arrow) and its licensing. The benchmarks/, datafusion-cli/, and python/READMEs each document their own directories without mentioning the broader project, which is consistent with the per-directory scope of those files. All visible documents are well-structured: the root README gives an overview, installation, usage, contribution guidance, and a licence; docs/README covers build & preview, dependencies, and release process; benchmarks/, datafusion-cli/, and python/READMEs focus on their own directories with no project-level guidance missing. The DataFusion documentation is strong: the READMEs for each module (catalog, common-runtime, core, datasource-arrow/avro/csv/json/parquet) all describe their respective directories and state where to find installation/build instructions. The root repository-level documentation is thin but present; it is a single file ('datafusion/doc/README.md') that says nothing about the project as a whole (what DataFusion does or why it matters), and only mentions the NOTICE/LICENSE licensing, with no overview, usage examples, or contribution guidance. The README for the datafusion/ffi crate is a focused directory document that explains what it does (allowing interoperability with other libraries and DataFusion versions via FFI) and its purpose (stabilizing an ABI across Rust compiler versions). It states licensing, gives a high-level overview of limitations, and begins to outline Use Cases before being clipped. The visible content is clear but the document itself is thin on installation/usage examples and does not yet address the missing standard sections for a README.

Documentation: no installation or build instructions · ×2datafusion/ffi/README.md

What to do

  1. Resolve the 2 Documentation finding(s) in Documentation Quality — start with README.md (2). — One of this dimension's main actionable groups (2 recommendation-level).

Detailed fixes: d19_recommendation.md · top locations in Appendix A, every location in findings.md.

D20 · ADR Quality0.0 / 10Critical✓ Tool-verified

What it measures: Whether architecture decisions are recorded well (context, decision, consequences).

Method: Per-ADR judgment by language model at low temperature with two-pass stability; confidence is share of ADRs evaluated; enforcement-field presence detected deterministically. Advisory.

Maturity: Documented → Verified → Prevented · effective 0.0 / 10 · rule-coverage 100% · ceiling Documented

No architecture decision records were found.

No ADRs found

What to do

  1. Resolve the 1 No ADRs found finding(s) in ADR Quality. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d20_recommendation.md · top locations in Appendix A, every location in findings.md.

D21 · Naming ConsistencyExemplary◐ Sampled · advisory

What it measures: Whether names — types, methods, variables — are clear and consistent.

Method: Judged by language model at low temperature (0.0-0.1) on a deterministic random symbol sample (fixed size, not exhaustive), with disclosed confidence band. Advisory, sampled.

Maturity: Documented → Verified → Prevented · effective Exemplary / 10 · rule-coverage 100% · ceiling Verified

0 naming inconsistencies across 0 sampled symbols.

✓ On the Gold path — maintain.

Detailed fixes: d21_recommendation.md.

D22 · Internal API ConsistencyStronggated by 3 serious findings◐ Sampled · advisory

What it measures: Whether the internal API surface is consistent and coherent.

Method: Judged by language model at low temperature over a sample of the public API surface (IsPackable or .Contracts types). Sampled, advisory; confidence discounted by model uncertainty.

Maturity: Documented → Verified → Prevented · effective Strong / 10 · rule-coverage 100% · ceiling Verified

3 API inconsistencies across a 400-member sample of 2051 exposed types.

Inconsistent parameter naming and type for partition data. MemTable uses `partitions: RecordBatch` (singular type, likely implying a single batch or a specific wrapper), while StreamingTable uses `partitions: Arc` (generic Arc, likely wrapping a Vec or similar). This creates confusion about whether the API expects a single batch, a vector of batches, or an Arc-wrapped collection.
Inconsistent naming convention for constructors. `new` is used for a single path, while `new_with_multi_paths` is used for multiple paths. This breaks the common Rust pattern where `new` is the primary constructor and additional constructors are named `new_<feature>` or similar, but here the distinction is between singular and plural paths. More importantly, the parameter name `table_paths` in the second method is plural, while `table_path` in the first is singular, which is good, but the method name `new_with_multi_paths` is verbose compared to potential alternatives like `new_from_paths`.
Inconsistent parameter type handling. `with_file_extension` takes `impl Into<String>`, while `with_file_extension_opt` takes a generic `S` (likely `Option<S>` or similar, though the signature is truncated, the name suggests an optional variant). If `S` is `Option<String>`, the inconsistency is in the type system usage (converting to String vs. handling Option). If `S` is a different type, it's a clear inconsistency.

What to do

  1. Resolve the 1 Inconsistent parameter naming and type for partition data. MemTable uses… finding(s) in Internal API Consistency. — One of this dimension's main actionable groups (1 warning-level).
  2. Resolve the 1 Inconsistent naming convention for constructors. `new` is used for a… finding(s) in Internal API Consistency. — One of this dimension's main actionable groups (1 warning-level).
  3. Resolve the 1 Inconsistent parameter type handling. `with_file_extension` takes `impl… finding(s) in Internal API Consistency. — One of this dimension's main actionable groups (1 warning-level).

Detailed fixes: d22_recommendation.md · top locations in Appendix A, every location in findings.md.

D23 · Boundary Type-Coupling10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether domain types (IDs, enums, value objects) leak across bounded-context boundaries.

Method: Cross-context domain-type leakage via Roslyn structural classification (strongly-typed IDs / value objects) over every public surface. Exhaustive, deterministic, type-level aggregate-boundary check.

Coverage: Bounded contexts derived from NAMESPACE prefix (or graph-inferred where available); cross-boundary domain-type leakage then checked exhaustively over every public member of every type.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Verified

No domain types leak across context boundaries (2 contexts).

✓ On the Gold path — maintain.

Detailed fixes: d23_recommendation.md.

D26 · Project Cohesion6.5 / 10Adequate✓ Tool-verified

What it measures: Whether each project is a focused, coherent unit rather than an oversized grab-bag.

Method: Project size overshoot penalties (LoC / public-type count / namespace count, 2-of-3 flag) weighted by log magnitude. Exhaustive across projects, deterministic, LLM-independent.

Maturity: Documented → Verified → Prevented · effective 6.5 / 10 · rule-coverage 100% · ceiling Documented

8 of 46 build units (Cargo) flagged as possibly oversized/incoherent.

Projects may be oversized for their cohesion

What to do

  1. Resolve the 1 Projects may be oversized for their cohesion finding(s) in Project Cohesion. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d26_recommendation.md · top locations in Appendix A, every location in findings.md.

D28 · Secrets (history)9.0 / 10Adequategated by 1 critical finding✓ Tool-verified

What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.

Method: REDACTED scan via TWO gitleaks detect passes in an isolated checkout — the full git history, then a second --no-git pass over the working tree as it stands — merged and de-duplicated by (rule, file, line); each match flagged High. Both invocations are recorded in the audit trail. Exhaustive; when the tool is absent, or when its output cannot be parsed into the expected shape, the dimension is WITHHELD as an explicit measurement gap on our side — unscored and excluded from the lens, never a hedged middling score.

Maturity: Documented → Verified → Prevented · effective 9.0 / 10 · rule-coverage 100% · ceiling Documented

1 finding(s): 0 critical, 1 high, 0 medium, 0 low. Remediation for historically-committed secrets is credential rotation — they remain in history regardless of later deletion.

REDACTED
REDACTED

What to do

  1. Resolve the 1 REDACTED finding(s) in Secrets (history) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
  2. Resolve the 1 Rotate the exposed credentials finding(s) in Secrets (history). — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d28_recommendation.md · top locations in Appendix A, every location in findings.md.

D29 · Static Analysis (SAST)0.0 / 10Critical✓ Tool-verified

What it measures: Real static-analysis (SAST) findings — likely security bugs in the code, any language.

Method: Polyglot static analysis via semgrep across the repo using the pinned, image-baked p/security-audit + p/owasp-top-ten rulesets (no scan-time registry fetch); severity rules (ERROR/WARNING/INFO) map to a full-band severity-weighted score. Exhaustive, deterministic; degrades on parse failure.

Coverage: semgrep pattern rules over all files — exhaustive for the rule set, blind to classes of bug without a rule (clean = no rule matched).

Maturity: Documented → Verified → Prevented · effective 0.0 / 10 · rule-coverage 100% · ceiling Documented

57 finding(s): 0 critical, 48 high, 6 medium, 3 low. 1 unpinned-GitHub-Actions row(s) are reported here but scored by D36 (supply-chain provenance), which measures that posture as `pinned_actions` — one pinning decision is charged once, not once per lens. semgrep hit a parse error in 10 file(s) — `ci/scripts/changed_crates.sh` (line 36, line 64, line 76), `datafusion/common/src/error.rs` (line 974), `datafusion/common/src/tree_node.rs` (line 2457, line 2459), `datafusion/core/src/execution/session_state.rs` (line 1687, lines 1687–1713, lines 1714–1715), `datafusion/datasource-parquet/src/opener/mod.rs` (lines 609–612, line 613, line 633, …), … (+5 more) — so no absence of findings in the named regions is evidence of anything; rows reported elsewhere in those files are real. Fix the syntax error (or exclude the file deliberately) and re-scan to cover them. Separately, one or more rules could not re-parse an embedded snippet in 2 file(s) (e.g. a workflow `run:` block read as shell). Those files WERE scanned and their other rows are unaffected; only those rules' view of those snippets is missing.

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

+ 10 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 26 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (22), REDACTED (2), REDACTED (2). — One of this dimension's main actionable groups (26 issue-level).
  2. Resolve the 9 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (2), REDACTED (2), REDACTED. — One of this dimension's main actionable groups (9 issue-level).
  3. Resolve the 5 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (5). — One of this dimension's main actionable groups (5 issue-level).

Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.

D30 · Dependency Vulnerabilities8.7 / 10Strong✓ Tool-verified

What it measures: Whether any dependency has a known published vulnerability (CVE), direct or transitive, in ANY ecosystem the repository declares — Dart pub, Elixir and Erlang via Hex, Go modules, Java and Kotlin via Maven/Gradle, JavaScript/npm, .NET/NuGet, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift.

Method: Dependency-CVE scan across every ecosystem the repository declares, scored ONCE. Three sources are unioned and deduplicated by advisory identity (rule id + alias closure, CVE<->GHSA) scoped to package+version, keeping the worst severity: `osv-scanner --recursive` over osv.dev for Dart pub, Elixir/Hex (and Erlang, whose `rebar.lock` syft first converts to a CycloneDX SBOM the scanner reads, with rows attributed back to the lock), Go, Java and Kotlin via Maven/Gradle, npm, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift; `trivy fs --scanners vuln` for npm lockfiles; and `dotnet list package --vulnerable --include-transitive` for NuGet (with per-advisory collapse of the project x target-framework fan-out), plus a DECLARED-dependency arm that resolves a published gem's gemspec against rubygems.org where no Gemfile.lock is committed. `SeverityScore(c,h,m,l, normalizer 8.0)`. NotApplicable only when NO ecosystem is readable; if any applicable ecosystem could not be scanned the findings are REPORTED and the score is withheld. Supersedes the npm and OSV arms, retired 2026-09-05.

Maturity: Documented → Verified → Prevented · effective 8.7 / 10 · rule-coverage 100% · ceiling Documented

7 finding(s): 0 critical, 0 high, 7 medium, 0 low.

REDACTED
REDACTED
REDACTED

What to do

  1. Resolve the 3 Medium advisory (unmaintained) finding(s) in Dependency Vulnerabilities — start with REDACTED (3). — One of this dimension's main actionable groups (3 warning-level).
  2. Resolve the 2 Medium CVE finding(s) in Dependency Vulnerabilities — start with REDACTED, REDACTED. — One of this dimension's main actionable groups (2 warning-level).
  3. Resolve the 2 Medium advisory (unsound) finding(s) in Dependency Vulnerabilities — start with REDACTED (2). — One of this dimension's main actionable groups (2 warning-level).

Detailed fixes: d30_recommendation.md · top locations in Appendix A, every location in findings.md.

D31 · IaC & Container Security9.4 / 10Adequategated by 1 critical finding✓ Tool-verified

What it measures: Whether Dockerfiles / Terraform / Kubernetes config follow security best practices.

Method: IaC/container misconfiguration scan via trivy config (REDACTED/Terraform/K8s/Helm/CloudFormation); severity rules to 0-10 moderate normalizer. NotApplicable without manifests. Exhaustive, deterministic.

Maturity: Documented → Verified → Prevented · effective 9.4 / 10 · rule-coverage 100% · ceiling Documented

6 finding(s): 0 critical, 1 high, 2 medium, 3 low.

REDACTED
REDACTED
REDACTED

What to do

  1. Resolve the 1 High IaC finding(s) in IaC & Container Security — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
  2. Resolve the 3 Low IaC finding(s) in IaC & Container Security — start with REDACTED (3). — One of this dimension's main actionable groups (3 recommendation-level).
  3. Resolve the 2 Medium IaC finding(s) in IaC & Container Security — start with REDACTED (2). — One of this dimension's main actionable groups (2 warning-level).

Detailed fixes: d31_recommendation.md · top locations in Appendix A, every location in findings.md.

D34 · Knowledge Freshness9.7 / 10Exemplary✓ Tool-verified

What it measures: Whether anyone still has living knowledge of each file, or it has been orphaned — last understood long ago by someone now gone quiet. The sibling of the bus factor: D16 asks who owns it, D34 asks whether anyone still knows it.

Method: File orphaning as total living-knowledge decay below one focused-commit's worth within a year, computed per-file from the D16 decay model. Exhaustive, deterministic over fixed history.

Maturity: Documented → Verified → Prevented · effective 9.7 / 10 · rule-coverage 100% · ceiling Documented

34 of 1096 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is dev/create_license.py. Counted over 1096 of the 1246 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

Orphaned files with no living knowledge

✓ On the Gold path — maintain.

Detailed fixes: d34_recommendation.md · top locations in Appendix A, every location in findings.md.

D35 · Change Coupling9.5 / 10Stronggated by 23 serious findings✓ Tool-verified

What it measures: Whether files that change together actually belong together — pairs that repeatedly co-change in git history despite having no explicit code dependency, surfacing the hidden/logical coupling (and boundaries in the wrong place) a static scan can't see.

Method: Pairwise co-occurrence over the per-commit file sets in git history (production source only — tests and generated dropped): Degree-of-Coupling = shared ÷ min individual revisions, reported above noise floors (each file ≥10 revisions, ≥5 shared commits, ≥50% strength); sweeping commits excluded. Deterministic over fixed history.

Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling. A non-source file is never a coupling PARTICIPANT either: documentation, schemas, config and data files are dropped with the rest, so a code↔docs pair — a command and the reference page that restates it — is not reported however strongly the two co-change; nor is coupling that runs THROUGH a build step or config file.

Maturity: Documented → Verified → Prevented · effective 9.5 / 10 · rule-coverage 100% · ceiling Documented

Strongest change-coupling: btrim.rs↔ltrim.rs 100%; ltrim.rs↔rtrim.rs 100%; btrim.rs↔rtrim.rs 100%

Change coupling: csv.rs ↔ json.rs · ×19datafusion/core/src/datasource/file_format/csv.rs
Change-coupling hub: from_proto.rs → aggregates.rs, tree_node.rs, mod.rs, to_proto.rs · ×3datafusion/proto/src/logical_plan/from_proto.rs
Change coupling clique: btrim.rs, ltrim.rs, rtrim.rsdatafusion/functions/src/string/btrim.rs

What to do

  1. Resolve the 19 Change coupling finding(s) in Change Coupling — start with mod.rs (4), source.rs (2), listing_schema.rs (2). — One of this dimension's main actionable groups (19 warning-level).
  2. Resolve the 3 Change-coupling hub finding(s) in Change Coupling — start with from_proto.rs, to_proto.rs, external_aggr.rs. — One of this dimension's main actionable groups (3 warning-level).
  3. Resolve the 1 Change coupling clique finding(s) in Change Coupling — start with btrim.rs. — One of this dimension's main actionable groups (1 warning-level).

Detailed fixes: d35_recommendation.md · top locations in Appendix A, every location in findings.md.

D36 · Supply-chain Provenance & Signing2.5 / 10Weak✓ Tool-verified

What it measures: Whether the build pipeline provides supply-chain integrity — generated provenance/attestation, signed artifacts (cosign/sigstore), an SBOM, and pinned build actions. Presence of the configuration, not a runtime guarantee.

Method: Supply-chain provenance/signing read deterministically from CI/build config (.github/workflows, .gitlab-ci.yml, azure-pipelines, Jenkinsfile, .circleci) + the release surface: four signals — generated provenance/attestation (SLSA/in-toto/actions-attest), artifact signing (cosign/sigstore/gitsign), an SBOM (syft/sbom-action/*.spdx.json/*.cdx.json), and SHA-pinned build actions — scored 10·present/denom. NotApplicable without a build pipeline. Detects configuration presence, not runtime enforcement.

Maturity: Documented → Verified → Prevented · effective 2.5 / 10 · rule-coverage 100% · ceiling Documented

1/4 supply-chain integrity signals present (provenance, signing, SBOM, pinned actions).

REDACTED
REDACTED
REDACTED
REDACTED

What to do

  1. Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-level).
  2. Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-level).
  3. Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d36_recommendation.md · top locations in Appendix A, every location in findings.md.

D43 · Malicious Dependencies10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether any dependency the repository declares is published as MALICIOUS rather than merely vulnerable — a package that is an attacker's work, in any ecosystem osv-scanner reads. Scored apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.

Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it — a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. SCORED, not informational.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

No dependency in any ecosystem this repository declares is published as malicious.

✓ On the Gold path — maintain.

Detailed fixes: d43_recommendation.md.

D44 · Platform End-of-Life10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether anyone still ships security patches for the platform this repository RUNS ON — the runtime it pins and the framework majors its own constraints hold it to. Separate from D12 because the question differs: a current Django on an end-of-life Python is perfectly up to date and completely unsupported, and the fix is a migration rather than a version bump. What the repository says it merely SUPPORTS is never charged.

Method: End-of-life PLATFORM read from the repository's own declarations and graded against a FROZEN, dated table of vendor support dates — no network, no feed, no API, so this dimension answers identically inside a closed scan fence. Two subjects: a RUNTIME the project pins (a single or all-end-of-life TargetFramework, a .nvmrc or .python-version, a requires-python CAP) and a FRAMEWORK major a dependency constraint cannot move off (a caret, tilde or exact version; `vue@^2.7.16` pins Vue 2). A FLOOR is deliberately never charged — `requires-python = ">=3.8"` states what a package SUPPORTS, not what it runs on — and a multi-target project is charged only when EVERY target is out of support. Runtime 4.0/product capped 8.0, framework 1.5 capped 4.5. The table is safe to freeze because a statement about support that ended in the past cannot become false: it loses recall as it ages, never precision, and a test asserts every entry predates the freeze date. Disjoint from D31 (a container image's OS layer) and D29 (the toolchain a CI workflow installs). Abstains when the repository declares no platform this pass reads — never scores it clean.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

0 end-of-life runtime(s) and 0 end-of-life framework(s), read from 2 platform declaration(s) and 14 dependency declaration(s). This dimension reads what the repository says about ITSELF — a pinned target framework, a version file, a capped requires-python, a Rust toolchain pin, a framework major a constraint cannot move off. A FLOOR is deliberately never charged: `requires-python = ">=3.8"` states what the package SUPPORTS, not what it runs on, and a well-maintained library declares exactly that while running its own CI on a current release. The end-of-life facts are FROZEN and dated, so this dimension needs no network and answers identically inside a closed scan fence; as the table ages it loses recall and never precision, because a statement about support that ended in the past cannot become false. The OS layer of a container image is D31's question and the toolchain a CI workflow installs is D29's; this row is neither.

✓ On the Gold path — maintain.

Detailed fixes: d44_recommendation.md.

Frontend & cross-cutting dimensions

R = React/JS · M = Maturity · P = Readiness.

AX10 · Code composition9.9 / 10Exemplary✓ Tool-verified

Other · Architecture — How the codebase splits by code ROLE — domain, application, infrastructure, test, generated. The significance map behind the knowledge/coupling weighting, and a DDD signal in its own right: a thin domain core under fat infrastructure is the anemic-domain smell, quantified. How each file's role is decided, because the split is only as good as that: a generated name or a build-output tree makes it Generated, a test project makes it Test, and otherwise the file's NAMESPACE and PATH words are matched against fixed vocabularies in a fixed ORDER — domain, then infrastructure, then application — so a file whose words hit two layers is counted under the earlier one. A production file matching none of them counts as application, so that share reads 'application or unclassified' rather than a measured application layer. Roles come from naming convention, never from what the code does. On this repository the split was taken from the source tree on disk rather than from a loaded .NET workspace, so a file's role is decided by its PATH segments alone — no declared namespace was available to add to the evidence — and generated output is excluded from the census entirely rather than counted as a generated share.

Method: Roslyn line-count by code ROLE: every source file classified Domain/Application/Infrastructure/Test/Generated by namespace + path convention (the shared CodeRoleClassifier), then significant lines summed per role. Deterministic; the advisory score is the business-logic (domain+application) share of production code.

Coverage: Population: ALL source files, each bucketed into ONE of five roles (Domain/Application/Infrastructure/Test/Generated) by namespace + path convention — a file whose layer isn't named in the convention falls to Application (the neutral default), and the split is line-count, not semantic depth or business value.

What to do

  • The domain core is a small share of production code, but most of the rest matched no layer vocabulary at all — so this is not yet an anemic-domain finding. The namespace/path convention could not place that code, which makes the composition above a statement about the naming, not about the design. Name the layers (or check that the repository's conventions differ from the ones this check knows) before reading a thin domain into it.
AX3 · Project dependency cycles10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether the project-reference graph is acyclic (cycles block independent build/deploy and signal eroding boundaries).

Method: Project reference cycles via elementary-DFS over real .csproj references, using the engine shared with D5/D7; cyclic versus acyclic. Exhaustive, deterministic.

AX4 · Dependency direction10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether dependencies point inward (Domain ← Application ← Infrastructure/Web) — the clean-architecture dependency rule, checked across the project graph.

Method: Layer violations by name-segment inference (Domain/Core to Application to Infrastructure/Web) over the project-reference graph. Exhaustive over all projects, deterministic.

AX8 · Test isolation10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether production projects stay free of references to test projects — tests may depend on production, never the reverse.

Method: Csproj graph: each production project checked for references to test projects (identified by test-framework presence, not name). Zero violations is clean. Deterministic.

AX9 · CQS / query purity10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether read (query) handlers stay side-effect-free — a query that writes persistent state or raises events breaks CQS and makes reads unsafe to retry, cache, or route to a read replica.

Method: Roslyn scan: CQRS handlers classified query-vs-command by interface (IQueryHandler/ICommandHandler/IRequestHandler<TQuery,TResult>) and name convention (*Query/Get*/Find* vs *Command); each query handler's body checked for persistent-state writes (SaveChanges/repository Add-Update) or event publishes by resolved invocation. Deterministic, type-level, exhaustive over the detected handlers.

Coverage: Population: CQRS handlers identified by IQueryHandler/ICommandHandler/IRequestHandler interface + *Query/Get*/Find*/*Command NAME convention; query purity then checked exhaustively within that set — a query handler using neither convention is invisible, and mutation is a resolved persistence/publish CALL, not full dataflow.

M1 · Documentation (README)7.7 / 10Strong✓ Tool-verified

Maturity · Maturity — Whether the repo and its projects have a README, and whether it's substantive and current.

Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.

What to do

  • Add a build/run (quick start) section to the root README — the first thing a newcomer needs.
  • Add a 'Testing' section to the root README — how to run the test suite.
  • Add an 'Architecture' / 'How it works' section to the root README — the high-level shape.
  • Add a README to the 7 of 54 project(s) that lack one — worth up to 0.3 pts.
M2 · Architecture documentation2.0 / 10Critical✓ Tool-verified

Maturity · Maturity — Whether key decisions (ADRs) and the high-level shape (C4/diagrams) are written down.

Method: Filesystem scan: ADR folder/naming conventions or content, plus Mermaid/PlantUML/C4/architecture.md discovery. Exhaustive, deterministic.

  • No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.

What to do

  • Record significant decisions one document per decision — dated, stating the context, the decision and its consequences — and keep them together wherever your design docs already live (a conventional `docs/adr/` tree, with each file named `NNNN-title` in whatever markup those docs already use, is the most discoverable form).
M3 · Folder & project structure10.0 / 10Exemplary✓ Tool-verified

Maturity · Maturity — Whether the repo is organised deliberately — src/test separation and consistent project naming.

Method: Filesystem scan: src/test folder separation and namespace-prefix consistency (majority RootNamespace agreement). Exhaustive across projects, deterministic.

M4 · Documentation accuracy10.0 / 10Exemplary◐ Sampled · advisory

Maturity · Maturity — Whether the README actually describes the code that exists (LLM-judged, advisory).

Method: Judged by language model at low temperature: README accuracy versus actual projects, within a disclosed tolerance. Advisory, not a measured number.

P1 · CI/CD gates10.0 / 10Exemplary○ Nothing flagged

Readiness · Readiness — Whether an automated pipeline builds and tests every change.

Method: Filesystem scan: CI workflow files (.github/workflows, .gitlab-ci.yml, etc.) for build and test stages. Exhaustive, deterministic.

P2 · Observability8.3 / 10Strong✓ Tool-verified

Readiness · Readiness — Whether the code is diagnosable in production — structured logging, tracing/metrics, health checks.

Method: Filesystem/Roslyn scan: structured-logging frameworks (Serilog, NLog), OpenTelemetry, and health-check endpoint patterns. Exhaustive, deterministic.

  • Only 21/27 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `datafusion-examples`, `datafusion/proto-common/gen`, `datafusion/proto-models/gen`, `dev`, `dev/depcheck` and 1 more.

What to do

  • Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.
P3 · Security & performance tooling8.0 / 10Strong✓ Tool-verified

Readiness · Readiness — Whether SAST, secret/dependency scanning and performance benchmarking are wired in (presence, not runtime).

Method: Filesystem scan: SAST configuration, dependency-update automation, secret scanning, and a benchmark harness or benchmark step — in this repository's own ecosystem. Exhaustive, deterministic.

What to do

  • Dependabot is configured but does not watch `pip`, `gitsubmodule` — add those `package-ecosystem` entries to REDACTED so those dependencies get the same automatic update and advisory pressure as the ones it already covers.
  • Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
P4 · Deployment & Rollback5.0 / 10Adequate✓ Tool-verified

Readiness · Readiness — Whether releases are automated and safely reversible (probes, rolling updates, approval gates) — from manifests/pipeline files, not the live environment.

Method: Filesystem scan: deployment manifests/IaC (K8s YAML, Helm, Terraform) for rolling updates, probes, approval gates, migration hooks. Exhaustive, deterministic.

What to do

  • Nothing pauses a release for a human: publish as a draft release (or gate the release job on a protected tag/manual dispatch) so a bad build can be stopped before users can download it.
P6 · Release Hygiene8.0 / 10Strong✓ Tool-verified

Readiness · Readiness — Whether releases are traceable — a maintained changelog and explicit version stamping.

Method: Filesystem scan: changelog file presence and version tags in csproj or git tags. Exhaustive, deterministic.

  • `REDACTED:70` writes `CARGO_MACHETE_VERSION=$CARGO_MACHETE_VERSION` to `$GITHUB_ENV`, but `$CARGO_MACHETE_VERSION` is assigned nowhere in that `run:` block, and nowhere else in the workflow. POSIX shell expands an unset variable to the empty string, so `env.CARGO_MACHETE_VERSION` is empty on every run and whatever consumes it is handed no version at all. — REDACTED:70
  • `REDACTED:71` writes `LYCHEE_VERSION=$LYCHEE_VERSION` to `$GITHUB_ENV`, but `$LYCHEE_VERSION` is assigned nowhere in that `run:` block, and nowhere else in the workflow. POSIX shell expands an unset variable to the empty string, so `env.LYCHEE_VERSION` is empty on every run and whatever consumes it is handed no version at all. — REDACTED:71

What to do

  • Fix the release pipeline's version hand-off — read back the variable the step actually assigns, and add `set -euo pipefail` to the step so an unset variable fails the job instead of quietly publishing an empty version.
PF3 · Async & latency hygiene10.0 / 10Exemplary✓ Tool-verified

Readiness · Performance — Whether asynchronous code stays responsive — it avoids sync-over-async blocking (a .NET .Wait()/.GetAwaiter().GetResult(), a time.sleep or blocking HTTP call inside a Python coroutine, a *Sync call inside an async JavaScript function, block_on inside a Rust async fn, runBlocking inside a Kotlin suspend function, block() inside a Reactor publisher) that stalls a thread or event loop and risks deadlock, and, where the code is a reusable library on .NET, awaits with ConfigureAwait(false) so it never captures and stalls its caller's context.

Method: Production-source scan: sync-over-async blocking counted everywhere — .Wait()/.GetAwaiter().GetResult() in .NET; off .NET, read from the language model, a blocking call inside an async function (Python, TS/JS, Rust, Kotlin) or inside a Java method returning a Reactor Mono/Flux — and, for a .NET library with ≥5 awaits, the share of awaits using ConfigureAwait(false). Deterministic, syntax/text detection.

Reference — by lens

The score is the rank-weighted fold of these lenses (worst-heaviest), each including its meta-dimensions; a lens with a Critical contributor is capped at Fair (its band reads "gated by …") and is never the strongest area however high its average.

LensScoreRatingImpact
Code Health83%StrongSolid.
Architecture95%ExemplarySolid.
Maturity67%Adequate — gated by M2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Readiness77%StrongSolid.
Security71%Adequate — gated by D29, D36Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Performance100%ExemplaryStrongest area.
Unscored — 1 check(s) recorded observations but carry no score

These checks ran and found something, but they do not carry a score — either by design (an advisory check reports evidence rather than grading it) or because they could not be scored here. They are excluded from the score for that reason, not because there was nothing to see.

  • P12 CI test-gate honesty — 1 observation(s) recorded · Reported, not scored — this card publishes what the CI gate does with the test inventory rather than grading it. The findings above are its output.
Not evidenced — 4 control(s) we could not find positive evidence for

These checks grade a working control, and the repository shows no evidence of one. That is deliberately not scored as a zero: a repository cannot show an ops runbook, a database TTL or an infrastructure-side audit log, so absence of evidence here is not evidence the control is missing. It is also not a statement that the check is irrelevant to this codebase — the thing it grades applies; we just could not see it. Excluded from the score either way.

  • C3 Audit Trail — Not assessed: these audit controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks audit controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C4 Data Retention — Not assessed: these retention controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks retention controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C5 Data-Subject Rights — Not assessed: these data-subject rights controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks data-subject rights controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 74 check(s) not relevant to this codebase

These checks had nothing to measure here (no tests, no git history, the codebase is small, or the architecture style doesn't apply), so they're omitted above rather than scored low.

  • AC1 Text alternatives — Frontend below the scale floor (8 DOM element(s) < 25) — too little surface to assess accessibility.
  • AC2 Forms & labels — Frontend below the scale floor (8 DOM element(s) < 25) — too little surface to assess accessibility.
  • AC3 Page structure — Frontend below the scale floor (8 DOM element(s) < 25) — too little surface to assess accessibility.
  • AC4 Keyboard semantics — Frontend below the scale floor (8 DOM element(s) < 25) — too little surface to assess accessibility.
  • AC5 ARIA correctness — Frontend below the scale floor (8 DOM element(s) < 25) — too little surface to assess accessibility.
  • AC6 Visual & motion safety — Frontend below the scale floor (8 DOM element(s) < 25) — too little surface to assess accessibility.
  • AC7 A11y enforcement — Frontend below the scale floor (8 DOM element(s) < 25) — too little surface to assess accessibility.
  • AX1 Captive dependencies — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX2 Stateful singletons — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX5 Architecture & structure — not assessed — architecture style/structure is computed from a project graph (projects, types, module namespaces) that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX6 Interface segregation — not assessed — interface segregation is computed over a type surface that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX7 Slice cohesion — not applicable — not a vertical-slice architecture
  • AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • AXR1 Runtime accessibility — docker build failed (exit 1) — DEPRECATED: The legacy builder is deprecated and will be removed in a future release. Install the buildx component to build images with BuildKit: https://docs.docker.com/go/bui…; runtime evidence skipped This is a statement about this run, not a statement about your application: nothing here says the surface is inaccessible, only that it was never rendered.
  • C1 Data Protection — Not assessed: these personal data controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks personal data controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C2 Access Controls — Not assessed: these authorization controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks authorization controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • D10 Test Quality — ~187830 lines of test source are present (.rs) but no test cases reached the test census for this repository — no test root we could resolve declared them, or the files we read declare no cases in a test framework we recognise — so skipped/assertion-free tests couldn't be counted. Not scored — this is a gap in the analyzer, not a finding about this repository.
  • D11 Test Reliability — Test reliability not included — the .rs suite was found but not re-run
  • D18 Solution Shape — D18 scores the shape of a .NET solution; this repository has no .NET solution or project files, so the dimension does not apply.
  • D24 Comment Value — No inline comments to assess — comment value is not applicable here.
  • D25 ADR Conformance — no ADRs to check
  • D27 Navigability — symbol resolution incomplete — too few calls resolved to assess navigability
  • D32 Data Compliance (PII/GDPR) — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that.
  • D37 Vulnerability-disclosure Policy — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
  • D39 IL Efficiency — D39 measures the IL emitted by a .NET build; this repository has no .NET solution or project files, so the dimension does not apply.
  • D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
  • D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
  • D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
  • D6 Cohesion (LCOM4) — D6 reads a CS/VB/GO/SCALA/SWIFT/DART/JAVA/PY/KT/TS/TSX/MTS/CTS/JS/JSX/MJS/CJS/PHP class graph only — this repository's production source is .rs, which was left unread. Not scored: this is a gap in the analyzer, not a verdict about this repository.
  • D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
  • D8 Code Coverage — Coverage not included — suite not readable by the collector
  • DM1 Domain Modelling — applicable but not scored (3 signals for this style, 3 needed — the count is met but a required primary signal is absent): 62 aggregate root(s) (types guarding their own state behind command methods — this language has no AggregateRoot base to inherit); 419 value object(s); a Domain/Aggregates/ValueObjects layer; a Rust domain-layer crate (a .../domain/ clean-architecture layer); a top-level datafusion-examples/ tree: a library or framework whose examples are its consumers — these types are building blocks, not a domain
  • ED2 Event/command shape — not scored — deciding whether a command has more than one competing handler requires resolving the call graph, and a call made through an inferred or generic receiver has no resolvable owner in the source. Reported as guidance rather than measured
  • ED5 Idempotency — This check finds retry-prone mutations (command handlers and message/event consumers) by walking the repository's declared types, and none was loaded here, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • ES1 Event Sourcing — not scored — this repository shows none of the 3 signals this lens looks for
  • GD1 Unfinished & placeholder code — no source files were read — this check reads C# syntax, and none was loaded for this repository. That is a limit of the analyzer, not a finding about your code.
  • IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • P10 Library API & versioning — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • P7 Outbound HTTP resilience — not applicable — no HTTP server, API framework or worker entry point was found in the JavaScript/TypeScript, Python, Rust source, so there is no service whose uptime a failing dependency could take down
  • P8 Schema migrations — no ORM, schema-migration tool or schema auto-create was found in this repository's dependency manifests or source, so there is no database schema for this check to judge
  • P9 Domain vs controller coverage — no coverage report found on disk — produce a coverage report in a standard format (lcov — `cargo install cargo-llvm-cov`, then `cargo llvm-cov --lcov --output-path lcov.info`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures, or wire coverage collection into CI, to enable this cross-layer check
  • PF1 Benchmark discipline — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • PF2 Allocation hygiene — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • S1 Web-Security Posture — Not assessed: these web-security controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks web-security controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • SC1 Supply-chain hygiene — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • X1 Async correctness — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X10 Duplicated predicate — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X12 Unreachable branch — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X13 Undrained process stream — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X14 Bypassable address classification — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X15 Unvalidated length from an untrusted reader — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X16 Unfloored truncation loop — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X17 Uncapped recursion over a caller-supplied document — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X18 Disposal-pattern correctness — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X19 Unrestored process-global state — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X2 Cancellation propagation — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X20 Mistyped argument guard — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X21 Side-effecting pattern guard — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X22 Contradicted release guard — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X23 Unguarded diagnostic materialisation — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X24 Document value interpolated into markup unescaped — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X25 Inert configuration knob — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X26 Unsynchronised callback handoff — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X27 Collection changed while being enumerated — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X28 Index access outside its own emptiness guard — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X29 Per-element action decided by a fixed element — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X3 Exception handling — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X30 Support guard that admits what it rejects — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X32 Type resolved by simple name across every loaded assembly — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X4 Structured logging — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X5 Nullable reference types — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X6 Hand-rolled structured-format parsing — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X7 Silent fallback defaults — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X9 Subsumed condition operand — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.

Appendix A — Findings (grouped)

The findings behind the scores, grouped by severity, then by dimension and kind. The high-severity issues are enumerated in full below; items per group are capped at 25 with any overflow stated explicitly per group, never silently truncated. The complete machine-readable list of every finding (all severities) is the companion findings.md in this report's bundle.

Critical — 50 finding(s)
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • + 1 more in this group — see findings.md.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
D28 · Secrets (history) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D31 · IaC & Container Security · High IaC · ×1
  • REDACTED
Serious — 2155 finding(s)
D17 · Explicit Debt · TodoComment · ×324
  • TodoComment benchmarks/src/nlj.rs:39 — /// TODO: Include special join types (Semi/Anti/Mark joins) — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment benchmarks/src/nlj.rs:243 — /// TODO: ensure the optimizer won't change the join order (it's not at — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment datafusion-cli/src/main.rs:327 — // TODO maybe we can have thiserror for cli but for now let's keep it simple — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment datafusion/catalog-listing/src/helpers.rs:102 — // TODO: Stable functions could be `applicable`, but that would require access to the context — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment datafusion/catalog-listing/src/helpers.rs:113 — // TODO: Stable functions could be `applicable`, but that would require access to the context — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment datafusion/catalog-listing/src/helpers.rs:122 — // TODO other expressions are not handled yet: — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment datafusion/catalog/src/information_schema.rs:650 — // TODO: Stream this — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment datafusion/catalog/src/information_schema.rs:742 — // TODO: Stream this — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment datafusion/catalog/src/information_schema.rs:857 — // TODO: Stream this — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment datafusion/catalog/src/information_schema.rs:1153 — // TODO: Stream this — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment datafusion/catalog/src/information_schema.rs:1199 — // TODO: Stream this — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment datafusion/catalog/src/cte_worktable.rs:122 — // TODO: should we support filter pushdown? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment datafusion/common/src/stats.rs:589 — // TODO: Can input stats still be used, but adjusted, when `skip` — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment datafusion/common/src/rounding.rs:19 — //! TODO: Remove this custom implementation and the "libc" dependency when — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment datafusion/common/src/config.rs:2636 — // TODO: Let's decide how we treat the numerical strings. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment datafusion/common/src/column.rs:278 — // TODO If [`DFSchema`] had spans, we could show the — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment datafusion/common/src/file_options/mod.rs:300 — // TODO expand unit test if csv::WriterBuilder allows public read access to properties — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment datafusion/common/src/scalar/struct_builder.rs:121 — /// TODO potentially upstream this to arrow-rs so that we can — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment datafusion/common/src/scalar/struct_builder.rs:150 — /// TODO potentially upstream this to arrow-rs so that we can — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment datafusion/common/src/scalar/mod.rs:2679 — // TODO: we might want to look into supporting ceil/floor here for floats. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment datafusion/common/src/scalar/mod.rs:4124 — // TODO: There is no test for FixedSizeList now, add it later — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment datafusion/common/src/scalar/mod.rs:8641 — // TODO: https://github.com/apache/arrow-rs/pull/9213 might fix this ^
  • TodoComment datafusion/common/src/scalar/mod.rs:9335 — // TODO: if negate supports f16, add these cases to `test_scalar_negative_overflows` test case — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment datafusion/common/src/scalar/consts.rs:90 — // TODO: simplify this after https://github.com/apache/arrow-rs/pull/10363
  • TodoComment datafusion/common/src/utils/mod.rs:748 — // TODO: Modify this to also allow specifying how listviews should be treated. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • + 299 more in this group — see findings.md.
D3 · God Classes · FileTooLong · ×118
  • FileTooLong: scalar/mod.rs datafusion/common/src/scalar/mod.rs — FileTooLong — 3798 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 88% of them inside a single declaration: ScalarValue (15 blocks, 358-5973). The bar is 500 significant lines; this is 3298 over it, 7.60× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: logical_plan/plan.rs datafusion/expr/src/logical_plan/plan.rs — FileTooLong — 2998 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 2498 over it, 6.00× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: REDACTED REDACTED — FileTooLong — 2313 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 70% of them inside a single declaration: DefaultPhysicalPlanner (5 blocks, 149-3369). The bar is 500 significant lines; this is 1813 over it, 4.63× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: src/statement.rs datafusion/sql/src/statement.rs — FileTooLong — 2309 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 92% of them inside a single declaration: SqlToRel (233-3196). The bar is 500 significant lines; this is 1809 over it, 4.62× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: src/expr.rs datafusion/expr/src/expr.rs — FileTooLong — 2108 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1608 over it, 4.22× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: joins/nested_loop_join.rs datafusion/physical-plan/src/joins/nested_loop_join.rs — FileTooLong — 2067 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1567 over it, 4.13× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: unparser/plan.rs datafusion/sql/src/unparser/plan.rs — FileTooLong — 1852 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 96% of them inside a single declaration: Unparser (173-2956). The bar is 500 significant lines; this is 1352 over it, 3.70× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: logical_plan/mod.rs datafusion/proto/src/logical_plan/mod.rs — FileTooLong — 1804 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 82% of them inside a single declaration: LogicalPlanNode (481-2382). The bar is 500 significant lines; this is 1304 over it, 3.61× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: aggregates/mod.rs datafusion/physical-plan/src/aggregates/mod.rs — FileTooLong — 1742 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 64% of them inside a single declaration: AggregateExec (5 blocks, 869-2837). The bar is 500 significant lines; this is 1242 over it, 3.48× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: hash_join/exec.rs datafusion/physical-plan/src/joins/hash_join/exec.rs — FileTooLong — 1713 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1213 over it, 3.43× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/config.rs datafusion/common/src/config.rs — FileTooLong — 1638 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1138 over it, 3.28× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: joins/utils.rs datafusion/physical-plan/src/joins/utils.rs — FileTooLong — 1550 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 45 free functions. The bar is 500 significant lines; this is 1050 over it, 3.10× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: string/format_string.rs datafusion/spark/src/function/string/format_string.rs — FileTooLong — 1535 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 60% of them inside a single declaration: ConversionSpecifier (2 blocks, 394-2258). The bar is 500 significant lines; this is 1035 over it, 3.07× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: execution/session_state.rs datafusion/core/src/execution/session_state.rs — FileTooLong — 1527 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1027 over it, 3.05× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: repartition/mod.rs datafusion/physical-plan/src/repartition/mod.rs — FileTooLong — 1395 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 895 over it, 2.79× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: logical_plan/builder.rs datafusion/expr/src/logical_plan/builder.rs — FileTooLong — 1386 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 67% of them inside a single declaration: LogicalPlanBuilder (4 blocks, 129-1674). The bar is 500 significant lines; this is 886 over it, 2.77× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: unparser/expr.rs datafusion/sql/src/unparser/expr.rs — FileTooLong — 1376 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 97% of them inside a single declaration: Unparser (95-1942). The bar is 500 significant lines; this is 876 over it, 2.75× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: simplify_expressions/expr_simplifier.rs datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs — FileTooLong — 1360 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 63% of them inside a single declaration: Simplifier (3 blocks, 821-2208). The bar is 500 significant lines; this is 860 over it, 2.72× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: context/mod.rs datafusion/core/src/execution/context/mod.rs — FileTooLong — 1280 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 86% of them inside a single declaration: SessionContext (6 blocks, 294-2253). The bar is 500 significant lines; this is 780 over it, 2.56× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: topk/mod.rs datafusion/physical-plan/src/topk/mod.rs — FileTooLong — 1276 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 776 over it, 2.55× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: type_coercion/binary.rs datafusion/expr-common/src/type_coercion/binary.rs — FileTooLong — 1250 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 57 free functions. The bar is 500 significant lines; this is 750 over it, 2.50× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: joins/symmetric_hash_join.rs datafusion/physical-plan/src/joins/symmetric_hash_join.rs — FileTooLong — 1237 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 737 over it, 2.47× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: opener/mod.rs datafusion/datasource-parquet/src/opener/mod.rs — FileTooLong — 1186 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 686 over it, 2.37× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: sort_merge_join/materializing_stream.rs datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs — FileTooLong — 1152 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 72% of them inside a single declaration: MaterializingSortMergeJoinStream (2 blocks, 279-1942). The bar is 500 significant lines; this is 652 over it, 2.30× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: src/array_agg.rs datafusion/functions-aggregate/src/array_agg.rs — FileTooLong — 1106 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 606 over it, 2.21× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • + 93 more in this group — see findings.md.
D3 · God Classes · MethodTooLong · ×82
  • MethodTooLong: SqlToRel.sql_statement_to_plan_with_context_impl datafusion/sql/src/statement.rs:267 — MethodTooLong — sql_statement_to_plan_with_context_impl runs 1028 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 928 over it, 10.28× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: DefaultPhysicalPlanner.map_logical_node_to_physical REDACTED:574 — MethodTooLong — map_logical_node_to_physical runs 1009 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 909 over it, 10.09× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Simplifier.f_up datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:835 — MethodTooLong — f_up runs 847 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 747 over it, 8.47× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Unparser.select_to_sql_recursively datafusion/sql/src/unparser/plan.rs:837 — MethodTooLong — select_to_sql_recursively runs 691 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 591 over it, 6.91× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: SqlToRel.sql_function_to_expr datafusion/sql/src/expr/function.rs:228 — MethodTooLong — sql_function_to_expr runs 463 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 363 over it, 4.63× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Unparser.expr_to_sql_inner datafusion/sql/src/unparser/expr.rs:156 — MethodTooLong — expr_to_sql_inner runs 378 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 278 over it, 3.78× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: LogicalPlan.with_new_exprs datafusion/expr/src/logical_plan/plan.rs:837 — MethodTooLong — with_new_exprs runs 363 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 263 over it, 3.63× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: PushDownFilter.rewrite datafusion/optimizer/src/push_down_filter.rs:799 — MethodTooLong — rewrite runs 342 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 242 over it, 3.42× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: SqlToRel.sql_expr_to_logical_expr_internal datafusion/sql/src/expr/mod.rs:387 — MethodTooLong — sql_expr_to_logical_expr_internal runs 330 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 230 over it, 3.30× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: TypeCoercionRewriter.f_up datafusion/optimizer/src/analyzer/type_coercion.rs:583 — MethodTooLong — f_up runs 318 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 218 over it, 3.18× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Expr.normalize_eq datafusion/expr/src/expr.rs:2365 — MethodTooLong — normalize_eq runs 310 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 210 over it, 3.10× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ScalarValue.to_array_of_size datafusion/common/src/scalar/mod.rs:3463 — MethodTooLong — to_array_of_size runs 293 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 193 over it, 2.93× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: LogicalPlan.display datafusion/expr/src/logical_plan/plan.rs:2068 — MethodTooLong — display runs 285 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 185 over it, 2.85× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: SqlToRel.select_to_plan datafusion/sql/src/select.rs:99 — MethodTooLong — select_to_plan runs 282 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 182 over it, 2.82× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ConversionSpecifier.format datafusion/spark/src/function/string/format_string.rs:996 — MethodTooLong — format runs 274 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 174 over it, 2.74× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: LogicalPlan.map_children datafusion/expr/src/logical_plan/tree_node.rs:76 — MethodTooLong — map_children runs 271 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 171 over it, 2.71× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: PgJsonVisitor.to_json_value datafusion/expr/src/logical_plan/display.rs:303 — MethodTooLong — to_json_value runs 265 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 165 over it, 2.65× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ScalarValue.iter_to_array datafusion/common/src/scalar/mod.rs:2821 — MethodTooLong — iter_to_array runs 257 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 157 over it, 2.57× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: LogicalPlan.map_expressions datafusion/expr/src/logical_plan/tree_node.rs:537 — MethodTooLong — map_expressions runs 217 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 117 over it, 2.17× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: SchemaDisplay.fmt datafusion/expr/src/expr.rs:3006 — MethodTooLong — fmt runs 210 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 110 over it, 2.10× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ScalarValue.try_from_array datafusion/common/src/scalar/mod.rs:4054 — MethodTooLong — try_from_array runs 194 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 94 over it, 1.94× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Unparser.scalar_to_sql datafusion/sql/src/unparser/expr.rs:1313 — MethodTooLong — scalar_to_sql runs 194 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 94 over it, 1.94× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Expr.map_children datafusion/expr/src/tree_node.rs:124 — MethodTooLong — map_children runs 192 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 92 over it, 1.92× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: SqlToRel.convert_simple_data_type datafusion/sql/src/planner.rs:709 — MethodTooLong — convert_simple_data_type runs 183 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 83 over it, 1.83× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Expr.fmt datafusion/expr/src/expr.rs:3559 — MethodTooLong — fmt runs 182 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 82 over it, 1.82× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • + 57 more in this group — see findings.md.
D15 · Churn × Complexity Hotspots · Hotspot · ×74
  • Hotspot: REDACTED REDACTED:574 — REDACTED changed 28 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 121 in DefaultPhysicalPlanner::map_logical_node_to_physical at line 574. 9 of those changes were fix/bug commits, and the other 19 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 01:31:20 +00:00' --until='2026-09-29 01:31:20 +00:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: datafusion/sql/src/statement.rs datafusion/sql/src/statement.rs:267 — datafusion/sql/src/statement.rs changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 215 in SqlToRel::sql_statement_to_plan_with_context_impl at line 267. 4 of those changes were fix/bug commits, and the other 9 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 01:31:20 +00:00' --until='2026-09-29 01:31:20 +00:00' --full-history --no-merges -- datafusion/sql/src/statement.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: datafusion/proto-models/src/generated/pbjson.rs datafusion/proto-models/src/generated/pbjson.rs:21503 — datafusion/proto-models/src/generated/pbjson.rs changed 23 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 121 in PhysicalPlanNode::deserialize at line 21503. 13 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 01:31:20 +00:00' --until='2026-09-29 01:31:20 +00:00' --full-history --no-merges -- datafusion/proto-models/src/generated/pbjson.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:835 — datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 194 in Simplifier::f_up at line 835. 10 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 01:31:20 +00:00' --until='2026-09-29 01:31:20 +00:00' --full-history --no-merges -- datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: datafusion/proto/src/physical_plan/mod.rs datafusion/proto/src/physical_plan/mod.rs:1165 — datafusion/proto/src/physical_plan/mod.rs changed 43 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 40 in PhysicalPlanNodeExt::try_into_physical_plan_with_context at line 1165. 5 of those changes were fix/bug commits, and the other 38 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 01:31:20 +00:00' --until='2026-09-29 01:31:20 +00:00' --full-history --no-merges -- datafusion/proto/src/physical_plan/mod.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: datafusion/sql/src/unparser/plan.rs datafusion/sql/src/unparser/plan.rs:837 — datafusion/sql/src/unparser/plan.rs changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 124 in Unparser::select_to_sql_recursively at line 837. 5 of those changes were fix/bug commits, and the other 7 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 01:31:20 +00:00' --until='2026-09-29 01:31:20 +00:00' --full-history --no-merges -- datafusion/sql/src/unparser/plan.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: datafusion/physical-plan/src/joins/hash_join/exec.rs datafusion/physical-plan/src/joins/hash_join/exec.rs:3027 — datafusion/physical-plan/src/joins/hash_join/exec.rs changed 42 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 29 in datafusion_physical_plan::joins::hash_join::exec::collect_left_input at line 3027. 16 of those changes were fix/bug commits, and the other 26 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 01:31:20 +00:00' --until='2026-09-29 01:31:20 +00:00' --full-history --no-merges -- datafusion/physical-plan/src/joins/hash_join/exec.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: datafusion/expr/src/logical_plan/plan.rs datafusion/expr/src/logical_plan/plan.rs:2068 — datafusion/expr/src/logical_plan/plan.rs changed 17 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 55 in LogicalPlan::display at line 2068. 6 of those changes were fix/bug commits, and the other 11 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 01:31:20 +00:00' --until='2026-09-29 01:31:20 +00:00' --full-history --no-merges -- datafusion/expr/src/logical_plan/plan.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: datafusion/physical-plan/src/aggregates/mod.rs datafusion/physical-plan/src/aggregates/mod.rs:1327 — datafusion/physical-plan/src/aggregates/mod.rs changed 60 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 15 in AggregateExec::execute_typed at line 1327. 16 of those changes were fix/bug commits, and the other 44 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 01:31:20 +00:00' --until='2026-09-29 01:31:20 +00:00' --full-history --no-merges -- datafusion/physical-plan/src/aggregates/mod.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: datafusion/proto/src/logical_plan/mod.rs datafusion/proto/src/logical_plan/mod.rs:499 — datafusion/proto/src/logical_plan/mod.rs changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 75 in LogicalPlanNode::try_into_logical_plan at line 499. 3 of those changes were fix/bug commits, and the other 9 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 01:31:20 +00:00' --until='2026-09-29 01:31:20 +00:00' --full-history --no-merges -- datafusion/proto/src/logical_plan/mod.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: datafusion/physical-plan/src/aggregates/group_values/multi_group_by/mod.rs datafusion/physical-plan/src/aggregates/group_values/multi_group_by/mod.rs:959 — datafusion/physical-plan/src/aggregates/group_values/multi_group_by/mod.rs changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 60 in datafusion_physical_plan::aggregates::group_values::multi_group_by::make_group_column at line 959. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 01:31:20 +00:00' --until='2026-09-29 01:31:20 +00:00' --full-history --no-merges -- datafusion/physical-plan/src/aggregates/group_values/multi_group_by/mod.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: datafusion/sql/src/unparser/expr.rs datafusion/sql/src/unparser/expr.rs:156 — datafusion/sql/src/unparser/expr.rs changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 61 in Unparser::expr_to_sql_inner at line 156. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 01:31:20 +00:00' --until='2026-09-29 01:31:20 +00:00' --full-history --no-merges -- datafusion/sql/src/unparser/expr.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: datafusion/optimizer/src/push_down_filter.rs datafusion/optimizer/src/push_down_filter.rs:799 — datafusion/optimizer/src/push_down_filter.rs changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 63 in PushDownFilter::rewrite at line 799. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 01:31:20 +00:00' --until='2026-09-29 01:31:20 +00:00' --full-history --no-merges -- datafusion/optimizer/src/push_down_filter.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: datafusion/physical-optimizer/src/ensure_requirements/enforce_distribution.rs datafusion/physical-optimizer/src/ensure_requirements/enforce_distribution.rs:1363 — datafusion/physical-optimizer/src/ensure_requirements/enforce_distribution.rs changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 42 in datafusion_physical_optimizer::ensure_requirements::enforce_distribution::ensure_distribution_with_stats at line 1363. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 01:31:20 +00:00' --until='2026-09-29 01:31:20 +00:00' --full-history --no-merges -- datafusion/physical-optimizer/src/ensure_requirements/enforce_distribution.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: datafusion/expr/src/type_coercion/functions.rs datafusion/expr/src/type_coercion/functions.rs:580 — datafusion/expr/src/type_coercion/functions.rs changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 66 in datafusion_expr::type_coercion::functions::get_valid_types at line 580. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 01:31:20 +00:00' --until='2026-09-29 01:31:20 +00:00' --full-history --no-merges -- datafusion/expr/src/type_coercion/functions.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: datafusion/physical-plan/src/joins/nested_loop_join.rs datafusion/physical-plan/src/joins/nested_loop_join.rs:3879 — datafusion/physical-plan/src/joins/nested_loop_join.rs changed 24 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 19 in datafusion_physical_plan::joins::nested_loop_join::build_unmatched_batch at line 3879. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 01:31:20 +00:00' --until='2026-09-29 01:31:20 +00:00' --full-history --no-merges -- datafusion/physical-plan/src/joins/nested_loop_join.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: datafusion/proto/src/physical_plan/from_proto.rs datafusion/proto/src/physical_plan/from_proto.rs:242 — datafusion/proto/src/physical_plan/from_proto.rs changed 16 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 28 in datafusion_proto::physical_plan::from_proto::parse_physical_expr_with_converter at line 242. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 01:31:20 +00:00' --until='2026-09-29 01:31:20 +00:00' --full-history --no-merges -- datafusion/proto/src/physical_plan/from_proto.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: datafusion/optimizer/src/analyzer/type_coercion.rs datafusion/optimizer/src/analyzer/type_coercion.rs:583 — datafusion/optimizer/src/analyzer/type_coercion.rs changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 37 in TypeCoercionRewriter::f_up at line 583. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 01:31:20 +00:00' --until='2026-09-29 01:31:20 +00:00' --full-history --no-merges -- datafusion/optimizer/src/analyzer/type_coercion.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: datafusion/functions-aggregate/src/approx_distinct.rs datafusion/functions-aggregate/src/approx_distinct.rs:752 — datafusion/functions-aggregate/src/approx_distinct.rs changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 30 in ApproxDistinct::accumulator at line 752. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 01:31:20 +00:00' --until='2026-09-29 01:31:20 +00:00' --full-history --no-merges -- datafusion/functions-aggregate/src/approx_distinct.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: datafusion/expr/src/expr.rs datafusion/expr/src/expr.rs:3006 — datafusion/expr/src/expr.rs changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 55 in SchemaDisplay::fmt at line 3006. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 01:31:20 +00:00' --until='2026-09-29 01:31:20 +00:00' --full-history --no-merges -- datafusion/expr/src/expr.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: datafusion/sql/src/expr/function.rs datafusion/sql/src/expr/function.rs:228 — datafusion/sql/src/expr/function.rs changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 77 in SqlToRel::sql_function_to_expr at line 228. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 01:31:20 +00:00' --until='2026-09-29 01:31:20 +00:00' --full-history --no-merges -- datafusion/sql/src/expr/function.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: datafusion/physical-expr/src/planner.rs datafusion/physical-expr/src/planner.rs:133 — datafusion/physical-expr/src/planner.rs changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 48 in datafusion_physical_expr::planner::create_physical_expr at line 133. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 01:31:20 +00:00' --until='2026-09-29 01:31:20 +00:00' --full-history --no-merges -- datafusion/physical-expr/src/planner.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: datafusion/expr/src/expr_schema.rs datafusion/expr/src/expr_schema.rs:294 — datafusion/expr/src/expr_schema.rs changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 38 in Expr::nullable at line 294. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 01:31:20 +00:00' --until='2026-09-29 01:31:20 +00:00' --full-history --no-merges -- datafusion/expr/src/expr_schema.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: datafusion/physical-expr/src/expressions/binary.rs datafusion/physical-expr/src/expressions/binary.rs:559 — datafusion/physical-expr/src/expressions/binary.rs changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 25 in BinaryExpr::evaluate at line 559. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 01:31:20 +00:00' --until='2026-09-29 01:31:20 +00:00' --full-history --no-merges -- datafusion/physical-expr/src/expressions/binary.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: datafusion/core/src/execution/session_state.rs datafusion/core/src/execution/session_state.rs:1682 — datafusion/core/src/execution/session_state.rs changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 29 in SessionStateBuilder::build at line 1682. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 01:31:20 +00:00' --until='2026-09-29 01:31:20 +00:00' --full-history --no-merges -- datafusion/core/src/execution/session_state.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • + 49 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×56
  • Duplicated block (9 lines × 2) datafusion/catalog/src/information_schema.rs:1046 — datafusion/catalog/src/information_schema.rs:1046-1054 | datafusion/catalog/src/information_schema.rs:1088-1096 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) datafusion/common/src/utils/mod.rs:159 — datafusion/common/src/utils/mod.rs:159-167 | datafusion/common/src/utils/mod.rs:208-216 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) datafusion/expr/src/higher_order_function.rs:1258 — datafusion/expr/src/higher_order_function.rs:1258-1266 | datafusion/sql/src/expr/function.rs:439-449 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (9 lines × 2) datafusion/expr/src/utils.rs:1228 — datafusion/expr/src/utils.rs:1228-1236 | datafusion/expr/src/utils.rs:1252-1260 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) datafusion/expr-common/src/sort_properties.rs:68 — datafusion/expr-common/src/sort_properties.rs:68-76 | datafusion/expr-common/src/sort_properties.rs:88-96 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) datafusion/ffi/src/config/mod.rs:93 — datafusion/ffi/src/config/mod.rs:93-101 | datafusion/ffi/src/config/mod.rs:106-114 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) datafusion/ffi/src/proto/logical_extension_codec.rs:210 — datafusion/ffi/src/proto/logical_extension_codec.rs:210-218 | datafusion/ffi/src/proto/physical_extension_codec.rs:196-204 — before extracting anything, compare `datafusion/ffi/src/proto/logical_extension_codec.rs` and `datafusion/ffi/src/proto/physical_extension_codec.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 118 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 2) datafusion/ffi/src/proto/logical_extension_codec.rs:236 — datafusion/ffi/src/proto/logical_extension_codec.rs:236-244 | datafusion/ffi/src/proto/physical_extension_codec.rs:222-230 — before extracting anything, compare `datafusion/ffi/src/proto/logical_extension_codec.rs` and `datafusion/ffi/src/proto/physical_extension_codec.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 118 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 2) datafusion/ffi/src/proto/logical_extension_codec.rs:262 — datafusion/ffi/src/proto/logical_extension_codec.rs:262-270 | datafusion/ffi/src/proto/physical_extension_codec.rs:248-256 — before extracting anything, compare `datafusion/ffi/src/proto/logical_extension_codec.rs` and `datafusion/ffi/src/proto/physical_extension_codec.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 118 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 2) datafusion/functions/src/crypto/basic.rs:136 — datafusion/functions/src/crypto/basic.rs:136-144 | datafusion/functions/src/crypto/basic.rs:167-175 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) datafusion/functions/src/unicode/lpad.rs:86 — datafusion/functions/src/unicode/lpad.rs:86-94 | datafusion/functions/src/unicode/rpad.rs:86-94 — before extracting anything, compare `datafusion/functions/src/unicode/lpad.rs` and `datafusion/functions/src/unicode/rpad.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 229 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 2) datafusion/functions/src/unicode/lpad.rs:428 — datafusion/functions/src/unicode/lpad.rs:428-436 | datafusion/functions/src/unicode/rpad.rs:428-436 — before extracting anything, compare `datafusion/functions/src/unicode/lpad.rs` and `datafusion/functions/src/unicode/rpad.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 229 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 2) datafusion/functions/src/math/monotonicity.rs:107 — datafusion/functions/src/math/monotonicity.rs:107-115 | datafusion/functions/src/math/monotonicity.rs:204-212 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) datafusion/functions-aggregate/src/average.rs:302 — datafusion/functions-aggregate/src/average.rs:302-310 | datafusion/functions-aggregate/src/average.rs:324-332 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) datafusion/functions-aggregate/src/covariance.rs:347 — datafusion/functions-aggregate/src/covariance.rs:347-355 | datafusion/functions-aggregate/src/regr.rs:673-681 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (9 lines × 2) datafusion/functions-aggregate/src/first_last.rs:310 — datafusion/functions-aggregate/src/first_last.rs:310-318 | datafusion/functions-aggregate/src/first_last.rs:1230-1238 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) datafusion/functions-nested/src/concat.rs:115 — datafusion/functions-nested/src/concat.rs:115-123 | datafusion/functions-nested/src/concat.rs:206-214 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) datafusion/functions-nested/src/remove.rs:119 — datafusion/functions-nested/src/remove.rs:119-127 | datafusion/functions-nested/src/remove.rs:358-366 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) datafusion/functions-nested/src/replace.rs:135 — datafusion/functions-nested/src/replace.rs:135-143 | datafusion/functions-nested/src/replace.rs:361-369 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) datafusion/functions-table/src/generate_series.rs:805 — datafusion/functions-table/src/generate_series.rs:805-813 | datafusion/functions-table/src/generate_series.rs:831-839 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) datafusion/physical-expr/src/equivalence/properties/mod.rs:396 — datafusion/physical-expr/src/equivalence/properties/mod.rs:396-404 | datafusion/physical-expr/src/equivalence/properties/mod.rs:464-472 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) datafusion/physical-expr/src/higher_order_function.rs:475 — datafusion/physical-expr/src/higher_order_function.rs:475-483 | datafusion/physical-expr/src/scalar_function.rs:335-343 — before extracting anything, compare `datafusion/physical-expr/src/higher_order_function.rs` and `datafusion/physical-expr/src/scalar_function.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 42 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 2) datafusion/physical-optimizer/src/ensure_requirements/enforce_sorting/sort_pushdown.rs:834 — datafusion/physical-optimizer/src/ensure_requirements/enforce_sorting/sort_pushdown.rs:834-842 | datafusion/physical-optimizer/src/ensure_requirements/enforce_sorting/sort_pushdown.rs:848-856 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) datafusion/physical-optimizer/src/filter_pushdown.rs:624 — datafusion/physical-optimizer/src/filter_pushdown.rs:624-632 | datafusion/physical-optimizer/src/filter_pushdown.rs:685-693 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) datafusion/physical-plan/src/aggregates/group_values/multi_group_by/mod.rs:426 — datafusion/physical-plan/src/aggregates/group_values/multi_group_by/mod.rs:426-434 | datafusion/physical-plan/src/aggregates/group_values/multi_group_by/mod.rs:798-806 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • + 31 more in this group — see findings.md.
D3 · God Classes · FunctionTooLong · ×45
  • FunctionTooLong: datafusion_physical_expr::planner::create_physical_expr datafusion/physical-expr/src/planner.rs:133 — FunctionTooLong — datafusion_physical_expr::planner::create_physical_expr runs 445 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 345 over it, 4.45× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: datafusion_substrait::logical_plan::consumer::expr::literal::from_substrait_literal datafusion/substrait/src/logical_plan/consumer/expr/literal.rs:69 — FunctionTooLong — datafusion_substrait::logical_plan::consumer::expr::literal::from_substrait_literal runs 370 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 270 over it, 3.70× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: datafusion_proto::logical_plan::from_proto::parse_expr datafusion/proto/src/logical_plan/from_proto.rs:170 — FunctionTooLong — datafusion_proto::logical_plan::from_proto::parse_expr runs 369 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 269 over it, 3.69× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: datafusion_proto::logical_plan::to_proto::serialize_expr datafusion/proto/src/logical_plan/to_proto.rs:53 — FunctionTooLong — datafusion_proto::logical_plan::to_proto::serialize_expr runs 344 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 244 over it, 3.44× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: datafusion_expr::type_coercion::functions::get_valid_types datafusion/expr/src/type_coercion/functions.rs:580 — FunctionTooLong — datafusion_expr::type_coercion::functions::get_valid_types runs 335 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 235 over it, 3.35× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: datafusion_physical_plan::joins::hash_join::exec::collect_left_input datafusion/physical-plan/src/joins/hash_join/exec.rs:3027 — FunctionTooLong — datafusion_physical_plan::joins::hash_join::exec::collect_left_input runs 260 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 160 over it, 2.60× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: datafusion_optimizer::optimize_projections::optimize_projections datafusion/optimizer/src/optimize_projections/mod.rs:127 — FunctionTooLong — datafusion_optimizer::optimize_projections::optimize_projections runs 238 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 138 over it, 2.38× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: datafusion_physical_optimizer::ensure_requirements::enforce_distribution::ensure_distribution_with_stats datafusion/physical-optimizer/src/ensure_requirements/enforce_distribution.rs:1363 — FunctionTooLong — datafusion_physical_optimizer::ensure_requirements::enforce_distribution::ensure_distribution_with_stats runs 232 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 132 over it, 2.32× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: datafusion_substrait::logical_plan::producer::types::to_substrait_type_from_field datafusion/substrait/src/logical_plan/producer/types.rs:42 — FunctionTooLong — datafusion_substrait::logical_plan::producer::types::to_substrait_type_from_field runs 224 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 124 over it, 2.24× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: datafusion_spark::function::math::negative::spark_negative datafusion/spark/src/function/math/negative.rs:182 — FunctionTooLong — datafusion_spark::function::math::negative::spark_negative runs 223 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 123 over it, 2.23× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: datafusion_substrait::logical_plan::producer::expr::literal::to_substrait_literal datafusion/substrait/src/logical_plan/producer/expr/literal.rs:55 — FunctionTooLong — datafusion_substrait::logical_plan::producer::expr::literal::to_substrait_literal runs 222 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 122 over it, 2.22× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: datafusion_functions::datetime::date_bin::date_bin_impl datafusion/functions/src/datetime/date_bin.rs:517 — FunctionTooLong — datafusion_functions::datetime::date_bin::date_bin_impl runs 210 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 110 over it, 2.10× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: datafusion_functions::regex::regexpcount::regexp_count_inner datafusion/functions/src/regex/regexpcount.rs:261 — FunctionTooLong — datafusion_functions::regex::regexpcount::regexp_count_inner runs 196 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 96 over it, 1.96× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: datafusion_functions_aggregate_common::min_max::min_max_scalar_same_variant datafusion/functions-aggregate-common/src/min_max.rs:195 — FunctionTooLong — datafusion_functions_aggregate_common::min_max::min_max_scalar_same_variant runs 186 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 86 over it, 1.86× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: datafusion_substrait::logical_plan::consumer::types::from_substrait_type datafusion/substrait/src/logical_plan/consumer/types.rs:95 — FunctionTooLong — datafusion_substrait::logical_plan::consumer::types::from_substrait_type runs 175 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 75 over it, 1.75× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: datafusion_spark::function::math::round::spark_round datafusion/spark/src/function/math/round.rs:421 — FunctionTooLong — datafusion_spark::function::math::round::spark_round runs 157 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 57 over it, 1.57× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: datafusion_physical_optimizer::ensure_requirements::enforce_sorting::sort_pushdown::pushdown_sorts_helper datafusion/physical-optimizer/src/ensure_requirements/enforce_sorting/sort_pushdown.rs:240 — FunctionTooLong — datafusion_physical_optimizer::ensure_requirements::enforce_sorting::sort_pushdown::pushdown_sorts_helper runs 144 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 44 over it, 1.44× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: datafusion_expr_common::casts::try_cast_numeric_literal datafusion/expr-common/src/casts.rs:239 — FunctionTooLong — datafusion_expr_common::casts::try_cast_numeric_literal runs 140 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 40 over it, 1.40× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: datafusion_functions::math::round::round_columnar datafusion/functions/src/math/round.rs:473 — FunctionTooLong — datafusion_functions::math::round::round_columnar runs 140 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 40 over it, 1.40× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: datafusion_physical_optimizer::ensure_requirements::enforce_distribution::enforce_distribution_relationships datafusion/physical-optimizer/src/ensure_requirements/enforce_distribution.rs:1122 — FunctionTooLong — datafusion_physical_optimizer::ensure_requirements::enforce_distribution::enforce_distribution_relationships runs 139 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 39 over it, 1.39× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: datafusion_optimizer::decorrelate_lateral_join::rewrite_internal datafusion/optimizer/src/decorrelate_lateral_join.rs:76 — FunctionTooLong — datafusion_optimizer::decorrelate_lateral_join::rewrite_internal runs 133 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 33 over it, 1.33× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: datafusion_substrait::logical_plan::consumer::rel::read_rel::from_read_rel datafusion/substrait/src/logical_plan/consumer/rel/read_rel.rs:38 — FunctionTooLong — datafusion_substrait::logical_plan::consumer::rel::read_rel::from_read_rel runs 132 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 32 over it, 1.32× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: datafusion_optimizer::eliminate_join::rewrite_node datafusion/optimizer/src/eliminate_join.rs:211 — FunctionTooLong — datafusion_optimizer::eliminate_join::rewrite_node runs 127 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 27 over it, 1.27× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: datafusion_pruning::pruning_predicate::build_predicate_expression datafusion/pruning/src/pruning_predicate.rs:1732 — FunctionTooLong — datafusion_pruning::pruning_predicate::build_predicate_expression runs 127 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 27 over it, 1.27× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: datafusion_optimizer::decorrelate_predicate_subquery::build_join datafusion/optimizer/src/decorrelate_predicate_subquery.rs:525 — FunctionTooLong — datafusion_optimizer::decorrelate_predicate_subquery::build_join runs 126 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 26 over it, 1.26× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • + 20 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (8 lines × 2) · ×42
  • Duplicated block (8 lines × 2) datafusion/core/src/dataframe/mod.rs:1066 — datafusion/core/src/dataframe/mod.rs:1066-1073 | datafusion/core/src/dataframe/mod.rs:1093-1100 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) datafusion/core/src/dataframe/mod.rs:1075 — datafusion/core/src/dataframe/mod.rs:1075-1082 | datafusion/core/src/dataframe/mod.rs:1084-1091 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) datafusion/datasource-parquet/src/schema_coercion.rs:444 — datafusion/datasource-parquet/src/schema_coercion.rs:444-451 | datafusion/datasource-parquet/src/schema_coercion.rs:478-485 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) datafusion/expr/src/expr.rs:832 — datafusion/expr/src/expr.rs:832-839 | datafusion/physical-expr/src/expressions/binary.rs:228-235 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8 lines × 2) datafusion/expr/src/expr_schema.rs:400 — datafusion/expr/src/expr_schema.rs:400-407 | datafusion/expr/src/expr_schema.rs:555-562 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) datafusion/expr-common/src/interval_arithmetic.rs:583 — datafusion/expr-common/src/interval_arithmetic.rs:583-590 | datafusion/expr-common/src/interval_arithmetic.rs:608-615 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) datafusion/expr-common/src/interval_arithmetic.rs:2011 — datafusion/expr-common/src/interval_arithmetic.rs:2011-2018 | datafusion/expr-common/src/interval_arithmetic.rs:2051-2058 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) datafusion/ffi/src/proto/logical_extension_codec.rs:477 — datafusion/ffi/src/proto/logical_extension_codec.rs:477-484 | datafusion/ffi/src/proto/physical_extension_codec.rs:418-425 — before extracting anything, compare `datafusion/ffi/src/proto/logical_extension_codec.rs` and `datafusion/ffi/src/proto/physical_extension_codec.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 118 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 2) datafusion/ffi/src/proto/logical_extension_codec.rs:496 — datafusion/ffi/src/proto/logical_extension_codec.rs:496-503 | datafusion/ffi/src/proto/physical_extension_codec.rs:437-444 — before extracting anything, compare `datafusion/ffi/src/proto/logical_extension_codec.rs` and `datafusion/ffi/src/proto/physical_extension_codec.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 118 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 2) datafusion/functions/src/regex/regexpcount.rs:194 — datafusion/functions/src/regex/regexpcount.rs:194-201 | datafusion/functions/src/regex/regexpcount.rs:214-223 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) datafusion/functions/src/string/ends_with.rs:130 — datafusion/functions/src/string/ends_with.rs:130-137 | datafusion/functions/src/string/starts_with.rs:126-133 — before extracting anything, compare `datafusion/functions/src/string/ends_with.rs` and `datafusion/functions/src/string/starts_with.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 64 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 2) datafusion/functions/src/string/split_part.rs:376 — datafusion/functions/src/string/split_part.rs:376-384 | datafusion/functions/src/unicode/initcap.rs:254-261 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8 lines × 2) datafusion/functions/src/strings.rs:168 — datafusion/functions/src/strings.rs:168-175 | datafusion/functions/src/strings.rs:567-574 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) datafusion/functions/src/unicode/character_length.rs:146 — datafusion/functions/src/unicode/character_length.rs:146-153 | datafusion/spark/src/function/string/length.rs:142-149 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8 lines × 2) datafusion/functions/src/unicode/lpad.rs:74 — datafusion/functions/src/unicode/lpad.rs:74-81 | datafusion/functions/src/unicode/rpad.rs:74-81 — before extracting anything, compare `datafusion/functions/src/unicode/lpad.rs` and `datafusion/functions/src/unicode/rpad.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 229 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 2) datafusion/functions-aggregate/src/approx_distinct.rs:829 — datafusion/functions-aggregate/src/approx_distinct.rs:829-836 | datafusion/functions-aggregate/src/approx_distinct.rs:950-957 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) datafusion/functions-nested/src/array_has.rs:989 — datafusion/functions-nested/src/array_has.rs:989-996 | datafusion/functions-nested/src/array_has.rs:1002-1009 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) datafusion/optimizer/src/eliminate_cross_join.rs:424 — datafusion/optimizer/src/eliminate_cross_join.rs:424-431 | datafusion/optimizer/src/eliminate_cross_join.rs:438-445 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) datafusion/physical-expr/src/equivalence/properties/mod.rs:647 — datafusion/physical-expr/src/equivalence/properties/mod.rs:647-654 | datafusion/physical-expr/src/equivalence/properties/mod.rs:735-742 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) datafusion/physical-expr/src/expressions/binary.rs:212 — datafusion/physical-expr/src/expressions/binary.rs:212-219 | datafusion/physical-expr/src/expressions/binary.rs:955-962 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) datafusion/physical-plan/src/aggregates/aggregate_hash_table/common.rs:311 — datafusion/physical-plan/src/aggregates/aggregate_hash_table/common.rs:311-318 | datafusion/physical-plan/src/aggregates/aggregate_hash_table/common_ordered.rs:471-478 — before extracting anything, compare `datafusion/physical-plan/src/aggregates/aggregate_hash_table/common.rs` and `datafusion/physical-plan/src/aggregates/aggregate_hash_table/common_ordered.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 30 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 2) datafusion/physical-plan/src/aggregates/hash_stream.rs:224 — datafusion/physical-plan/src/aggregates/hash_stream.rs:224-231 | datafusion/physical-plan/src/aggregates/ordered_partial_stream.rs:151-158 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (8 lines × 2) datafusion/physical-plan/src/joins/nested_loop_join.rs:3231 — datafusion/physical-plan/src/joins/nested_loop_join.rs:3231-3238 | datafusion/physical-plan/src/joins/nested_loop_join.rs:3351-3358 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs:1277 — datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs:1277-1284 | datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs:1332-1339 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) datafusion/physical-plan/src/repartition/range.rs:409 — datafusion/physical-plan/src/repartition/range.rs:409-416 | datafusion/physical-plan/src/repartition/range.rs:465-472 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • + 17 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (7 lines × 2) · ×42
  • Duplicated block (7 lines × 2) datafusion/common/src/dfschema.rs:729 — datafusion/common/src/dfschema.rs:729-735 | datafusion/common/src/dfschema.rs:798-804 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) datafusion/common/src/stats.rs:904 — datafusion/common/src/stats.rs:904-910 | datafusion/common/src/stats.rs:932-938 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) datafusion/datasource/src/display.rs:72 — datafusion/datasource/src/display.rs:72-78 | datafusion/datasource/src/display.rs:81-87 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) datafusion/expr-common/src/interval_arithmetic.rs:1000 — datafusion/expr-common/src/interval_arithmetic.rs:1000-1006 | datafusion/expr-common/src/interval_arithmetic.rs:1031-1037 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) datafusion/expr-common/src/casts.rs:498 — datafusion/expr-common/src/casts.rs:498-504 | datafusion/expr-common/src/casts.rs:506-512 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) datafusion/ffi/src/proto/logical_extension_codec.rs:459 — datafusion/ffi/src/proto/logical_extension_codec.rs:459-465 | datafusion/ffi/src/proto/physical_extension_codec.rs:400-406 — before extracting anything, compare `datafusion/ffi/src/proto/logical_extension_codec.rs` and `datafusion/ffi/src/proto/physical_extension_codec.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 118 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 2) datafusion/functions/src/unicode/substr.rs:290 — datafusion/functions/src/unicode/substr.rs:290-296 | datafusion/functions/src/unicode/substrindex.rs:306-312 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (7 lines × 2) datafusion/functions-aggregate/src/correlation.rs:190 — datafusion/functions-aggregate/src/correlation.rs:190-196 | datafusion/functions-aggregate/src/correlation.rs:283-289 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) datafusion/functions-aggregate-common/src/aggregate/count_distinct/groups.rs:115 — datafusion/functions-aggregate-common/src/aggregate/count_distinct/groups.rs:115-121 | datafusion/functions-aggregate/src/count.rs:732-738 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (7 lines × 2) datafusion/functions-aggregate/src/first_last.rs:1126 — datafusion/functions-aggregate/src/first_last.rs:1126-1132 | datafusion/functions-aggregate/src/first_last.rs:1520-1526 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) datafusion/functions-nested/src/extract.rs:653 — datafusion/functions-nested/src/extract.rs:653-659 | datafusion/functions-nested/src/extract.rs:745-751 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) datafusion/optimizer/src/push_down_filter.rs:895 — datafusion/optimizer/src/push_down_filter.rs:895-901 | datafusion/optimizer/src/push_down_filter.rs:993-999 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) datafusion/physical-plan/src/aggregates/aggregate_hash_table/common.rs:164 — datafusion/physical-plan/src/aggregates/aggregate_hash_table/common.rs:164-170 | datafusion/physical-plan/src/aggregates/aggregate_hash_table/common_ordered.rs:211-217 — before extracting anything, compare `datafusion/physical-plan/src/aggregates/aggregate_hash_table/common.rs` and `datafusion/physical-plan/src/aggregates/aggregate_hash_table/common_ordered.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 30 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 2) datafusion/physical-plan/src/analyze.rs:528 — datafusion/physical-plan/src/analyze.rs:528-534 | datafusion/physical-plan/src/analyze.rs:541-547 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs:1572 — datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs:1572-1578 | datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs:1692-1698 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) datafusion/physical-plan/src/joins/utils.rs:1126 — datafusion/physical-plan/src/joins/utils.rs:1126-1133 | datafusion/physical-plan/src/joins/utils.rs:1144-1150 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) datafusion/physical-plan/src/topk/mod.rs:1932 — datafusion/physical-plan/src/topk/mod.rs:1932-1938 | datafusion/physical-plan/src/topk/mod.rs:2489-2495 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs:392 — datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs:392-398 | datafusion/physical-plan/src/windows/window_agg_exec.rs:191-197 — before extracting anything, compare `datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs` and `datafusion/physical-plan/src/windows/window_agg_exec.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 61 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 2) datafusion/spark/src/function/bitmap/bitmap_bit_position.rs:96 — datafusion/spark/src/function/bitmap/bitmap_bit_position.rs:96-102 | datafusion/spark/src/function/bitmap/bitmap_bucket_number.rs:96-102 — before extracting anything, compare `datafusion/spark/src/function/bitmap/bitmap_bit_position.rs` and `datafusion/spark/src/function/bitmap/bitmap_bucket_number.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 2) datafusion/spark/src/function/bitmap/bitmap_bit_position.rs:104 — datafusion/spark/src/function/bitmap/bitmap_bit_position.rs:104-110 | datafusion/spark/src/function/bitmap/bitmap_bucket_number.rs:104-110 — before extracting anything, compare `datafusion/spark/src/function/bitmap/bitmap_bit_position.rs` and `datafusion/spark/src/function/bitmap/bitmap_bucket_number.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 2) datafusion/spark/src/function/string/format_string.rs:151 — datafusion/spark/src/function/string/format_string.rs:151-157 | datafusion/spark/src/function/string/format_string.rs:180-186 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) datafusion-cli/src/object_storage/instrumented.rs:187 — datafusion-cli/src/object_storage/instrumented.rs:187-193 | datafusion-cli/src/object_storage/instrumented.rs:210-216 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) datafusion/catalog-listing/src/table.rs:798 — datafusion/catalog-listing/src/table.rs:798-804 | datafusion/catalog/src/cte_worktable.rs:159-165 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (7 lines × 2) datafusion/datasource-parquet/src/metadata.rs:1061 — datafusion/datasource-parquet/src/metadata.rs:1061-1067 | datafusion/datasource-parquet/src/reader.rs:361-367 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (7 lines × 2) datafusion/expr/src/higher_order_function.rs:845 — datafusion/expr/src/higher_order_function.rs:845-851 | datafusion/expr/src/udf.rs:888-894 — before extracting anything, compare `datafusion/expr/src/higher_order_function.rs` and `datafusion/expr/src/udf.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 41 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • + 17 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (10 lines × 2) · ×38
  • Duplicated block (10 lines × 2) datafusion/common/src/dfschema.rs:717 — datafusion/common/src/dfschema.rs:717-726 | datafusion/common/src/dfschema.rs:786-795 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) datafusion/common/src/hash_utils.rs:362 — datafusion/common/src/hash_utils.rs:362-371 | datafusion/common/src/hash_utils/build_hasher.rs:257-266 — before extracting anything, compare `datafusion/common/src/hash_utils.rs` and `datafusion/common/src/hash_utils/build_hasher.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 45 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 2) datafusion/common/src/hash_utils.rs:710 — datafusion/common/src/hash_utils.rs:710-719 | datafusion/common/src/hash_utils.rs:753-762 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) datafusion/core/src/execution/context/mod.rs:906 — datafusion/core/src/execution/context/mod.rs:906-915 | datafusion/core/src/execution/context/mod.rs:925-934 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) datafusion/datasource/src/boundary_stream.rs:238 — datafusion/datasource/src/boundary_stream.rs:238-247 | datafusion/datasource/src/boundary_stream.rs:279-288 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) datafusion/datasource/src/file_compression_type.rs:145 — datafusion/datasource/src/file_compression_type.rs:145-154 | datafusion/datasource/src/file_compression_type.rs:245-254 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) datafusion/expr/src/expr_fn.rs:925 — datafusion/expr/src/expr_fn.rs:925-934 | datafusion/expr/src/expr_fn.rs:965-974 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) datafusion/expr/src/higher_order_function.rs:1423 — datafusion/expr/src/higher_order_function.rs:1423-1432 | datafusion/physical-expr/src/expressions/lambda.rs:343-352 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (10 lines × 2) datafusion/expr/src/logical_plan/builder.rs:1866 — datafusion/expr/src/logical_plan/builder.rs:1866-1875 | datafusion/physical-plan/src/joins/utils.rs:336-345 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (10 lines × 2) datafusion/expr/src/logical_plan/display.rs:318 — datafusion/expr/src/logical_plan/display.rs:318-327 | datafusion/expr/src/logical_plan/plan.rs:2089-2098 — before extracting anything, compare `datafusion/expr/src/logical_plan/display.rs` and `datafusion/expr/src/logical_plan/plan.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 43 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 2) datafusion/expr/src/type_coercion/functions.rs:1076 — datafusion/expr/src/type_coercion/functions.rs:1076-1085 | datafusion/expr/src/type_coercion/functions.rs:1104-1113 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) datafusion/functions/src/string/levenshtein.rs:274 — datafusion/functions/src/string/levenshtein.rs:274-283 | datafusion/functions/src/string/levenshtein.rs:294-303 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) datafusion/functions/src/unicode/find_in_set.rs:289 — datafusion/functions/src/unicode/find_in_set.rs:289-298 | datafusion/functions/src/unicode/find_in_set.rs:316-325 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) datafusion/optimizer/src/push_down_filter.rs:1040 — datafusion/optimizer/src/push_down_filter.rs:1040-1049 | datafusion/optimizer/src/push_down_filter.rs:1114-1131 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) datafusion/optimizer/src/scalar_subquery_to_join.rs:131 — datafusion/optimizer/src/scalar_subquery_to_join.rs:131-140 | datafusion/optimizer/src/scalar_subquery_to_join.rs:204-213 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) datafusion/physical-expr-common/src/binary_map.rs:650 — datafusion/physical-expr-common/src/binary_map.rs:650-659 | datafusion/physical-plan/src/aggregates/group_values/multi_group_by/bytes.rs:410-419 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (10 lines × 2) datafusion/physical-expr-common/src/binary_view_map.rs:428 — datafusion/physical-expr-common/src/binary_view_map.rs:428-437 | datafusion/physical-plan/src/aggregates/group_values/multi_group_by/bytes_view.rs:340-349 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (10 lines × 2) datafusion/physical-optimizer/src/ensure_requirements/enforce_sorting/sort_pushdown.rs:1050 — datafusion/physical-optimizer/src/ensure_requirements/enforce_sorting/sort_pushdown.rs:1050-1059 | datafusion/physical-optimizer/src/ensure_requirements/enforce_sorting/sort_pushdown.rs:1132-1141 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) datafusion/physical-plan/src/aggregates/mod.rs:2685 — datafusion/physical-plan/src/aggregates/mod.rs:2685-2694 | datafusion/physical-plan/src/aggregates/mod.rs:2695-2704 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) datafusion/physical-plan/src/aggregates/ordered_single_stream.rs:453 — datafusion/physical-plan/src/aggregates/ordered_single_stream.rs:453-462 | datafusion/physical-plan/src/aggregates/single_stream.rs:485-494 — before extracting anything, compare `datafusion/physical-plan/src/aggregates/ordered_single_stream.rs` and `datafusion/physical-plan/src/aggregates/single_stream.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 101 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 2) datafusion/physical-plan/src/aggregates/ordered_single_stream.rs:558 — datafusion/physical-plan/src/aggregates/ordered_single_stream.rs:558-567 | datafusion/physical-plan/src/aggregates/single_stream.rs:585-594 — before extracting anything, compare `datafusion/physical-plan/src/aggregates/ordered_single_stream.rs` and `datafusion/physical-plan/src/aggregates/single_stream.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 101 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 2) datafusion/physical-plan/src/display.rs:318 — datafusion/physical-plan/src/display.rs:318-327 | datafusion/physical-plan/src/display.rs:516-525 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) datafusion/physical-plan/src/joins/asof_join.rs:654 — datafusion/physical-plan/src/joins/asof_join.rs:654-663 | datafusion/physical-plan/src/joins/sort_merge_join/exec.rs:780-789 — before extracting anything, compare `datafusion/physical-plan/src/joins/asof_join.rs` and `datafusion/physical-plan/src/joins/sort_merge_join/exec.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 48 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 2) datafusion/physical-plan/src/joins/sort_merge_join/bitwise_stream.rs:489 — datafusion/physical-plan/src/joins/sort_merge_join/bitwise_stream.rs:489-498 | datafusion/physical-plan/src/joins/sort_merge_join/bitwise_stream.rs:525-534 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) datafusion/physical-plan/src/sorts/sort.rs:1592 — datafusion/physical-plan/src/sorts/sort.rs:1592-1601 | datafusion/physical-plan/src/sorts/sort_preserving_merge.rs:453-462 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • + 13 more in this group — see findings.md.
D3 · God Classes · ClassTooLong · ×36
  • ClassTooLong: ScalarValue datafusion/common/src/scalar/mod.rs:358 — ClassTooLong — 3335 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 86 methods, 15 blocks, lines 358-5973. The bar is 400 significant lines; this is 2935 over it, 8.34× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: DefaultPhysicalPlanner REDACTED:149 — ClassTooLong — 1625 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 18 methods, 5 blocks, lines 149-3369. The bar is 400 significant lines; this is 1225 over it, 4.06× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: LogicalPlan datafusion/expr/src/logical_plan/plan.rs:215 — ClassTooLong — 1442 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 48 methods, 7 blocks, lines 215-2459. The bar is 400 significant lines; this is 1042 over it, 3.61× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: AggregateExec datafusion/physical-plan/src/aggregates/mod.rs:869 — ClassTooLong — 1110 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 40 methods, 5 blocks, lines 869-2837. The bar is 400 significant lines; this is 710 over it, 2.78× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: SessionContext datafusion/core/src/execution/context/mod.rs:294 — ClassTooLong — 1098 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 103 methods, 6 blocks, lines 294-2253. The bar is 400 significant lines; this is 698 over it, 2.75× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Expr datafusion/expr/src/expr.rs:326 — ClassTooLong — 1089 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 53 methods, 13 blocks, lines 326-3796. The bar is 400 significant lines; this is 689 over it, 2.72× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: LogicalPlanBuilder datafusion/expr/src/logical_plan/builder.rs:129 — ClassTooLong — 923 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 63 methods, 4 blocks, lines 129-1674. The bar is 400 significant lines; this is 523 over it, 2.31× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ConversionSpecifier datafusion/spark/src/function/string/format_string.rs:394 — ClassTooLong — 914 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 20 methods, 2 blocks, lines 394-2258. The bar is 400 significant lines; this is 514 over it, 2.29× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: HashJoinExec datafusion/physical-plan/src/joins/hash_join/exec.rs:890 — ClassTooLong — 877 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 27 methods, 7 blocks, lines 890-2357. The bar is 400 significant lines; this is 477 over it, 2.19× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Simplifier datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:821 — ClassTooLong — 854 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 1 methods, 3 blocks, lines 821-2208. The bar is 400 significant lines; this is 454 over it, 2.14× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: MaterializingSortMergeJoinStream datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs:279 — ClassTooLong — 832 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 42 methods, 2 blocks, lines 279-1942. The bar is 400 significant lines; this is 432 over it, 2.08× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: NestedLoopJoinStream datafusion/physical-plan/src/joins/nested_loop_join.rs:1944 — ClassTooLong — 828 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 24 methods, 5 blocks, lines 1944-3618. The bar is 400 significant lines; this is 428 over it, 2.07× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: DataFrame datafusion/core/src/dataframe/mod.rs:230 — ClassTooLong — 823 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 65 methods, 2 blocks, lines 230-2748. The bar is 400 significant lines; this is 423 over it, 2.06× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: GroupedHashAggregateStream datafusion/physical-plan/src/aggregates/grouped_hash_stream.rs:283 — ClassTooLong — 662 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 15 methods, 5 blocks, lines 283-1480. The bar is 400 significant lines; this is 262 over it, 1.66× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: SessionState datafusion/core/src/execution/session_state.rs:144 — ClassTooLong — 654 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 65 methods, 9 blocks, lines 144-2453. The bar is 400 significant lines; this is 254 over it, 1.64× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: EquivalenceProperties datafusion/physical-expr/src/equivalence/properties/mod.rs:136 — ClassTooLong — 621 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 48 methods, 3 blocks, lines 136-1506. The bar is 400 significant lines; this is 221 over it, 1.55× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: SessionStateBuilder datafusion/core/src/execution/session_state.rs:1138 — ClassTooLong — 605 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 65 methods, 5 blocks, lines 1138-2082. The bar is 400 significant lines; this is 205 over it, 1.51× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: DFParser datafusion/sql/src/parser.rs:452 — ClassTooLong — 603 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 30 methods, 2 blocks, lines 452-1518. The bar is 400 significant lines; this is 203 over it, 1.51× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: TypeCoercionRewriter datafusion/optimizer/src/analyzer/type_coercion.rs:178 — ClassTooLong — 585 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 11 methods, 3 blocks, lines 178-980. The bar is 400 significant lines; this is 185 over it, 1.46× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ListingTable datafusion/catalog-listing/src/table.rs:181 — ClassTooLong — 577 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 25 methods, 5 blocks, lines 181-1173. The bar is 400 significant lines; this is 177 over it, 1.44× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: SymmetricHashJoinExec datafusion/physical-plan/src/joins/symmetric_hash_join.rs:176 — ClassTooLong — 571 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 13 methods, 5 blocks, lines 176-959. The bar is 400 significant lines; this is 171 over it, 1.43× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: SortMergeJoinExec datafusion/physical-plan/src/joins/sort_merge_join/exec.rs:114 — ClassTooLong — 543 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 14 methods, 6 blocks, lines 114-892. The bar is 400 significant lines; this is 143 over it, 1.36× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: BitwiseSortMergeJoinStream datafusion/physical-plan/src/joins/sort_merge_join/bitwise_stream.rs:207 — ClassTooLong — 542 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 30 methods, 2 blocks, lines 207-1124. The bar is 400 significant lines; this is 142 over it, 1.36× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ParquetSource datafusion/datasource-parquet/src/source.rs:297 — ClassTooLong — 538 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 23 methods, 4 blocks, lines 297-1308. The bar is 400 significant lines; this is 138 over it, 1.35× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: FilterExec datafusion/physical-plan/src/filter.rs:86 — ClassTooLong — 534 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 13 methods, 6 blocks, lines 86-1040. The bar is 400 significant lines; this is 134 over it, 1.34× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • + 11 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (6 lines × 2) · ×34
  • Duplicated block (6 lines × 2) datafusion/catalog/src/information_schema.rs:1331 — datafusion/catalog/src/information_schema.rs:1331-1336 | datafusion/catalog/src/information_schema.rs:1465-1470 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) datafusion/common/src/stats.rs:107 — datafusion/common/src/stats.rs:107-112 | datafusion/common/src/stats.rs:124-129 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) datafusion/datasource/src/file_scan_config/mod.rs:764 — datafusion/datasource/src/file_scan_config/mod.rs:764-770 | datafusion/datasource/src/file_scan_config/mod.rs:1614-1619 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) datafusion/execution/src/disk_manager.rs:120 — datafusion/execution/src/disk_manager.rs:120-125 | datafusion/execution/src/disk_manager.rs:142-147 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) datafusion/expr-common/src/type_coercion/binary.rs:1867 — datafusion/expr-common/src/type_coercion/binary.rs:1867-1872 | datafusion/expr-common/src/type_coercion/binary.rs:1873-1878 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) datafusion/functions/src/regex/regexpcount.rs:71 — datafusion/functions/src/regex/regexpcount.rs:71-76 | datafusion/functions/src/regex/regexpinstr.rs:83-88 — before extracting anything, compare `datafusion/functions/src/regex/regexpcount.rs` and `datafusion/functions/src/regex/regexpinstr.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 2) datafusion/functions/src/string/ends_with.rs:141 — datafusion/functions/src/string/ends_with.rs:141-146 | datafusion/functions/src/string/starts_with.rs:137-142 — before extracting anything, compare `datafusion/functions/src/string/ends_with.rs` and `datafusion/functions/src/string/starts_with.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 64 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 2) datafusion/functions/src/string/ends_with.rs:150 — datafusion/functions/src/string/ends_with.rs:150-155 | datafusion/functions/src/string/starts_with.rs:146-151 — before extracting anything, compare `datafusion/functions/src/string/ends_with.rs` and `datafusion/functions/src/string/starts_with.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 64 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 2) datafusion/functions/src/string/replace.rs:94 — datafusion/functions/src/string/replace.rs:94-99 | datafusion/functions/src/string/replace.rs:116-121 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) datafusion/functions-aggregate/src/correlation.rs:431 — datafusion/functions-aggregate/src/correlation.rs:431-436 | datafusion/functions-aggregate/src/correlation.rs:585-590 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) datafusion/functions-aggregate/src/correlation.rs:502 — datafusion/functions-aggregate/src/correlation.rs:502-507 | datafusion/functions-aggregate/src/correlation.rs:550-555 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) datafusion/functions-window/src/lib.rs:88 — datafusion/functions-window/src/lib.rs:88-94 | datafusion/spark/src/lib.rs:237-242 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) datafusion/optimizer/src/push_down_filter.rs:1033 — datafusion/optimizer/src/push_down_filter.rs:1033-1038 | datafusion/optimizer/src/push_down_filter.rs:1107-1112 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) datafusion/physical-expr-common/src/metrics/value.rs:290 — datafusion/physical-expr-common/src/metrics/value.rs:290-295 | datafusion/physical-expr-common/src/metrics/value.rs:302-307 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) datafusion/physical-plan/src/aggregates/group_values/row.rs:333 — datafusion/physical-plan/src/aggregates/group_values/row.rs:333-338 | datafusion/physical-plan/src/aggregates/group_values/row.rs:343-348 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) datafusion/physical-plan/src/aggregates/group_values/row.rs:359 — datafusion/physical-plan/src/aggregates/group_values/row.rs:359-364 | datafusion/physical-plan/src/aggregates/group_values/row.rs:370-375 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) datafusion/physical-plan/src/aggregates/grouped_hash_stream.rs:508 — datafusion/physical-plan/src/aggregates/grouped_hash_stream.rs:508-514 | datafusion/physical-plan/src/aggregates/spill.rs:181-186 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (6 lines × 2) datafusion/proto/src/physical_plan/from_proto.rs:302 — datafusion/proto/src/physical_plan/from_proto.rs:302-309 | datafusion/proto/src/physical_plan/from_proto.rs:336-341 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) datafusion/substrait/src/logical_plan/consumer/rel/cross_rel.rs:30 — datafusion/substrait/src/logical_plan/consumer/rel/cross_rel.rs:30-35 | datafusion/substrait/src/logical_plan/consumer/rel/join_rel.rs:37-42 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (6 lines × 2) datafusion/expr-common/src/type_coercion/binary.rs:403 — datafusion/expr-common/src/type_coercion/binary.rs:403-408 | datafusion/physical-expr/src/expressions/binary.rs:252-257 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) datafusion/functions/src/binaries.rs:99 — datafusion/functions/src/binaries.rs:99-104 | datafusion/functions/src/strings.rs:145-150 — before extracting anything, compare `datafusion/functions/src/binaries.rs` and `datafusion/functions/src/strings.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 2) datafusion/physical-expr-common/src/binary_map.rs:80 — datafusion/physical-expr-common/src/binary_map.rs:80-85 | datafusion/physical-expr-common/src/binary_view_map.rs:57-62 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (6 lines × 2) datafusion/spark/src/function/string/quote.rs:68 — datafusion/spark/src/function/string/quote.rs:68-73 | datafusion/spark/src/function/string/soundex.rs:58-63 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (6 lines × 2) datafusion/common/src/types/canonical_extensions/fixed_shape_tensor.rs:48 — datafusion/common/src/types/canonical_extensions/fixed_shape_tensor.rs:48-53 | datafusion/common/src/types/canonical_extensions/variable_shape_tensor.rs:46-51 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (6 lines × 2) datafusion/ffi/src/catalog_provider.rs:109 — datafusion/ffi/src/catalog_provider.rs:109-114 | datafusion/ffi/src/catalog_provider_list.rs:100-105 — before extracting anything, compare `datafusion/ffi/src/catalog_provider.rs` and `datafusion/ffi/src/catalog_provider_list.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 45 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • + 9 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (5 lines × 2) · ×33
  • Duplicated block (5 lines × 2) datafusion/common/src/dfschema.rs:704 — datafusion/common/src/dfschema.rs:704-708 | datafusion/common/src/dfschema.rs:773-777 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) datafusion/datasource/src/memory.rs:744 — datafusion/datasource/src/memory.rs:744-748 | datafusion/physical-plan/src/joins/sort_merge_join/exec.rs:873-877 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (5 lines × 2) datafusion/expr-common/src/type_coercion/binary.rs:1139 — datafusion/expr-common/src/type_coercion/binary.rs:1139-1143 | datafusion/expr-common/src/type_coercion/binary.rs:1147-1151 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) datafusion/expr-common/src/type_coercion/binary.rs:2055 — datafusion/expr-common/src/type_coercion/binary.rs:2055-2059 | datafusion/expr-common/src/type_coercion/binary.rs:2061-2065 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) datafusion/ffi/src/proto/logical_extension_codec.rs:452 — datafusion/ffi/src/proto/logical_extension_codec.rs:452-456 | datafusion/ffi/src/proto/physical_extension_codec.rs:393-397 — before extracting anything, compare `datafusion/ffi/src/proto/logical_extension_codec.rs` and `datafusion/ffi/src/proto/physical_extension_codec.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 118 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 2) datafusion/ffi/src/proto/logical_extension_codec.rs:470 — datafusion/ffi/src/proto/logical_extension_codec.rs:470-474 | datafusion/ffi/src/proto/physical_extension_codec.rs:411-415 — before extracting anything, compare `datafusion/ffi/src/proto/logical_extension_codec.rs` and `datafusion/ffi/src/proto/physical_extension_codec.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 118 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 2) datafusion/ffi/src/proto/logical_extension_codec.rs:489 — datafusion/ffi/src/proto/logical_extension_codec.rs:489-493 | datafusion/ffi/src/proto/physical_extension_codec.rs:430-434 — before extracting anything, compare `datafusion/ffi/src/proto/logical_extension_codec.rs` and `datafusion/ffi/src/proto/physical_extension_codec.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 118 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 2) datafusion/functions/src/crypto/basic.rs:131 — datafusion/functions/src/crypto/basic.rs:131-135 | datafusion/functions/src/crypto/basic.rs:162-166 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) datafusion/functions/src/datetime/make_date.rs:123 — datafusion/functions/src/datetime/make_date.rs:123-127 | datafusion/functions/src/datetime/make_time.rs:124-128 — before extracting anything, compare `datafusion/functions/src/datetime/make_date.rs` and `datafusion/functions/src/datetime/make_time.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 30 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 2) datafusion/functions/src/encoding/inner.rs:470 — datafusion/functions/src/encoding/inner.rs:470-475 | datafusion/functions/src/encoding/inner.rs:502-506 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) datafusion/functions/src/math/iszero.rs:103 — datafusion/functions/src/math/iszero.rs:103-107 | datafusion/functions/src/math/iszero.rs:113-117 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) datafusion/functions-aggregate/src/average.rs:885 — datafusion/functions-aggregate/src/average.rs:885-889 | datafusion/functions-aggregate/src/average.rs:959-963 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:406 — datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:406-410 | datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:500-504 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) datafusion/functions-nested/src/array_has.rs:849 — datafusion/functions-nested/src/array_has.rs:849-853 | datafusion/functions-nested/src/array_has.rs:964-968 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) datafusion/functions-nested/src/array_transform.rs:164 — datafusion/functions-nested/src/array_transform.rs:164-173 | datafusion/functions-nested/src/lambda_utils.rs:205-209 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (5 lines × 2) datafusion/functions-nested/src/set_ops.rs:133 — datafusion/functions-nested/src/set_ops.rs:133-137 | datafusion/functions-nested/src/set_ops.rs:216-220 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) datafusion/optimizer/src/push_down_limit.rs:96 — datafusion/optimizer/src/push_down_limit.rs:96-100 | datafusion/optimizer/src/push_down_limit.rs:105-109 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) datafusion/physical-expr-common/src/physical_expr.rs:281 — datafusion/physical-expr-common/src/physical_expr.rs:281-285 | datafusion/physical-expr-common/src/physical_expr.rs:338-342 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) datafusion/physical-plan/src/display.rs:1185 — datafusion/physical-plan/src/display.rs:1185-1196 | datafusion/physical-plan/src/display.rs:1252-1256 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) datafusion/physical-plan/src/joins/utils.rs:1344 — datafusion/physical-plan/src/joins/utils.rs:1344-1348 | datafusion/physical-plan/src/joins/utils.rs:1352-1356 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) datafusion/spark/src/function/string/format_string.rs:128 — datafusion/spark/src/function/string/format_string.rs:128-132 | datafusion/spark/src/function/string/format_string.rs:166-170 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) datafusion/substrait/src/logical_plan/producer/types.rs:275 — datafusion/substrait/src/logical_plan/producer/types.rs:275-279 | datafusion/substrait/src/logical_plan/producer/types.rs:286-290 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) datafusion-cli/src/functions.rs:545 — datafusion-cli/src/functions.rs:545-549 | datafusion-cli/src/functions.rs:670-674 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:127 — datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:127-132 | datafusion/functions-aggregate-common/src/utils.rs:261-265 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (5 lines × 2) datafusion/physical-expr/src/higher_order_function.rs:289 — datafusion/physical-expr/src/higher_order_function.rs:289-293 | datafusion/physical-expr/src/scalar_function.rs:221-225 — before extracting anything, compare `datafusion/physical-expr/src/higher_order_function.rs` and `datafusion/physical-expr/src/scalar_function.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 42 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • + 8 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (11 lines × 2) · ×32
  • Duplicated block (11 lines × 2) datafusion/datasource-parquet/src/file_format.rs:451 — datafusion/datasource-parquet/src/file_format.rs:451-461 | datafusion/datasource-parquet/src/file_format.rs:472-482 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) datafusion/expr/src/expr.rs:3033 — datafusion/expr/src/expr.rs:3033-3043 | datafusion/expr/src/expr.rs:3306-3316 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) datafusion/functions/src/core/arrow_cast.rs:132 — datafusion/functions/src/core/arrow_cast.rs:132-142 | datafusion/functions/src/core/arrow_try_cast.rs:103-113 — before extracting anything, compare `datafusion/functions/src/core/arrow_cast.rs` and `datafusion/functions/src/core/arrow_try_cast.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (11 lines × 2) datafusion/functions/src/math/ceil.rs:67 — datafusion/functions/src/math/ceil.rs:67-77 | datafusion/functions/src/math/floor.rs:71-81 — before extracting anything, compare `datafusion/functions/src/math/ceil.rs` and `datafusion/functions/src/math/floor.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (11 lines × 2) datafusion/functions-aggregate/src/approx_distinct.rs:169 — datafusion/functions-aggregate/src/approx_distinct.rs:169-179 | datafusion/functions-aggregate/src/approx_distinct.rs:229-239 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) datafusion/functions-aggregate/src/covariance.rs:109 — datafusion/functions-aggregate/src/covariance.rs:109-119 | datafusion/functions-aggregate/src/covariance.rs:196-206 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) datafusion/functions-aggregate/src/min_max/min_max_bytes.rs:75 — datafusion/functions-aggregate/src/min_max/min_max_bytes.rs:75-85 | datafusion/functions-aggregate/src/min_max/min_max_bytes.rs:89-99 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) datafusion/optimizer/src/analyzer/type_coercion.rs:617 — datafusion/optimizer/src/analyzer/type_coercion.rs:617-627 | datafusion/optimizer/src/analyzer/type_coercion.rs:646-656 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) datafusion/physical-expr/src/expressions/case.rs:865 — datafusion/physical-expr/src/expressions/case.rs:865-875 | datafusion/physical-expr/src/expressions/case.rs:952-962 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) datafusion/physical-expr/src/expressions/cast.rs:94 — datafusion/physical-expr/src/expressions/cast.rs:94-104 | datafusion/physical-expr/src/expressions/try_cast.rs:66-76 — before extracting anything, compare `datafusion/physical-expr/src/expressions/cast.rs` and `datafusion/physical-expr/src/expressions/try_cast.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 48 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (11 lines × 2) datafusion/physical-expr/src/higher_order_function.rs:259 — datafusion/physical-expr/src/higher_order_function.rs:259-269 | datafusion/physical-expr/src/scalar_function.rs:192-202 — before extracting anything, compare `datafusion/physical-expr/src/higher_order_function.rs` and `datafusion/physical-expr/src/scalar_function.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 42 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (11 lines × 2) datafusion/physical-expr-common/src/physical_expr.rs:878 — datafusion/physical-expr-common/src/physical_expr.rs:878-888 | datafusion/physical-expr-common/src/sort_expr.rs:392-402 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (11 lines × 2) datafusion/physical-optimizer/src/utils.rs:43 — datafusion/physical-optimizer/src/utils.rs:43-53 | datafusion/physical-optimizer/src/utils.rs:71-81 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) datafusion/physical-plan/src/aggregates/mod.rs:2038 — datafusion/physical-plan/src/aggregates/mod.rs:2038-2048 | datafusion/physical-plan/src/aggregates/mod.rs:2095-2105 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) datafusion/physical-plan/src/aggregates/ordered_final_stream.rs:389 — datafusion/physical-plan/src/aggregates/ordered_final_stream.rs:389-399 | datafusion/physical-plan/src/aggregates/ordered_partial_stream.rs:347-358 — before extracting anything, compare `datafusion/physical-plan/src/aggregates/ordered_final_stream.rs` and `datafusion/physical-plan/src/aggregates/ordered_partial_stream.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 50 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (11 lines × 2) datafusion/physical-plan/src/display.rs:586 — datafusion/physical-plan/src/display.rs:586-596 | datafusion/physical-plan/src/display.rs:600-610 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) datafusion/physical-plan/src/joins/nested_loop_join.rs:2954 — datafusion/physical-plan/src/joins/nested_loop_join.rs:2954-2964 | datafusion/physical-plan/src/joins/nested_loop_join.rs:3053-3063 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) datafusion/physical-plan/src/repartition/range.rs:423 — datafusion/physical-plan/src/repartition/range.rs:423-433 | datafusion/physical-plan/src/repartition/range.rs:483-493 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) datafusion/proto/src/logical_plan/from_proto.rs:436 — datafusion/proto/src/logical_plan/from_proto.rs:436-446 | datafusion/proto/src/logical_plan/from_proto.rs:450-460 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) datafusion/spark/src/function/datetime/from_utc_timestamp.rs:146 — datafusion/spark/src/function/datetime/from_utc_timestamp.rs:146-156 | datafusion/spark/src/function/datetime/to_utc_timestamp.rs:148-158 — before extracting anything, compare `datafusion/spark/src/function/datetime/from_utc_timestamp.rs` and `datafusion/spark/src/function/datetime/to_utc_timestamp.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 70 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (11 lines × 2) datafusion/spark/src/function/string/format_string.rs:1701 — datafusion/spark/src/function/string/format_string.rs:1701-1711 | datafusion/spark/src/function/string/format_string.rs:1976-1986 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) datafusion/sql/src/expr/function.rs:366 — datafusion/sql/src/expr/function.rs:366-376 | datafusion/sql/src/expr/function.rs:544-554 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) datafusion/sql/src/unparser/utils.rs:80 — datafusion/sql/src/unparser/utils.rs:80-90 | datafusion/sql/src/unparser/utils.rs:103-113 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) datafusion/functions/src/core/arrow_cast.rs:103 — datafusion/functions/src/core/arrow_cast.rs:103-113 | datafusion/functions/src/core/arrow_try_cast.rs:75-85 — before extracting anything, compare `datafusion/functions/src/core/arrow_cast.rs` and `datafusion/functions/src/core/arrow_try_cast.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (11 lines × 2) datafusion/spark/src/function/url/url_decode.rs:150 — datafusion/spark/src/function/url/url_decode.rs:150-160 | datafusion/spark/src/function/url/url_encode.rs:63-73 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • + 7 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (12 lines × 2) · ×24
  • Duplicated block (12 lines × 2) datafusion/datasource/src/memory.rs:788 — datafusion/datasource/src/memory.rs:788-799 | datafusion/proto/src/physical_plan/to_proto.rs:390-401 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (12 lines × 2) datafusion/expr-common/src/type_coercion/binary.rs:1986 — datafusion/expr-common/src/type_coercion/binary.rs:1986-1997 | datafusion/expr-common/src/type_coercion/binary.rs:2033-2044 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) datafusion/ffi/src/udtf.rs:109 — datafusion/ffi/src/udtf.rs:109-120 | datafusion/ffi/src/udtf.rs:137-148 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) datafusion/functions/src/core/arrow_field.rs:135 — datafusion/functions/src/core/arrow_field.rs:135-146 | datafusion/functions/src/core/arrow_metadata.rs:138-149 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (12 lines × 2) datafusion/functions/src/crypto/md5.rs:67 — datafusion/functions/src/crypto/md5.rs:67-78 | datafusion/functions/src/crypto/sha.rs:122-133 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (12 lines × 2) datafusion/functions/src/datetime/current_date.rs:112 — datafusion/functions/src/datetime/current_date.rs:112-123 | datafusion/functions/src/datetime/current_time.rs:109-120 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (12 lines × 2) datafusion/functions/src/datetime/make_date.rs:83 — datafusion/functions/src/datetime/make_date.rs:83-94 | datafusion/functions/src/datetime/make_time.rs:84-95 — before extracting anything, compare `datafusion/functions/src/datetime/make_date.rs` and `datafusion/functions/src/datetime/make_time.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 30 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 2) datafusion/functions/src/math/round.rs:455 — datafusion/functions/src/math/round.rs:455-466 | datafusion/functions/src/math/trunc.rs:270-281 — before extracting anything, compare `datafusion/functions/src/math/round.rs` and `datafusion/functions/src/math/trunc.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 2) datafusion/functions/src/string/levenshtein.rs:261 — datafusion/functions/src/string/levenshtein.rs:261-272 | datafusion/functions/src/string/levenshtein.rs:281-292 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) datafusion/functions/src/unicode/left.rs:59 — datafusion/functions/src/unicode/left.rs:59-70 | datafusion/functions/src/unicode/right.rs:59-70 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (12 lines × 2) datafusion/functions/src/math/common.rs:74 — datafusion/functions/src/math/common.rs:74-85 | datafusion/functions/src/math/common.rs:113-124 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) datafusion/functions-nested/src/cosine_distance.rs:187 — datafusion/functions-nested/src/cosine_distance.rs:187-198 | datafusion/functions-nested/src/inner_product.rs:193-204 — before extracting anything, compare `datafusion/functions-nested/src/cosine_distance.rs` and `datafusion/functions-nested/src/inner_product.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 86 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 2) datafusion/functions-nested/src/flatten.rs:142 — datafusion/functions-nested/src/flatten.rs:142-153 | datafusion/functions-nested/src/flatten.rs:177-188 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) datafusion/functions-nested/src/replace.rs:145 — datafusion/functions-nested/src/replace.rs:145-156 | datafusion/functions-nested/src/replace.rs:371-382 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) datafusion/physical-expr/src/window/window_expr.rs:508 — datafusion/physical-expr/src/window/window_expr.rs:508-519 | datafusion/physical-expr/src/window/window_expr.rs:564-575 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) datafusion/physical-plan/src/aggregates/ordered_single_stream.rs:278 — datafusion/physical-plan/src/aggregates/ordered_single_stream.rs:278-289 | datafusion/physical-plan/src/aggregates/single_stream.rs:322-333 — before extracting anything, compare `datafusion/physical-plan/src/aggregates/ordered_single_stream.rs` and `datafusion/physical-plan/src/aggregates/single_stream.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 101 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 2) datafusion/physical-plan/src/joins/sort_merge_join/exec.rs:523 — datafusion/physical-plan/src/joins/sort_merge_join/exec.rs:523-534 | datafusion/physical-plan/src/joins/symmetric_hash_join.rs:471-482 — before extracting anything, compare `datafusion/physical-plan/src/joins/sort_merge_join/exec.rs` and `datafusion/physical-plan/src/joins/symmetric_hash_join.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 50 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 2) datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs:586 — datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs:586-597 | datafusion/physical-plan/src/windows/window_agg_exec.rs:382-393 — before extracting anything, compare `datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs` and `datafusion/physical-plan/src/windows/window_agg_exec.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 61 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 2) datafusion/proto/src/logical_plan/mod.rs:937 — datafusion/proto/src/logical_plan/mod.rs:937-948 | datafusion/proto/src/logical_plan/mod.rs:964-975 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) datafusion/proto/src/logical_plan/from_proto.rs:359 — datafusion/proto/src/logical_plan/from_proto.rs:359-370 | datafusion/proto/src/logical_plan/from_proto.rs:376-387 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) datafusion/sql/src/expr/function.rs:716 — datafusion/sql/src/expr/function.rs:716-727 | datafusion/sql/src/expr/function.rs:872-883 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) datafusion/sql/src/unparser/expr.rs:925 — datafusion/sql/src/unparser/expr.rs:925-936 | datafusion/sql/src/unparser/expr.rs:939-950 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) datafusion/functions/src/string/split_part.rs:509 — datafusion/functions/src/string/split_part.rs:509-520 | datafusion/functions/src/unicode/substrindex.rs:583-594 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (12 lines × 2) datafusion/spark/src/function/datetime/monthname.rs:55 — datafusion/spark/src/function/datetime/monthname.rs:55-66 | datafusion/spark/src/function/datetime/weekday.rs:50-61 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D2 · Cognitive Complexity · datafusion_functions · ×22
  • datafusion_functions::unicode::lpad::lpad_impl (cognitive 111) datafusion/functions/src/unicode/lpad.rs:366 — datafusion_functions::unicode::lpad::lpad_impl has cognitive complexity 111 (threshold 15). Drivers by points: if/else 25 (71 pts), loops 6 (29 pts), match/switch 2 (10 pts), boolean chains 1 (nesting depth added 77). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • datafusion_functions::unicode::rpad::rpad_impl (cognitive 111) datafusion/functions/src/unicode/rpad.rs:365 — datafusion_functions::unicode::rpad::rpad_impl has cognitive complexity 111 (threshold 15). Drivers by points: if/else 25 (71 pts), loops 6 (29 pts), match/switch 2 (10 pts), boolean chains 1 (nesting depth added 77). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • datafusion_functions::regex::regexpcount::regexp_count_inner (cognitive 43) datafusion/functions/src/regex/regexpcount.rs:261 — datafusion_functions::regex::regexpcount::regexp_count_inner has cognitive complexity 43 (threshold 15). Drivers by points: if/else 19 (35 pts), boolean chains 7, match/switch 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_functions::datetime::common::handle_multiple (cognitive 40) datafusion/functions/src/datetime/common.rs:303 — datafusion_functions::datetime::common::handle_multiple has cognitive complexity 40 (threshold 15). Drivers by points: match/switch 8 (23 pts), if/else 3 (11 pts), loops 2 (6 pts) (nesting depth added 27). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • datafusion_functions::unicode::substrindex::substr_index_scalar_view (cognitive 34) datafusion/functions/src/unicode/substrindex.rs:377 — datafusion_functions::unicode::substrindex::substr_index_scalar_view has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (23 pts), loops 4 (10 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_functions::math::round::round_columnar (cognitive 31) datafusion/functions/src/math/round.rs:473 — datafusion_functions::math::round::round_columnar has cognitive complexity 31 (threshold 15). Drivers by points: boolean chains 14, if/else 10 (14 pts), match/switch 2 (3 pts) (nesting depth added 5). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
  • datafusion_functions::string::concat_ws::simplify_concat_ws (cognitive 30) datafusion/functions/src/string/concat_ws.rs:362 — datafusion_functions::string::concat_ws::simplify_concat_ws has cognitive complexity 30 (threshold 15). Drivers by points: match/switch 8 (18 pts), if/else 3 (9 pts), loops 1 (3 pts) (nesting depth added 18). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • datafusion_functions::regex::regexpreplace::regexp_replace (cognitive 30) datafusion/functions/src/regex/regexpreplace.rs:332 — datafusion_functions::regex::regexpreplace::regexp_replace has cognitive complexity 30 (threshold 15). Drivers by points: match/switch 9 (22 pts), if/else 4 (8 pts) (nesting depth added 17). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • datafusion_functions::string::common::string_view_trim (cognitive 24) datafusion/functions/src/string/common.rs:145 — datafusion_functions::string::common::string_view_trim has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 3 (8 pts), match/switch 1 (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • datafusion_functions::string::common::case_conversion_utf8view_ascii_inner (cognitive 23) datafusion/functions/src/string/common.rs:583 — datafusion_functions::string::common::case_conversion_utf8view_ascii_inner has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 2 (4 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_functions::datetime::common::handle_array_op (cognitive 22) datafusion/functions/src/datetime/common.rs:474 — datafusion_functions::datetime::common::handle_array_op has cognitive complexity 22 (threshold 15). Drivers by points: match/switch 3 (11 pts), if/else 4 (9 pts), loops 1 (2 pts) (nesting depth added 14). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • datafusion_functions::math::nanvl::nanvl_impl (cognitive 21) datafusion/functions/src/math/nanvl.rs:178 — datafusion_functions::math::nanvl::nanvl_impl has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 1 (2 pts), match/switch 1 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • datafusion_functions::string::repeat::repeat_impl (cognitive 20) datafusion/functions/src/string/repeat.rs:290 — datafusion_functions::string::repeat::repeat_impl has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 3 (6 pts) (nesting depth added 9). Of this number, 17 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_functions::core::getfield::simplify_get_field_over_struct_constructor (cognitive 20) datafusion/functions/src/core/getfield.rs:192 — datafusion_functions::core::getfield::simplify_get_field_over_struct_constructor has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (17 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_functions::datetime::date_bin::date_bin_impl (cognitive 20) datafusion/functions/src/datetime/date_bin.rs:517 — datafusion_functions::datetime::date_bin::date_bin_impl has cognitive complexity 20 (threshold 15). Drivers by points: match/switch 7 (10 pts), if/else 6 (9 pts), boolean chains 1 (nesting depth added 6). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • datafusion_functions::datetime::common::string_to_datetime_formatted (cognitive 19) datafusion/functions/src/datetime/common.rs:106 — datafusion_functions::datetime::common::string_to_datetime_formatted has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (16 pts), match/switch 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_functions::utils::map_lookup (cognitive 18) datafusion/functions/src/utils.rs:375 — datafusion_functions::utils::map_lookup has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13, boolean chains 4, match/switch 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • datafusion_functions::string::concat::simplify_concat (cognitive 18) datafusion/functions/src/string/concat.rs:309 — datafusion_functions::string::concat::simplify_concat has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 5 (10 pts), if/else 4 (6 pts), loops 2 (nesting depth added 7). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • datafusion_functions::math::trunc::trunc (cognitive 17) datafusion/functions/src/math/trunc.rs:289 — datafusion_functions::math::trunc::trunc has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), match/switch 3 (5 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_functions::string::chr::chr_array (cognitive 17) datafusion/functions/src/string/chr.rs:35 — datafusion_functions::string::chr::chr_array has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_functions::unicode::lpad::lpad_scalar_ascii (cognitive 16) datafusion/functions/src/unicode/lpad.rs:198 — datafusion_functions::unicode::lpad::lpad_scalar_ascii has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 2 (3 pts), match/switch 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_functions::unicode::rpad::rpad_scalar_ascii (cognitive 16) datafusion/functions/src/unicode/rpad.rs:198 — datafusion_functions::unicode::rpad::rpad_scalar_ascii has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 2 (3 pts), match/switch 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication · Duplicated block (13 lines × 2) · ×22
  • Duplicated block (13 lines × 2) datafusion/datasource-csv/src/source.rs:505 — datafusion/datasource-csv/src/source.rs:505-517 | datafusion/datasource-json/src/source.rs:564-576 — before extracting anything, compare `datafusion/datasource-csv/src/source.rs` and `datafusion/datasource-json/src/source.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (13 lines × 2) datafusion/expr/src/logical_plan/builder.rs:218 — datafusion/expr/src/logical_plan/builder.rs:218-230 | datafusion/expr/src/logical_plan/builder.rs:253-265 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) datafusion/functions/src/regex/regexpreplace.rs:653 — datafusion/functions/src/regex/regexpreplace.rs:653-665 | datafusion/functions/src/utils.rs:133-145 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (13 lines × 2) datafusion/functions/src/string/ends_with.rs:94 — datafusion/functions/src/string/ends_with.rs:94-106 | datafusion/functions/src/string/starts_with.rs:90-102 — before extracting anything, compare `datafusion/functions/src/string/ends_with.rs` and `datafusion/functions/src/string/starts_with.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 64 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (13 lines × 2) datafusion/functions/src/string/ltrim.rs:102 — datafusion/functions/src/string/ltrim.rs:102-114 | datafusion/functions/src/string/rtrim.rs:102-114 — before extracting anything, compare `datafusion/functions/src/string/ltrim.rs` and `datafusion/functions/src/string/rtrim.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (13 lines × 2) datafusion/functions/src/unicode/lpad.rs:111 — datafusion/functions/src/unicode/lpad.rs:111-123 | datafusion/functions/src/unicode/rpad.rs:111-123 — before extracting anything, compare `datafusion/functions/src/unicode/lpad.rs` and `datafusion/functions/src/unicode/rpad.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 229 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (13 lines × 2) datafusion/functions-aggregate/src/nth_value.rs:296 — datafusion/functions-aggregate/src/nth_value.rs:296-308 | datafusion/functions-aggregate/src/nth_value.rs:507-519 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) datafusion/functions-nested/src/position.rs:268 — datafusion/functions-nested/src/position.rs:268-280 | datafusion/functions-nested/src/position.rs:567-579 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) datafusion/functions-nested/src/range.rs:380 — datafusion/functions-nested/src/range.rs:380-392 | datafusion/functions-nested/src/range.rs:461-473 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) datafusion/physical-expr/src/expressions/cast.rs:231 — datafusion/physical-expr/src/expressions/cast.rs:231-244 | datafusion/physical-expr/src/expressions/try_cast.rs:178-190 — before extracting anything, compare `datafusion/physical-expr/src/expressions/cast.rs` and `datafusion/physical-expr/src/expressions/try_cast.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 48 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (13 lines × 2) datafusion/physical-expr/src/window/sliding_aggregate.rs:195 — datafusion/physical-expr/src/window/sliding_aggregate.rs:195-207 | datafusion/physical-expr/src/window/sliding_aggregate.rs:229-241 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) datafusion/physical-plan/src/display.rs:579 — datafusion/physical-plan/src/display.rs:579-591 | datafusion/physical-plan/src/display.rs:685-697 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) datafusion/physical-plan/src/joins/hash_join/exec.rs:1512 — datafusion/physical-plan/src/joins/hash_join/exec.rs:1512-1524 | datafusion/physical-plan/src/joins/sort_merge_join/exec.rs:440-452 — `datafusion/physical-plan/src/joins/hash_join/exec.rs` and `datafusion/physical-plan/src/joins/sort_merge_join/exec.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 33 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (13 lines × 2) datafusion/physical-plan/src/joins/symmetric_hash_join.rs:1138 — datafusion/physical-plan/src/joins/symmetric_hash_join.rs:1138-1150 | datafusion/physical-plan/src/joins/symmetric_hash_join.rs:1152-1164 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) datafusion/physical-plan/src/limit.rs:288 — datafusion/physical-plan/src/limit.rs:288-300 | datafusion/physical-plan/src/limit.rs:563-575 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) datafusion/physical-plan/src/topk/mod.rs:1496 — datafusion/physical-plan/src/topk/mod.rs:1496-1508 | datafusion/physical-plan/src/topk/mod.rs:1908-1920 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) datafusion/spark/src/function/datetime/make_dt_interval.rs:174 — datafusion/spark/src/function/datetime/make_dt_interval.rs:174-186 | datafusion/spark/src/function/datetime/make_interval.rs:197-209 — before extracting anything, compare `datafusion/spark/src/function/datetime/make_dt_interval.rs` and `datafusion/spark/src/function/datetime/make_interval.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (13 lines × 2) datafusion/spark/src/function/string/format_string.rs:1494 — datafusion/spark/src/function/string/format_string.rs:1494-1506 | datafusion/spark/src/function/string/format_string.rs:1513-1525 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) datafusion/physical-plan/src/aggregates/hash_stream.rs:682 — datafusion/physical-plan/src/aggregates/hash_stream.rs:682-696 | datafusion/physical-plan/src/aggregates/single_stream.rs:255-267 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (13 lines × 2) datafusion/functions-aggregate/src/approx_percentile_cont.rs:175 — datafusion/functions-aggregate/src/approx_percentile_cont.rs:175-188 | datafusion/functions-aggregate/src/percentile_cont.rs:277-289 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (13 lines × 2) datafusion/functions/src/unicode/lpad.rs:156 — datafusion/functions/src/unicode/lpad.rs:156-168 | datafusion/functions/src/unicode/rpad.rs:156-168 — before extracting anything, compare `datafusion/functions/src/unicode/lpad.rs` and `datafusion/functions/src/unicode/rpad.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 229 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (13 lines × 2) datafusion/functions/src/unicode/substr.rs:87 — datafusion/functions/src/unicode/substr.rs:87-99 | datafusion/spark/src/function/string/substring.rs:77-89 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (14 lines × 2) · ×20
  • Duplicated block (14 lines × 2) datafusion/expr-common/src/operator.rs:182 — datafusion/expr-common/src/operator.rs:182-195 | datafusion/expr-common/src/operator.rs:319-332 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) datafusion/functions/src/binaries.rs:38 — datafusion/functions/src/binaries.rs:38-51 | datafusion/functions/src/strings.rs:75-88 — before extracting anything, compare `datafusion/functions/src/binaries.rs` and `datafusion/functions/src/strings.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (14 lines × 2) datafusion/functions/src/encoding/inner.rs:90 — datafusion/functions/src/encoding/inner.rs:90-103 | datafusion/functions/src/encoding/inner.rs:163-176 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) datafusion/functions/src/regex/regexpcount.rs:329 — datafusion/functions/src/regex/regexpcount.rs:329-342 | datafusion/functions/src/regex/regexpcount.rs:374-388 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) datafusion/functions/src/regex/regexpcount.rs:404 — datafusion/functions/src/regex/regexpcount.rs:404-417 | datafusion/functions/src/regex/regexpcount.rs:477-490 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) datafusion/functions/src/regex/regexpcount.rs:440 — datafusion/functions/src/regex/regexpcount.rs:440-454 | datafusion/functions/src/regex/regexpcount.rs:527-540 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) datafusion/functions/src/unicode/substr.rs:77 — datafusion/functions/src/unicode/substr.rs:77-90 | datafusion/spark/src/function/string/substring.rs:61-74 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (14 lines × 2) datafusion/functions-nested/src/position.rs:252 — datafusion/functions-nested/src/position.rs:252-265 | datafusion/functions-nested/src/position.rs:548-561 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) datafusion/physical-expr/src/expressions/case.rs:909 — datafusion/physical-expr/src/expressions/case.rs:909-922 | datafusion/physical-expr/src/expressions/case.rs:995-1008 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) datafusion/physical-expr-common/src/binary_map.rs:496 — datafusion/physical-expr-common/src/binary_map.rs:496-509 | datafusion/physical-expr-common/src/binary_map.rs:537-550 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) datafusion/physical-plan/src/aggregates/ordered_final_stream.rs:273 — datafusion/physical-plan/src/aggregates/ordered_final_stream.rs:273-286 | datafusion/physical-plan/src/aggregates/ordered_partial_stream.rs:269-282 — before extracting anything, compare `datafusion/physical-plan/src/aggregates/ordered_final_stream.rs` and `datafusion/physical-plan/src/aggregates/ordered_partial_stream.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 50 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (14 lines × 2) datafusion/physical-plan/src/joins/sort_merge_join/bitwise_stream.rs:366 — datafusion/physical-plan/src/joins/sort_merge_join/bitwise_stream.rs:366-379 | datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs:593-606 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (14 lines × 2) datafusion/proto/src/logical_plan/from_proto.rs:361 — datafusion/proto/src/logical_plan/from_proto.rs:361-374 | datafusion/proto/src/logical_plan/from_proto.rs:395-408 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) datafusion/spark/src/function/datetime/from_utc_timestamp.rs:59 — datafusion/spark/src/function/datetime/from_utc_timestamp.rs:59-72 | datafusion/spark/src/function/datetime/to_utc_timestamp.rs:61-74 — before extracting anything, compare `datafusion/spark/src/function/datetime/from_utc_timestamp.rs` and `datafusion/spark/src/function/datetime/to_utc_timestamp.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 70 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (14 lines × 2) datafusion/sql/src/expr/function.rs:1044 — datafusion/sql/src/expr/function.rs:1044-1057 | datafusion/sql/src/expr/function.rs:1100-1113 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) datafusion/sqllogictest/src/engines/datafusion_engine/runner.rs:88 — datafusion/sqllogictest/src/engines/datafusion_engine/runner.rs:88-101 | datafusion/sqllogictest/src/engines/datafusion_substrait_roundtrip_engine/runner.rs:70-83 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (14 lines × 2) datafusion-cli/src/object_storage/instrumented.rs:333 — datafusion-cli/src/object_storage/instrumented.rs:333-346 | datafusion-cli/src/object_storage/instrumented.rs:356-369 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) datafusion/functions/src/string/split_part.rs:260 — datafusion/functions/src/string/split_part.rs:260-274 | datafusion/functions/src/unicode/substrindex.rs:203-216 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (14 lines × 2) datafusion/physical-plan/src/empty.rs:217 — datafusion/physical-plan/src/empty.rs:217-230 | datafusion/physical-plan/src/placeholder_row.rs:217-230 — before extracting anything, compare `datafusion/physical-plan/src/empty.rs` and `datafusion/physical-plan/src/placeholder_row.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 30 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (14 lines × 2) datafusion/functions-aggregate/src/first_last.rs:334 — datafusion/functions-aggregate/src/first_last.rs:334-347 | datafusion/functions-aggregate/src/first_last.rs:1254-1267 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D2 · Cognitive Complexity · datafusion_physical_plan · ×19
  • datafusion_physical_plan::windows::window_equivalence_properties (cognitive 102) datafusion/physical-plan/src/windows/mod.rs:380 — datafusion_physical_plan::windows::window_equivalence_properties has cognitive complexity 102 (threshold 15). Drivers by points: if/else 22 (70 pts), loops 6 (23 pts), boolean chains 9 (nesting depth added 65). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • datafusion_physical_plan::joins::hash_join::exec::collect_left_input (cognitive 52) datafusion/physical-plan/src/joins/hash_join/exec.rs:3027 — datafusion_physical_plan::joins::hash_join::exec::collect_left_input has cognitive complexity 52 (threshold 15). Drivers by points: if/else 30 (39 pts), boolean chains 6, loops 3 (6 pts), match/switch 1 (nesting depth added 12). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • datafusion_physical_plan::aggregates::get_finer_aggregate_exprs_requirement (cognitive 39) datafusion/physical-plan/src/aggregates/mod.rs:2972 — datafusion_physical_plan::aggregates::get_finer_aggregate_exprs_requirement has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (36 pts), loops 2 (3 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_physical_plan::joins::nested_loop_join::build_unmatched_batch (cognitive 35) datafusion/physical-plan/src/joins/nested_loop_join.rs:3879 — datafusion_physical_plan::joins::nested_loop_join::build_unmatched_batch has cognitive complexity 35 (threshold 15). Drivers by points: if/else 15 (26 pts), match/switch 2 (5 pts), loops 2 (4 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_physical_plan::joins::piecewise_merge_join::classic_join::resolve_classic_join (cognitive 34) datafusion/physical-plan/src/joins/piecewise_merge_join/classic_join.rs:438 — datafusion_physical_plan::joins::piecewise_merge_join::classic_join::resolve_classic_join has cognitive complexity 34 (threshold 15). Drivers by points: if/else 8 (24 pts), loops 3 (6 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_physical_plan::joins::utils::max_distinct_count (cognitive 30) datafusion/physical-plan/src/joins/utils.rs:1025 — datafusion_physical_plan::joins::utils::max_distinct_count has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (19 pts), match/switch 4 (8 pts), boolean chains 3 (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • datafusion_physical_plan::joins::hash_join::exec::array_map_key_range (cognitive 24) datafusion/physical-plan/src/joins/hash_join/exec.rs:123 — datafusion_physical_plan::joins::hash_join::exec::array_map_key_range has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_physical_plan::joins::utils::estimate_semi_join_cardinality (cognitive 24) datafusion/physical-plan/src/joins/utils.rs:957 — datafusion_physical_plan::joins::utils::estimate_semi_join_cardinality has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 6, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_physical_plan::joins::utils::compare_join_arrays (cognitive 24) datafusion/physical-plan/src/joins/utils.rs:2553 — datafusion_physical_plan::joins::utils::compare_join_arrays has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 4 (10 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_physical_plan::projection::try_pushdown_through_join_with_column_indices (cognitive 23) datafusion/physical-plan/src/projection.rs:929 — datafusion_physical_plan::projection::try_pushdown_through_join_with_column_indices has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (14 pts), match/switch 3 (6 pts), loops 2, boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_physical_plan::joins::utils::calculate_join_output_ordering (cognitive 23) datafusion/physical-plan/src/joins/utils.rs:167 — datafusion_physical_plan::joins::utils::calculate_join_output_ordering has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (18 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • datafusion_physical_plan::joins::join_hash_map::get_matched_indices_with_limit_offset (cognitive 23) datafusion/physical-plan/src/joins/join_hash_map.rs:389 — datafusion_physical_plan::joins::join_hash_map::get_matched_indices_with_limit_offset has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 2 (3 pts), match/switch 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_physical_plan::joins::utils::build_batch_from_indices (cognitive 21) datafusion/physical-plan/src/joins/utils.rs:1303 — datafusion_physical_plan::joins::utils::build_batch_from_indices has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 2 (5 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_physical_plan::filter::collect_equality_columns (cognitive 20) datafusion/physical-plan/src/filter.rs:1123 — datafusion_physical_plan::filter::collect_equality_columns has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 1 (3 pts), boolean chains 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_physical_plan::joins::join_hash_map::get_matched_indices (cognitive 20) datafusion/physical-plan/src/joins/join_hash_map.rs:340 — datafusion_physical_plan::joins::join_hash_map::get_matched_indices has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 2 (4 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_physical_plan::aggregates::group_values::multi_group_by::make_group_column (cognitive 20) datafusion/physical-plan/src/aggregates/group_values/multi_group_by/mod.rs:959 — datafusion_physical_plan::aggregates::group_values::multi_group_by::make_group_column has cognitive complexity 20 (threshold 15). Drivers by points: match/switch 10 (16 pts), if/else 2 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • datafusion_physical_plan::projection::try_collapse_projection_chain (cognitive 19) datafusion/physical-plan/src/projection.rs:1370 — datafusion_physical_plan::projection::try_collapse_projection_chain has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 4 (7 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_physical_plan::aggregates::group_values::new_group_values (cognitive 17) datafusion/physical-plan/src/aggregates/group_values/mod.rs:159 — datafusion_physical_plan::aggregates::group_values::new_group_values has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 4 (11 pts), if/else 5 (6 pts) (nesting depth added 8). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • datafusion_physical_plan::joins::utils::estimate_disjoint_inputs (cognitive 17) datafusion/physical-plan/src/joins/utils.rs:870 — datafusion_physical_plan::joins::utils::estimate_disjoint_inputs has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 4, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D35 · Change Coupling · Change coupling · ×19
  • Change coupling: csv.rs ↔ json.rs datafusion/core/src/datasource/file_format/csv.rs — `datafusion/core/src/datasource/file_format/csv.rs` and `datafusion/core/src/datasource/file_format/json.rs` change together 75% of the time (21 of the 28 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 21 shared commits counted here, the most recent 3 are `2ac032b4` fix: emit empty RecordBatch for empty file writes (#19370); `33be09ad` Revert "fix: create file for empty stream" (#16682); `4084894e` fix: create file for empty stream (#16342) — run `git show` on any of them.
  • Change coupling: mod.rs ↔ file_formats.rs datafusion/proto-common/src/from_proto/mod.rs — `datafusion/proto-common/src/from_proto/mod.rs` and `datafusion/proto/src/logical_plan/file_formats.rs` change together 70% of the time (26 of the 37 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 26 shared commits counted here, the most recent 3 are `54f5cf16` fix(proto): check integer conversions in common options and constrain…; `aa38d3c6` feat(pruning): expose pruning predicate IN-list rewrite size cap as a…; `c1366b55` chore: apply workspace lints to all crates (#24076) — run `git show` on any of them.
  • Change coupling: from_proto.rs ↔ to_proto.rs datafusion/proto/src/physical_plan/from_proto.rs — `datafusion/proto/src/physical_plan/from_proto.rs` and `datafusion/proto/src/physical_plan/to_proto.rs` change together 67% of the time (74 of the 110 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 74 shared commits counted here, the most recent 3 are `041a7167` Restore the From / TryFrom proto conversions dropped since 54.1.0 (#2…; `abc5ce7e` Proto: migrate MemorySourceConfig to per-source try_to_proto / try_fr…; `e2e8e1c8` Add DataSource/FileSource proto hooks and FileScanConfig serde (#23683) — run `git show` on any of them.
  • Change coupling: mod.rs ↔ file_formats.rs datafusion/proto-common/src/to_proto/mod.rs — `datafusion/proto-common/src/to_proto/mod.rs` and `datafusion/proto/src/logical_plan/file_formats.rs` change together 65% of the time (24 of the 37 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 24 shared commits counted here, the most recent 3 are `aa38d3c6` feat(pruning): expose pruning predicate IN-list rewrite size cap as a…; `c1366b55` chore: apply workspace lints to all crates (#24076); `84bc8761` feat: add max_row_group_bytes option to ParquetOptions (#22649) — run `git show` on any of them.
  • Change coupling: grouped_hash_stream.rs ↔ grouped_topk_stream.rs datafusion/physical-plan/src/aggregates/grouped_hash_stream.rs — `datafusion/physical-plan/src/aggregates/grouped_hash_stream.rs` and `datafusion/physical-plan/src/aggregates/grouped_topk_stream.rs` change together 64% of the time (7 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `8a922816` Refine and document AggregateExec metrics (#24757); `9f73cf17` Add aggregate-specific metrics to legacy grouped hash and TopK (#24523); `12bd5b07` mem: Cleanup resources of done streams immediately (#22064) (at that commit the files were still `datafusion/physical-plan/src/aggregates/row_hash.rs` and `datafusion/physical-plan/src/aggregates/topk_stream.rs`) — run `git show` on any of them.
  • Change coupling: expr_schema.rs ↔ tree_node.rs datafusion/expr/src/expr_schema.rs — `datafusion/expr/src/expr_schema.rs` and `datafusion/expr/src/tree_node.rs` change together 61% of the time (31 of the 51 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 31 shared commits counted here, the most recent 3 are `f2b48359` feat: Add support for `explode_outer` function for arrays (#22100); `88fa0dfc` Add `Field` to `Expr::Cast` -- allow logical expressions to express a…; `e221a2c5` feat: support customize metadata in alias for dataframe api (#15120) — run `git show` on any of them.
  • Change coupling: avro.rs ↔ parquet.rs datafusion/core/src/datasource/physical_plan/avro.rs — `datafusion/core/src/datasource/physical_plan/avro.rs` and `datafusion/core/src/datasource/physical_plan/parquet.rs` change together 60% of the time (9 of the 15 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `04c01bba` feat: add TableSchemaBuilder and store partition columns as Fields (#…; `6eb8d45c` Let `FileScanConfig` own a list of `ProjectionExpr`s (#18253); `3af31caa` Migrate datasource tests to insta (#15258) — run `git show` on any of them.
  • Change coupling: source.rs ↔ test_util.rs datafusion/datasource-csv/src/source.rs — `datafusion/datasource-csv/src/source.rs` and `datafusion/datasource/src/test_util.rs` change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `46b508eb` perf: optimize object store requests when reading CSV (#22962); `75d2473b` Remove SchemaAdapter (#19345); `8a91db56` Move statistics handling into FileScanConfig (#18721) — run `git show` on any of them.
  • Change coupling: mod.rs ↔ partial.rs datafusion/physical-plan/src/aggregates/mod.rs — `datafusion/physical-plan/src/aggregates/mod.rs` and `datafusion/physical-plan/src/aggregates/order/partial.rs` change together 55% of the time (6 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `461dc6d6` refactor(hash-aggr): Support spilling for ordered aggregation (#23657); `186ba4c3` Minor: make some physical-plan properties public (#12022); `5f38135d` Update arrow 47.0.0 in DataFusion (#7587) — run `git show` on any of them.
  • Change coupling: json.rs ↔ parquet.rs datafusion/core/src/datasource/file_format/json.rs — `datafusion/core/src/datasource/file_format/json.rs` and `datafusion/core/src/datasource/file_format/parquet.rs` change together 54% of the time (15 of the 28 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 15 shared commits counted here, the most recent 3 are `2ac032b4` fix: emit empty RecordBatch for empty file writes (#19370); `33be09ad` Revert "fix: create file for empty stream" (#16682); `4084894e` fix: create file for empty stream (#16342) — run `git show` on any of them.
  • Change coupling: listing_schema.rs ↔ listing_table_factory.rs datafusion/catalog/src/listing_schema.rs — `datafusion/catalog/src/listing_schema.rs` and `datafusion/core/src/datasource/listing_table_factory.rs` change together 53% of the time (8 of the 15 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `2b05b09b` feat: Add builder API for CreateExternalTable to reduce verbosity (#1…; `da893951` feat: Add `OR REPLACE` to creating external tables (#17580); `636f4332` Minor: add flags for temporary ddl (#12561) (at that commit the file was still `datafusion/core/src/catalog_common/listing_schema.rs`) — run `git show` on any of them.
  • Change coupling: listing_schema.rs ↔ statement.rs datafusion/catalog/src/listing_schema.rs — `datafusion/catalog/src/listing_schema.rs` and `datafusion/sql/src/statement.rs` change together 53% of the time (8 of the 15 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `2b05b09b` feat: Add builder API for CreateExternalTable to reduce verbosity (#1…; `da893951` feat: Add `OR REPLACE` to creating external tables (#17580); `636f4332` Minor: add flags for temporary ddl (#12561) (at that commit the file was still `datafusion/core/src/catalog_common/listing_schema.rs`) — run `git show` on any of them.
  • Change coupling: lib.rs ↔ to_proto.rs datafusion/functions-aggregate/src/lib.rs — `datafusion/functions-aggregate/src/lib.rs` and `datafusion/proto/src/physical_plan/to_proto.rs` change together 52% of the time (15 of the 29 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 15 shared commits counted here, the most recent 3 are `12d82c42` Move array `ArrayAgg` to a `UserDefinedAggregate` (#11448); `4ac14280` Convert `nth_value` to UDAF (#11287); `4bc32281` Covert grouping to udaf (#11147) — run `git show` on any of them.
  • Change coupling: aggregates.rs ↔ lib.rs datafusion/expr-common/src/type_coercion/aggregates.rs — `datafusion/expr-common/src/type_coercion/aggregates.rs` and `datafusion/functions-aggregate/src/lib.rs` change together 52% of the time (15 of the 29 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 15 shared commits counted here, the most recent 3 are `2222abda` refactor: remove unused `type_coercion/aggregate.rs` functions (#18091); `4ac14280` Convert `nth_value` to UDAF (#11287) (at that commit the file was still `datafusion/expr/src/type_coercion/aggregates.rs`); `4bc32281` Covert grouping to udaf (#11147) (at that commit the file was still `datafusion/expr/src/type_coercion/aggregates.rs`) — run `git show` on any of them.
  • Change coupling: source.rs ↔ test_util.rs datafusion/datasource-arrow/src/source.rs — `datafusion/datasource-arrow/src/source.rs` and `datafusion/datasource/src/test_util.rs` change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 5 shared commits counted here, the most recent 3 are `75d2473b` Remove SchemaAdapter (#19345); `8a91db56` Move statistics handling into FileScanConfig (#18721); `dfba2286` feat: allow pushdown of dynamic filters having partition cols (#18172) — run `git show` on any of them.
  • Change coupling: cte_worktable.rs ↔ REDACTED datafusion/catalog/src/cte_worktable.rs — `datafusion/catalog/src/cte_worktable.rs` and `REDACTED` change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 5 shared commits counted here, the most recent 3 are `1b67f2e9` Docs: document manual catalog impls and how compilation got faster (#…; `08bd332d` fix: Correctly compute nullability in recursive CTE schemas (#22552); `6859b93f` refactor: move `CteWorkTable`, `default_table_source` a bunch of fi… — run `git show` on any of them.
  • Change coupling: first_last.rs ↔ macros.rs datafusion/functions-aggregate/src/first_last.rs — `datafusion/functions-aggregate/src/first_last.rs` and `datafusion/functions-aggregate/src/macros.rs` change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 5 shared commits counted here, the most recent 3 are `50dc83a1` Convert Option<Vec<sort expression>> to Vec<sort expression> (#16615); `24a08465` Introduce expr builder for aggregate function (#10560); `a0fccbf8` Move `Covariance` (Sample) `covar` / `covar_samp` to be a User Define… — run `git show` on any of them.
  • Change coupling: mod.rs ↔ consumer.rs datafusion/core/src/datasource/file_format/mod.rs — `datafusion/core/src/datasource/file_format/mod.rs` and `datafusion/substrait/src/physical_plan/consumer.rs` change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 5 shared commits counted here, the most recent 3 are `ed01b67f` Refactor PartitionedFile: add ordering field and new_from_meta constr…; `6eb8d45c` Let `FileScanConfig` own a list of `ProjectionExpr`s (#18253); `07e8793e` allow passing in metadata_size_hint on a per-file basis (#13213) — run `git show` on any of them.
  • Change coupling: bytes_view.rs ↔ primitive.rs datafusion/physical-plan/src/aggregates/group_values/multi_group_by/bytes_view.rs — `datafusion/physical-plan/src/aggregates/group_values/multi_group_by/bytes_view.rs` and `datafusion/physical-plan/src/aggregates/group_values/multi_group_by/primitive.rs` change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 5 shared commits counted here, the most recent 3 are `0add0469` perf: hoist split_vec_min_alloc to datafusion-common and shrink the e…; `2c2f2259` Return an error on overflow in `do_append_val_inner` (#16201); `eabbbaf4` refactor: switch BooleanBufferBuilder to NullBufferBuilder in unit te… — run `git show` on any of them.
D2 · Cognitive Complexity · SqlToRel · ×18
  • SqlToRel::sql_statement_to_plan_with_context_impl (cognitive 238) datafusion/sql/src/statement.rs:267 — SqlToRel::sql_statement_to_plan_with_context_impl has cognitive complexity 238 (threshold 15). Drivers by points: if/else 143 (179 pts), match/switch 26 (55 pts), boolean chains 4 (nesting depth added 65). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • SqlToRel::sql_function_to_expr (cognitive 191) datafusion/sql/src/expr/function.rs:228 — SqlToRel::sql_function_to_expr has cognitive complexity 191 (threshold 15). Drivers by points: if/else 61 (125 pts), match/switch 13 (39 pts), loops 6 (16 pts), boolean chains 11 (nesting depth added 100). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • SqlToRel::sql_compound_identifier_to_expr (cognitive 39) datafusion/sql/src/expr/identifier.rs:116 — SqlToRel::sql_compound_identifier_to_expr has cognitive complexity 39 (threshold 15). Drivers by points: if/else 7 (17 pts), match/switch 3 (12 pts), loops 2 (7 pts), boolean chains 3 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SqlToRel::merge_clause_to_plan (cognitive 34) datafusion/sql/src/statement.rs:2664 — SqlToRel::merge_clause_to_plan has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (22 pts), match/switch 5 (8 pts), loops 2 (4 pts) (nesting depth added 18). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • SqlToRel::select_to_plan (cognitive 32) datafusion/sql/src/select.rs:99 — SqlToRel::select_to_plan has cognitive complexity 32 (threshold 15). Drivers by points: if/else 20 (23 pts), match/switch 3 (4 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • SqlToRel::insert_to_plan (cognitive 30) datafusion/sql/src/statement.rs:2806 — SqlToRel::insert_to_plan has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (15 pts), match/switch 4 (9 pts), loops 2 (5 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SqlToRel::match_window_definitions (cognitive 29) datafusion/sql/src/select.rs:1424 — SqlToRel::match_window_definitions has cognitive complexity 29 (threshold 15). Drivers by points: if/else 5 (17 pts), match/switch 1 (6 pts), loops 2 (5 pts), boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SqlToRel::convert_simple_data_type (cognitive 28) datafusion/sql/src/planner.rs:709 — SqlToRel::convert_simple_data_type has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 5 (9 pts), boolean chains 4 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • SqlToRel::sql_identifier_to_expr (cognitive 23) datafusion/sql/src/expr/identifier.rs:34 — SqlToRel::sql_identifier_to_expr has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SqlToRel::sql_compound_field_access_to_expr (cognitive 23) datafusion/sql/src/expr/mod.rs:1298 — SqlToRel::sql_compound_field_access_to_expr has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 5 (10 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SqlToRel::try_process_group_by_unnest (cognitive 23) datafusion/sql/src/select.rs:799 — SqlToRel::try_process_group_by_unnest has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 3 (8 pts), match/switch 1 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SqlToRel::explain_to_plan (cognitive 21) datafusion/sql/src/statement.rs:2113 — SqlToRel::explain_to_plan has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • SqlToRel::aggregate (cognitive 19) datafusion/sql/src/select.rs:1223 — SqlToRel::aggregate has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (11 pts), loops 2 (4 pts), match/switch 2 (4 pts) (nesting depth added 5). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • SqlToRel::sql_expr_to_logical_expr_internal (cognitive 18) datafusion/sql/src/expr/mod.rs:387 — SqlToRel::sql_expr_to_logical_expr_internal has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 7 (12 pts), if/else 2 (4 pts), loops 1 (2 pts) (nesting depth added 8). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • SqlToRel::set_statement_to_plan (cognitive 18) datafusion/sql/src/statement.rs:2266 — SqlToRel::set_statement_to_plan has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 4 (9 pts), if/else 4 (8 pts), boolean chains 1 (nesting depth added 9). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • SqlToRel::create_default_relation (cognitive 17) datafusion/sql/src/relation/mod.rs:156 — SqlToRel::create_default_relation has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), match/switch 3 (6 pts) (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • SqlToRel::rewrite_unnest_expr_groups (cognitive 17) datafusion/sql/src/select.rs:650 — SqlToRel::rewrite_unnest_expr_groups has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 4 (8 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SqlToRel::validate_schema_satisfies_exprs (cognitive 16) datafusion/sql/src/planner.rs:604 — SqlToRel::validate_schema_satisfies_exprs has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), match/switch 3 (5 pts) (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D3 · God Classes · TooManyMethods · ×18
  • TooManyMethods: SqlToRel datafusion/sql/src/planner.rs:454 — TooManyMethods — 142 methods, declared across 19 files: src/statement.rs (30), expr/mod.rs (25), src/select.rs (17), src/planner.rs (12), +15 more file(s). The bar is 30 methods; this is 112 over it, 4.73× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. This type is on a published API surface — a cargo-semver-checks gate in CI (.github/workflows/breaking_changes_detector.yml) declares its compatibility contractual — so moving members onto a smaller type is a breaking change for every consumer, not a local refactor. To reduce it, treat the split as an API migration: move each cohesive group onto its own published type and keep the old members as deprecated forwards for a deprecation period, removing them at the next compatibility break. Where the surface has to stay as it is, that is a decision to record rather than a change to make.
  • TooManyMethods: SessionContext datafusion/core/src/execution/context/mod.rs:294 — TooManyMethods — 103 methods, declared across 5 files: context/mod.rs (92), context/csv.rs (3), context/json.rs (3), context/parquet.rs (3), +1 more file(s). The bar is 30 methods; this is 73 over it, 3.43× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. This type is on a published API surface — a cargo-semver-checks gate in CI (.github/workflows/breaking_changes_detector.yml) declares its compatibility contractual — so moving members onto a smaller type is a breaking change for every consumer, not a local refactor. To reduce it, treat the split as an API migration: move each cohesive group onto its own published type and keep the old members as deprecated forwards for a deprecation period, removing them at the next compatibility break. Where the surface has to stay as it is, that is a decision to record rather than a change to make.
  • TooManyMethods: Unparser datafusion/sql/src/unparser/mod.rs:57 — TooManyMethods — 92 methods, declared across 3 files: unparser/plan.rs (55), unparser/expr.rs (34), unparser/mod.rs (3). The bar is 30 methods; this is 62 over it, 3.07× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. This type is on a published API surface — a cargo-semver-checks gate in CI (.github/workflows/breaking_changes_detector.yml) declares its compatibility contractual — so moving members onto a smaller type is a breaking change for every consumer, not a local refactor. To reduce it, treat the split as an API migration: move each cohesive group onto its own published type and keep the old members as deprecated forwards for a deprecation period, removing them at the next compatibility break. Where the surface has to stay as it is, that is a decision to record rather than a change to make.
  • TooManyMethods: ScalarValue datafusion/common/src/scalar/mod.rs:358 — TooManyMethods — 86 methods. The bar is 30 methods; this is 56 over it, 2.87× the bar. This type is on a published API surface — a cargo-semver-checks gate in CI (.github/workflows/breaking_changes_detector.yml) declares its compatibility contractual — so moving members onto a smaller type is a breaking change for every consumer, not a local refactor. To reduce it, treat the split as an API migration: move each cohesive group onto its own published type and keep the old members as deprecated forwards for a deprecation period, removing them at the next compatibility break. Where the surface has to stay as it is, that is a decision to record rather than a change to make.
  • TooManyMethods: DataFrame datafusion/core/src/dataframe/mod.rs:230 — TooManyMethods — 65 methods, declared across 2 files: dataframe/mod.rs (64), dataframe/parquet.rs (1). The bar is 30 methods; this is 35 over it, 2.17× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. This type is on a published API surface — a cargo-semver-checks gate in CI (.github/workflows/breaking_changes_detector.yml) declares its compatibility contractual — so moving members onto a smaller type is a breaking change for every consumer, not a local refactor. To reduce it, treat the split as an API migration: move each cohesive group onto its own published type and keep the old members as deprecated forwards for a deprecation period, removing them at the next compatibility break. Where the surface has to stay as it is, that is a decision to record rather than a change to make.
  • TooManyMethods: SessionState datafusion/core/src/execution/session_state.rs:144 — TooManyMethods — 65 methods. The bar is 30 methods; this is 35 over it, 2.17× the bar. This type is on a published API surface — a cargo-semver-checks gate in CI (.github/workflows/breaking_changes_detector.yml) declares its compatibility contractual — so moving members onto a smaller type is a breaking change for every consumer, not a local refactor. To reduce it, treat the split as an API migration: move each cohesive group onto its own published type and keep the old members as deprecated forwards for a deprecation period, removing them at the next compatibility break. Where the surface has to stay as it is, that is a decision to record rather than a change to make.
  • TooManyMethods: SessionStateBuilder datafusion/core/src/execution/session_state.rs:1138 — TooManyMethods — 65 methods. The bar is 30 methods; this is 35 over it, 2.17× the bar. This type is on a published API surface — a cargo-semver-checks gate in CI (.github/workflows/breaking_changes_detector.yml) declares its compatibility contractual — so moving members onto a smaller type is a breaking change for every consumer, not a local refactor. To reduce it, treat the split as an API migration: move each cohesive group onto its own published type and keep the old members as deprecated forwards for a deprecation period, removing them at the next compatibility break. Where the surface has to stay as it is, that is a decision to record rather than a change to make.
  • TooManyMethods: LogicalPlanBuilder datafusion/expr/src/logical_plan/builder.rs:129 — TooManyMethods — 63 methods. The bar is 30 methods; this is 33 over it, 2.10× the bar. This type is on a published API surface — a cargo-semver-checks gate in CI (.github/workflows/breaking_changes_detector.yml) declares its compatibility contractual — so moving members onto a smaller type is a breaking change for every consumer, not a local refactor. To reduce it, treat the split as an API migration: move each cohesive group onto its own published type and keep the old members as deprecated forwards for a deprecation period, removing them at the next compatibility break. Where the surface has to stay as it is, that is a decision to record rather than a change to make.
  • TooManyMethods: SessionConfig datafusion/execution/src/config.rs:93 — TooManyMethods — 59 methods. The bar is 30 methods; this is 29 over it, 1.97× the bar. This type is on a published API surface — a cargo-semver-checks gate in CI (.github/workflows/breaking_changes_detector.yml) declares its compatibility contractual — so moving members onto a smaller type is a breaking change for every consumer, not a local refactor. To reduce it, treat the split as an API migration: move each cohesive group onto its own published type and keep the old members as deprecated forwards for a deprecation period, removing them at the next compatibility break. Where the surface has to stay as it is, that is a decision to record rather than a change to make.
  • TooManyMethods: Expr datafusion/expr/src/expr.rs:326 — TooManyMethods — 53 methods. The bar is 30 methods; this is 23 over it, 1.77× the bar. This type is on a published API surface — a cargo-semver-checks gate in CI (.github/workflows/breaking_changes_detector.yml) declares its compatibility contractual — so moving members onto a smaller type is a breaking change for every consumer, not a local refactor. To reduce it, treat the split as an API migration: move each cohesive group onto its own published type and keep the old members as deprecated forwards for a deprecation period, removing them at the next compatibility break. Where the surface has to stay as it is, that is a decision to record rather than a change to make.
  • TooManyMethods: DFSchema datafusion/common/src/dfschema.rs:113 — TooManyMethods — 49 methods. The bar is 30 methods; this is 19 over it, 1.63× the bar. This type is on a published API surface — a cargo-semver-checks gate in CI (.github/workflows/breaking_changes_detector.yml) declares its compatibility contractual — so moving members onto a smaller type is a breaking change for every consumer, not a local refactor. To reduce it, treat the split as an API migration: move each cohesive group onto its own published type and keep the old members as deprecated forwards for a deprecation period, removing them at the next compatibility break. Where the surface has to stay as it is, that is a decision to record rather than a change to make.
  • TooManyMethods: LogicalPlan datafusion/expr/src/logical_plan/plan.rs:215 — TooManyMethods — 48 methods, declared across 2 files: logical_plan/plan.rs (35), logical_plan/tree_node.rs (13). The bar is 30 methods; this is 18 over it, 1.60× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. This type is on a published API surface — a cargo-semver-checks gate in CI (.github/workflows/breaking_changes_detector.yml) declares its compatibility contractual — so moving members onto a smaller type is a breaking change for every consumer, not a local refactor. To reduce it, treat the split as an API migration: move each cohesive group onto its own published type and keep the old members as deprecated forwards for a deprecation period, removing them at the next compatibility break. Where the surface has to stay as it is, that is a decision to record rather than a change to make.
  • TooManyMethods: EquivalenceProperties datafusion/physical-expr/src/equivalence/properties/mod.rs:136 — TooManyMethods — 48 methods. The bar is 30 methods; this is 18 over it, 1.60× the bar. This type is on a published API surface — a cargo-semver-checks gate in CI (.github/workflows/breaking_changes_detector.yml) declares its compatibility contractual — so moving members onto a smaller type is a breaking change for every consumer, not a local refactor. To reduce it, treat the split as an API migration: move each cohesive group onto its own published type and keep the old members as deprecated forwards for a deprecation period, removing them at the next compatibility break. Where the surface has to stay as it is, that is a decision to record rather than a change to make.
  • TooManyMethods: MaterializingSortMergeJoinStream datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs:279 — TooManyMethods — 42 methods. The bar is 30 methods; this is 12 over it, 1.40× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: AggregateExec datafusion/physical-plan/src/aggregates/mod.rs:869 — TooManyMethods — 40 methods. The bar is 30 methods; this is 10 over it, 1.33× the bar. This type is on a published API surface — a cargo-semver-checks gate in CI (.github/workflows/breaking_changes_detector.yml) declares its compatibility contractual — so moving members onto a smaller type is a breaking change for every consumer, not a local refactor. To reduce it, treat the split as an API migration: move each cohesive group onto its own published type and keep the old members as deprecated forwards for a deprecation period, removing them at the next compatibility break. Where the surface has to stay as it is, that is a decision to record rather than a change to make.
  • TooManyMethods: Interval datafusion/expr-common/src/interval_arithmetic.rs:178 — TooManyMethods — 35 methods. The bar is 30 methods; this is 5 over it, 1.17× the bar. This type is on a published API surface — a cargo-semver-checks gate in CI (.github/workflows/breaking_changes_detector.yml) declares its compatibility contractual — so moving members onto a smaller type is a breaking change for every consumer, not a local refactor. To reduce it, treat the split as an API migration: move each cohesive group onto its own published type and keep the old members as deprecated forwards for a deprecation period, removing them at the next compatibility break. Where the surface has to stay as it is, that is a decision to record rather than a change to make.
  • TooManyMethods: AggregateUDF datafusion/expr/src/udaf.rs:80 — TooManyMethods — 35 methods. The bar is 30 methods; this is 5 over it, 1.17× the bar. This type is on a published API surface — a cargo-semver-checks gate in CI (.github/workflows/breaking_changes_detector.yml) declares its compatibility contractual — so moving members onto a smaller type is a breaking change for every consumer, not a local refactor. To reduce it, treat the split as an API migration: move each cohesive group onto its own published type and keep the old members as deprecated forwards for a deprecation period, removing them at the next compatibility break. Where the surface has to stay as it is, that is a decision to record rather than a change to make.
  • TooManyMethods: SelectBuilder datafusion/sql/src/unparser/ast.rs:139 — TooManyMethods — 31 methods. The bar is 30 methods; this is 1 over it, 1.03× the bar. This type is on a published API surface — a cargo-semver-checks gate in CI (.github/workflows/breaking_changes_detector.yml) declares its compatibility contractual — so moving members onto a smaller type is a breaking change for every consumer, not a local refactor. To reduce it, treat the split as an API migration: move each cohesive group onto its own published type and keep the old members as deprecated forwards for a deprecation period, removing them at the next compatibility break. Where the surface has to stay as it is, that is a decision to record rather than a change to make.
D15 · Churn × Complexity Hotspots · Repeated repair · ×16
  • Repeated repair: datafusion/functions-aggregate/src/average.rs datafusion/functions-aggregate/src/average.rs:292 — datafusion/functions-aggregate/src/average.rs changed 9 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is Avg::accumulator at line 292), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “Fix panic from `avg(x ORDER BY y)` (and more) (#25711)”; “Fix AvgGroupsAccumulator::size() self-overcount (#25117)”; “fix: Address avg return type overflow for decimals (#24371)”; “chore: fix malformed example tables in aggregate function docs (#24503)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 01:31:20 +00:00' --until='2026-09-29 01:31:20 +00:00' --full-history --no-merges -- datafusion/functions-aggregate/src/average.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: datafusion/functions/src/regex/regexpinstr.rs datafusion/functions/src/regex/regexpinstr.rs:151 — datafusion/functions/src/regex/regexpinstr.rs changed 8 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is datafusion_functions::regex::regexpinstr::regexp_instr_func at line 151), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: apply regexp_instr subexpr to the N-th match, not the first (#24991)”; “fix: report regex compile failures as DataFusion errors, consistently across the regexp family (#25352)”; “fix: Propagate NULLs in `regexp_count`, `regexp_instr` (#24239)”; “chore: fix some scalar function docs (#24134)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 01:31:20 +00:00' --until='2026-09-29 01:31:20 +00:00' --full-history --no-merges -- datafusion/functions/src/regex/regexpinstr.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: datafusion/functions-nested/src/extract.rs datafusion/functions-nested/src/extract.rs:518 — datafusion/functions-nested/src/extract.rs changed 8 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is datafusion_functions_nested::extract::compute_slice_plan at line 518), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “chore: fix the remaining malformed example tables in function docs (#24596)”; “fix: preserve the input list's inner field in array_append/prepend/replace (#24365)”; “fix: correct list field inner type in array functions (#24345)”; “chore: fix some scalar function docs (#24134)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 01:31:20 +00:00' --until='2026-09-29 01:31:20 +00:00' --full-history --no-merges -- datafusion/functions-nested/src/extract.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: datafusion/functions/src/datetime/to_date.rs datafusion/functions/src/datetime/to_date.rs:132 — datafusion/functions/src/datetime/to_date.rs changed 6 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is ToDateFunc::invoke_with_args at line 132), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “chore: fix the remaining malformed example tables in function docs (#24596)”; “chore: fix some scalar function docs (#24134)”; “Fix syntax examples of some functions (#23212)”; “minor(fix): correct to_date results for formatted pre-epoch datetimes (#24049)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 01:31:20 +00:00' --until='2026-09-29 01:31:20 +00:00' --full-history --no-merges -- datafusion/functions/src/datetime/to_date.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: datafusion/functions-aggregate/src/median.rs datafusion/functions-aggregate/src/median.rs:75 — datafusion/functions-aggregate/src/median.rs changed 7 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 1 (its worst body is Median::default at line 75), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “Fix panic from `avg(x ORDER BY y)` (and more) (#25711)”; “chore: fix malformed example tables in aggregate function docs (#24503)”; “fix: support untyped NULL input for median (#24104)”; “Fix memory size accounting for grouped `median` and `avg` (#23357)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 01:31:20 +00:00' --until='2026-09-29 01:31:20 +00:00' --full-history --no-merges -- datafusion/functions-aggregate/src/median.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: datafusion/physical-expr/src/projection.rs datafusion/physical-expr/src/projection.rs:1292 — datafusion/physical-expr/src/projection.rs changed 7 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is ProjectionMapping::try_new at line 1292), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: preserve statistics for safe casts without extrema (#25517)”; “fix: only propagate cast statistics through safe conversions (#25227)”; “fix: preserve projection field metadata during physical planning (#23981)”; “fix: do not derive ordering for arithmetic that can overflow (#23910)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 01:31:20 +00:00' --until='2026-09-29 01:31:20 +00:00' --full-history --no-merges -- datafusion/physical-expr/src/projection.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: datafusion/functions-table/src/generate_series.rs datafusion/functions-table/src/generate_series.rs:789 — datafusion/functions-table/src/generate_series.rs changed 6 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is GenerateSeriesFuncImpl::call_date at line 789), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: reject mixed-sign intervals in range functions (#25520)”; “fix: accept all timestamp precisions in `generate_series`/`range` (#25173)”; “fix(proto): check plan integer conversions across usize boundaries (#24483)”; “fix: generate_series overflow panics at i64 boundary and out-of-range dates (#23723)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 01:31:20 +00:00' --until='2026-09-29 01:31:20 +00:00' --full-history --no-merges -- datafusion/functions-table/src/generate_series.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: datafusion/physical-plan/src/joins/sort_merge_join/bitwise_stream.rs datafusion/physical-plan/src/joins/sort_merge_join/bitwise_stream.rs:715 — datafusion/physical-plan/src/joins/sort_merge_join/bitwise_stream.rs changed 5 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is BitwiseSortMergeJoinStream::process_key_match_with_filter at line 715), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: end a sort-merge join partition once its streamed side is exhausted, and release its reservations before the final output (#25206)”; “fix(smj): handle floating-point keys across batch boundaries (#25134)”; “fix: drain completed sort-merge join output before awaiting input (#24685)”; “fix: keep every spilled slice of a sort-merge join inner key group (#24056)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 01:31:20 +00:00' --until='2026-09-29 01:31:20 +00:00' --full-history --no-merges -- datafusion/physical-plan/src/joins/sort_merge_join/bitwise_stream.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: datafusion/functions/src/regex/regexplike.rs datafusion/functions/src/regex/regexplike.rs:442 — datafusion/functions/src/regex/regexplike.rs changed 4 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is datafusion_functions::regex::regexplike::handle_regexp_like at line 442), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: report regex compile failures as DataFusion errors, consistently across the regexp family (#25352)”; “fix: accept empty flags in regexp_like and regexp_match (#25046)”; “fix(optimizer): bound planning-time regex compilation (#24917)”; “chore: fix some scalar function docs (#24134)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 01:31:20 +00:00' --until='2026-09-29 01:31:20 +00:00' --full-history --no-merges -- datafusion/functions/src/regex/regexplike.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs:613 — datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is MaterializingSortMergeJoinStream::join at line 613), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: end a sort-merge join partition once its streamed side is exhausted, and release its reservations before the final output (#25206)”; “fix: sort-merge join filter columns follow the filter's own column order (#25489)”; “fix: ensure deferred-filtered outer joins preserve streamed output order (#24573)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 01:31:20 +00:00' --until='2026-09-29 01:31:20 +00:00' --full-history --no-merges -- datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: datafusion/common/src/file_options/parquet_writer.rs datafusion/common/src/file_options/parquet_writer.rs:297 — datafusion/common/src/file_options/parquet_writer.rs changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is datafusion_common::file_options::parquet_writer::parse_encoding_string at line 297), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: validate parquet.compression when it is set (#25626)”; “fix: validate parquet statistics config (#24642)”; “test: Fix data_pagesize_limit extraction in parquet writer props roundtrip test (#23664)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 01:31:20 +00:00' --until='2026-09-29 01:31:20 +00:00' --full-history --no-merges -- datafusion/common/src/file_options/parquet_writer.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: datafusion/functions/src/regex/regexpreplace.rs datafusion/functions/src/regex/regexpreplace.rs:332 — datafusion/functions/src/regex/regexpreplace.rs changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is datafusion_functions::regex::regexpreplace::regexp_replace at line 332), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: report regex compile failures as DataFusion errors, consistently across the regexp family (#25352)”; “fix: accept an empty flags string in regexp_replace (#24987)”; “chore: fix some scalar function docs (#24134)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 01:31:20 +00:00' --until='2026-09-29 01:31:20 +00:00' --full-history --no-merges -- datafusion/functions/src/regex/regexpreplace.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: datafusion/physical-expr/src/expressions/binary/kernels.rs datafusion/physical-expr/src/expressions/binary/kernels.rs:85 — datafusion/physical-expr/src/expressions/binary/kernels.rs changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is datafusion_physical_expr::expressions::binary::kernels::bitwise_or_dyn at line 85), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: report regex compile failures as DataFusion errors, consistently across the regexp family (#25352)”; “fix: preserve dictionary-value nulls in scalar regex operators (#23966)”; “fix: coerce SIMILAR TO operands to a common string type (#23704)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 01:31:20 +00:00' --until='2026-09-29 01:31:20 +00:00' --full-history --no-merges -- datafusion/physical-expr/src/expressions/binary/kernels.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: datafusion/functions/src/regex/regexpmatch.rs datafusion/functions/src/regex/regexpmatch.rs:162 — datafusion/functions/src/regex/regexpmatch.rs changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is datafusion_functions::regex::regexpmatch::regexp_match_scalar_pattern at line 162), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: report regex compile failures as DataFusion errors, consistently across the regexp family (#25352)”; “fix: accept empty flags in regexp_like and regexp_match (#25046)”; “chore: fix some scalar function docs (#24134)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 01:31:20 +00:00' --until='2026-09-29 01:31:20 +00:00' --full-history --no-merges -- datafusion/functions/src/regex/regexpmatch.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: datafusion/sqllogictest/src/engines/conversion.rs datafusion/sqllogictest/src/engines/conversion.rs:50 — datafusion/sqllogictest/src/engines/conversion.rs changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 4 (its worst body is datafusion_sqllogictest::engines::conversion::float_to_str at line 50), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “Fix Postgres decimal formatter clippy (#24975)”; “fix: keep decimal precision for SLT tests (#24934)”; “fix: Handle decimal columns consistently in SLT tests (#23161)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 01:31:20 +00:00' --until='2026-09-29 01:31:20 +00:00' --full-history --no-merges -- datafusion/sqllogictest/src/engines/conversion.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: datafusion/common/src/stats.rs datafusion/common/src/stats.rs:555 — datafusion/common/src/stats.rs changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is Statistics::with_fetch at line 555), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: ignore exact empty files in ordering analysis (#24648)”; “fix: preserve total_byte_size in calculate_total_byte_size when num_r… (#24027)”; “fix(common): preserve an exact zero through filter selectivity estimation (#23936)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 01:31:20 +00:00' --until='2026-09-29 01:31:20 +00:00' --full-history --no-merges -- datafusion/common/src/stats.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
D2 · Cognitive Complexity · datafusion_optimizer · ×16
  • datafusion_optimizer::decorrelate_lateral_join::rewrite_internal (cognitive 37) datafusion/optimizer/src/decorrelate_lateral_join.rs:76 — datafusion_optimizer::decorrelate_lateral_join::rewrite_internal has cognitive complexity 37 (threshold 15). Drivers by points: if/else 23 (29 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • datafusion_optimizer::optimize_projections::optimize_projections (cognitive 34) datafusion/optimizer/src/optimize_projections/mod.rs:127 — datafusion_optimizer::optimize_projections::optimize_projections has cognitive complexity 34 (threshold 15). Drivers by points: if/else 16 (25 pts), match/switch 4 (6 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_optimizer::extract_leaf_expressions::build_extraction_projection_impl (cognitive 32) datafusion/optimizer/src/extract_leaf_expressions.rs:651 — datafusion_optimizer::extract_leaf_expressions::build_extraction_projection_impl has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (22 pts), loops 4 (8 pts), boolean chains 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_optimizer::extract_leaf_expressions::split_and_push_projection (cognitive 32) datafusion/optimizer/src/extract_leaf_expressions.rs:931 — datafusion_optimizer::extract_leaf_expressions::split_and_push_projection has cognitive complexity 32 (threshold 15). Drivers by points: if/else 15 (23 pts), loops 2 (4 pts), boolean chains 3, match/switch 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_optimizer::simplify_expressions::simplify_predicates::find_most_restrictive_predicate (cognitive 30) datafusion/optimizer/src/simplify_expressions/simplify_predicates.rs:326 — datafusion_optimizer::simplify_expressions::simplify_predicates::find_most_restrictive_predicate has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (22 pts), boolean chains 4, match/switch 1 (3 pts), loops 1 (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • datafusion_optimizer::push_down_filter::push_down_all_join (cognitive 29) datafusion/optimizer/src/push_down_filter.rs:398 — datafusion_optimizer::push_down_filter::push_down_all_join has cognitive complexity 29 (threshold 15). Drivers by points: if/else 17 (20 pts), boolean chains 6, loops 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • datafusion_optimizer::push_down_limit::topk_through_join::push_topk_through_join (cognitive 26) datafusion/optimizer/src/push_down_limit/topk_through_join.rs:92 — datafusion_optimizer::push_down_limit::topk_through_join::push_topk_through_join has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (12 pts), match/switch 8 (11 pts), loops 3 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • datafusion_optimizer::extract_leaf_expressions::try_push_into_inputs (cognitive 25) datafusion/optimizer/src/extract_leaf_expressions.rs:1300 — datafusion_optimizer::extract_leaf_expressions::try_push_into_inputs has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 3 (5 pts), match/switch 1 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_optimizer::push_down_limit::rewrite_limit (cognitive 22) datafusion/optimizer/src/push_down_limit.rs:93 — datafusion_optimizer::push_down_limit::rewrite_limit has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14 (21 pts), match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_optimizer::single_distinct_to_groupby::is_single_distinct_agg (cognitive 22) datafusion/optimizer/src/single_distinct_to_groupby.rs:124 — datafusion_optimizer::single_distinct_to_groupby::is_single_distinct_agg has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 2 (5 pts), boolean chains 4 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_optimizer::simplify_expressions::linear_aggregates::rewrite_multiple_linear_aggregates (cognitive 20) datafusion/optimizer/src/simplify_expressions/linear_aggregates.rs:55 — datafusion_optimizer::simplify_expressions::linear_aggregates::rewrite_multiple_linear_aggregates has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_optimizer::simplify_expressions::regex::anchored_alternation_to_exprs (cognitive 20) datafusion/optimizer/src/simplify_expressions/regex.rs:302 — datafusion_optimizer::simplify_expressions::regex::anchored_alternation_to_exprs has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_optimizer::push_down_filter::infer_join_predicates_impl (cognitive 18) datafusion/optimizer/src/push_down_filter.rs:753 — datafusion_optimizer::push_down_filter::infer_join_predicates_impl has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (10 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_optimizer::decorrelate::filter_exprs_evaluation_result_on_empty_batch (cognitive 17) datafusion/optimizer/src/decorrelate.rs:735 — datafusion_optimizer::decorrelate::filter_exprs_evaluation_result_on_empty_batch has cognitive complexity 17 (threshold 15). Drivers by points: loops 3 (8 pts), if/else 6 (7 pts), match/switch 1 (2 pts) (nesting depth added 7). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • datafusion_optimizer::analyzer::type_coercion::coerce_window_frame (cognitive 17) datafusion/optimizer/src/analyzer/type_coercion.rs:1199 — datafusion_optimizer::analyzer::type_coercion::coerce_window_frame has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), match/switch 2 (4 pts), boolean chains 3 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • datafusion_optimizer::decorrelate_predicate_subquery::build_join (cognitive 16) datafusion/optimizer/src/decorrelate_predicate_subquery.rs:525 — datafusion_optimizer::decorrelate_predicate_subquery::build_join has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 2, loops 1 (2 pts), match/switch 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D4 · Code Duplication · Duplicated block (15 lines × 2) · ×16
  • Duplicated block (15 lines × 2) REDACTED:1399 — REDACTED:1399-1413 | REDACTED:1414-1428 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) datafusion/expr/src/logical_plan/builder.rs:2097 — datafusion/expr/src/logical_plan/builder.rs:2097-2111 | datafusion/expr/src/logical_plan/builder.rs:2119-2133 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) datafusion/ffi/src/proto/logical_extension_codec.rs:328 — datafusion/ffi/src/proto/logical_extension_codec.rs:328-342 | datafusion/ffi/src/proto/physical_extension_codec.rs:314-328 — before extracting anything, compare `datafusion/ffi/src/proto/logical_extension_codec.rs` and `datafusion/ffi/src/proto/physical_extension_codec.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 118 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (15 lines × 2) datafusion/functions/src/math/ceil.rs:138 — datafusion/functions/src/math/ceil.rs:138-152 | datafusion/functions/src/math/floor.rs:184-198 — before extracting anything, compare `datafusion/functions/src/math/ceil.rs` and `datafusion/functions/src/math/floor.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (15 lines × 2) datafusion/functions-aggregate/src/first_last.rs:1027 — datafusion/functions-aggregate/src/first_last.rs:1027-1041 | datafusion/functions-aggregate/src/first_last.rs:1422-1436 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) datafusion/functions-aggregate/src/min_max.rs:860 — datafusion/functions-aggregate/src/min_max.rs:860-874 | datafusion/functions-aggregate/src/min_max.rs:988-1002 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) datafusion/functions-aggregate/src/nth_value.rs:248 — datafusion/functions-aggregate/src/nth_value.rs:248-262 | datafusion/functions-aggregate/src/nth_value.rs:423-437 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) datafusion/functions-nested/src/remove.rs:479 — datafusion/functions-nested/src/remove.rs:479-493 | datafusion/functions-nested/src/replace.rs:461-475 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (15 lines × 2) datafusion/functions-nested/src/replace.rs:95 — datafusion/functions-nested/src/replace.rs:95-109 | datafusion/functions-nested/src/replace.rs:321-335 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) datafusion/physical-expr/src/expressions/case.rs:883 — datafusion/physical-expr/src/expressions/case.rs:883-897 | datafusion/physical-expr/src/expressions/case.rs:970-984 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) datafusion/physical-plan/src/aggregates/aggregate_hash_table/common.rs:218 — datafusion/physical-plan/src/aggregates/aggregate_hash_table/common.rs:218-232 | datafusion/physical-plan/src/aggregates/aggregate_hash_table/common_ordered.rs:263-277 — before extracting anything, compare `datafusion/physical-plan/src/aggregates/aggregate_hash_table/common.rs` and `datafusion/physical-plan/src/aggregates/aggregate_hash_table/common_ordered.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 30 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (15 lines × 2) datafusion/physical-plan/src/aggregates/group_values/multi_group_by/boolean.rs:117 — datafusion/physical-plan/src/aggregates/group_values/multi_group_by/boolean.rs:117-131 | datafusion/physical-plan/src/aggregates/group_values/multi_group_by/primitive.rs:211-225 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (15 lines × 2) datafusion/physical-plan/src/coop.rs:383 — datafusion/physical-plan/src/coop.rs:383-397 | datafusion/physical-plan/src/projection.rs:609-623 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (15 lines × 2) datafusion/physical-plan/src/joins/hash_join/exec.rs:1925 — datafusion/physical-plan/src/joins/hash_join/exec.rs:1925-1939 | datafusion/physical-plan/src/joins/symmetric_hash_join.rs:631-645 — before extracting anything, compare `datafusion/physical-plan/src/joins/hash_join/exec.rs` and `datafusion/physical-plan/src/joins/symmetric_hash_join.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (15 lines × 2) datafusion/physical-plan/src/sorts/partial_sort.rs:332 — datafusion/physical-plan/src/sorts/partial_sort.rs:332-346 | datafusion/physical-plan/src/sorts/sort.rs:1317-1331 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (15 lines × 2) datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs:330 — datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs:330-344 | datafusion/physical-plan/src/windows/window_agg_exec.rs:151-165 — before extracting anything, compare `datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs` and `datafusion/physical-plan/src/windows/window_agg_exec.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 61 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D2 · Cognitive Complexity · datafusion_functions_nested · ×15
  • datafusion_functions_nested::string::compute_array_to_string (cognitive 47) datafusion/functions-nested/src/string.rs:592 — datafusion_functions_nested::string::compute_array_to_string has cognitive complexity 47 (threshold 15). Drivers by points: if/else 18 (37 pts), loops 4 (7 pts), match/switch 2 (3 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_functions_nested::set_ops::generic_set_loop (cognitive 41) datafusion/functions-nested/src/set_ops.rs:404 — datafusion_functions_nested::set_ops::generic_set_loop has cognitive complexity 41 (threshold 15). Drivers by points: if/else 13 (26 pts), loops 5 (13 pts), boolean chains 2 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_functions_nested::arrays_zip::try_perfect_list_zip (cognitive 36) datafusion/functions-nested/src/arrays_zip.rs:347 — datafusion_functions_nested::arrays_zip::try_perfect_list_zip has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (24 pts), loops 4 (9 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 20). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • datafusion_functions_nested::arrays_zip::arrays_zip_inner (cognitive 30) datafusion/functions-nested/src/arrays_zip.rs:161 — datafusion_functions_nested::arrays_zip::arrays_zip_inner has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 4 (6 pts), match/switch 3 (6 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_functions_nested::replace::general_replace (cognitive 29) datafusion/functions-nested/src/replace.rs:435 — datafusion_functions_nested::replace::general_replace has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (23 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_functions_nested::string::string_to_array_scalar_args (cognitive 29) datafusion/functions-nested/src/string.rs:337 — datafusion_functions_nested::string::string_to_array_scalar_args has cognitive complexity 29 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 5 (13 pts), match/switch 1 (nesting depth added 18). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • datafusion_functions_nested::remove::general_remove (cognitive 25) datafusion/functions-nested/src/remove.rs:452 — datafusion_functions_nested::remove::general_remove has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_functions_nested::cosine_distance::general_cosine_distance (cognitive 24) datafusion/functions-nested/src/cosine_distance.rs:161 — datafusion_functions_nested::cosine_distance::general_cosine_distance has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 6, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_functions_nested::range::generate_range_values (cognitive 22) datafusion/functions-nested/src/range.rs:572 — datafusion_functions_nested::range::generate_range_values has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 2 (4 pts), match/switch 2 (4 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_functions_nested::resize::general_list_resize (cognitive 21) datafusion/functions-nested/src/resize.rs:200 — datafusion_functions_nested::resize::general_list_resize has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 5, loops 2 (3 pts), match/switch 2 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_functions_nested::array_normalize::general_array_normalize (cognitive 21) datafusion/functions-nested/src/array_normalize.rs:143 — datafusion_functions_nested::array_normalize::general_array_normalize has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 3 (6 pts), match/switch 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_functions_nested::extract::compute_slice_plan (cognitive 18) datafusion/functions-nested/src/extract.rs:518 — datafusion_functions_nested::extract::compute_slice_plan has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (9 pts), loops 2 (5 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • datafusion_functions_nested::position::array_position_scalar (cognitive 18) datafusion/functions-nested/src/position.rs:241 — datafusion_functions_nested::position::array_position_scalar has cognitive complexity 18 (threshold 15). Drivers by points: loops 4 (9 pts), if/else 5 (8 pts), boolean chains 1 (nesting depth added 8). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • datafusion_functions_nested::string::string_to_array_column_args (cognitive 18) datafusion/functions-nested/src/string.rs:448 — datafusion_functions_nested::string::string_to_array_column_args has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 3 (8 pts), match/switch 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_functions_nested::remove::general_remove_with_scalar (cognitive 17) datafusion/functions-nested/src/remove.rs:560 — datafusion_functions_nested::remove::general_remove_with_scalar has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · datafusion_common · ×14
  • datafusion_common::hash_utils::hash_dictionary_scatter (cognitive 29) datafusion/common/src/hash_utils.rs:530 — datafusion_common::hash_utils::hash_dictionary_scatter has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (23 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • datafusion_common::nested_struct::compact_list_view_values (cognitive 20) datafusion/common/src/nested_struct.rs:398 — datafusion_common::nested_struct::compact_list_view_values has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 5, loops 4 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_common::error::closest_valid_field (cognitive 19) datafusion/common/src/error.rs:228 — datafusion_common::error::closest_valid_field has cognitive complexity 19 (threshold 15). Drivers by points: if/else 2 (8 pts), loops 3 (6 pts), boolean chains 5 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_common::nested_struct::validate_map_key_data_type (cognitive 19) datafusion/common/src/nested_struct.rs:850 — datafusion_common::nested_struct::validate_map_key_data_type has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (4 pts), boolean chains 2, match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_common::utils::normalize_float_zero (cognitive 18) datafusion/common/src/utils/mod.rs:1449 — datafusion_common::utils::normalize_float_zero has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (17 pts), match/switch 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • datafusion_common::utils::truncate_list_nulls (cognitive 17) datafusion/common/src/utils/mod.rs:1310 — datafusion_common::utils::truncate_list_nulls has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 1 (3 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_common::hash_utils::build_hasher::hash_array_primitive_with_hasher (cognitive 16) datafusion/common/src/hash_utils/build_hasher.rs:205 — datafusion_common::hash_utils::build_hasher::hash_array_primitive_with_hasher has cognitive complexity 16 (threshold 15). Drivers by points: loops 4 (10 pts), if/else 5 (6 pts) (nesting depth added 7). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline. This shape REPEATS in the file: one other method here (datafusion_common::hash_utils::build_hasher::hash_array_with_hasher) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • datafusion_common::hash_utils::build_hasher::hash_array_with_hasher (cognitive 16) datafusion/common/src/hash_utils/build_hasher.rs:247 — datafusion_common::hash_utils::build_hasher::hash_array_with_hasher has cognitive complexity 16 (threshold 15). Drivers by points: loops 4 (10 pts), if/else 5 (6 pts) (nesting depth added 7). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline. This shape REPEATS in the file: one other method here (datafusion_common::hash_utils::build_hasher::hash_array_primitive_with_hasher) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • datafusion_common::hash_utils::hash_array_primitive (cognitive 16) datafusion/common/src/hash_utils.rs:308 — datafusion_common::hash_utils::hash_array_primitive has cognitive complexity 16 (threshold 15). Drivers by points: loops 4 (10 pts), if/else 5 (6 pts) (nesting depth added 7). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline. This shape REPEATS in the file: one other method here (datafusion_common::hash_utils::hash_array) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • datafusion_common::hash_utils::hash_array (cognitive 16) datafusion/common/src/hash_utils.rs:353 — datafusion_common::hash_utils::hash_array has cognitive complexity 16 (threshold 15). Drivers by points: loops 4 (10 pts), if/else 5 (6 pts) (nesting depth added 7). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline. This shape REPEATS in the file: one other method here (datafusion_common::hash_utils::hash_array_primitive) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • datafusion_common::hash_utils::hash_map_array (cognitive 16) datafusion/common/src/hash_utils.rs:685 — datafusion_common::hash_utils::hash_map_array has cognitive complexity 16 (threshold 15). Drivers by points: loops 4 (11 pts), if/else 3 (5 pts) (nesting depth added 9). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline. This shape REPEATS in the file: 3 other methods here (datafusion_common::hash_utils::hash_list_array, datafusion_common::hash_utils::hash_list_view_array, datafusion_common::hash_utils::hash_fixed_list_array) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • datafusion_common::hash_utils::hash_list_array (cognitive 16) datafusion/common/src/hash_utils.rs:734 — datafusion_common::hash_utils::hash_list_array has cognitive complexity 16 (threshold 15). Drivers by points: loops 4 (11 pts), if/else 3 (5 pts) (nesting depth added 9). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline. This shape REPEATS in the file: 3 other methods here (datafusion_common::hash_utils::hash_map_array, datafusion_common::hash_utils::hash_list_view_array, datafusion_common::hash_utils::hash_fixed_list_array) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • datafusion_common::hash_utils::hash_list_view_array (cognitive 16) datafusion/common/src/hash_utils.rs:780 — datafusion_common::hash_utils::hash_list_view_array has cognitive complexity 16 (threshold 15). Drivers by points: loops 4 (11 pts), if/else 3 (5 pts) (nesting depth added 9). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline. This shape REPEATS in the file: 3 other methods here (datafusion_common::hash_utils::hash_map_array, datafusion_common::hash_utils::hash_list_array, datafusion_common::hash_utils::hash_fixed_list_array) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • datafusion_common::hash_utils::hash_fixed_list_array (cognitive 16) datafusion/common/src/hash_utils.rs:947 — datafusion_common::hash_utils::hash_fixed_list_array has cognitive complexity 16 (threshold 15). Drivers by points: loops 4 (11 pts), if/else 3 (5 pts) (nesting depth added 9). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline. This shape REPEATS in the file: 3 other methods here (datafusion_common::hash_utils::hash_map_array, datafusion_common::hash_utils::hash_list_array, datafusion_common::hash_utils::hash_list_view_array) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D4 · Code Duplication · Duplicated block (16 lines × 2) · ×13
  • Duplicated block (16 lines × 2) datafusion/expr/src/udaf.rs:1164 — datafusion/expr/src/udaf.rs:1164-1179 | datafusion/expr/src/udaf.rs:1353-1368 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) datafusion/functions/src/binaries.rs:205 — datafusion/functions/src/binaries.rs:205-220 | datafusion/functions/src/strings.rs:256-271 — before extracting anything, compare `datafusion/functions/src/binaries.rs` and `datafusion/functions/src/strings.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (16 lines × 2) datafusion/functions/src/regex/regexpcount.rs:456 — datafusion/functions/src/regex/regexpcount.rs:456-471 | datafusion/functions/src/regex/regexpcount.rs:492-507 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) datafusion/functions/src/unicode/lpad.rs:391 — datafusion/functions/src/unicode/lpad.rs:391-406 | datafusion/functions/src/unicode/lpad.rs:463-478 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) datafusion/functions/src/unicode/lpad.rs:449 — datafusion/functions/src/unicode/lpad.rs:449-464 | datafusion/functions/src/unicode/rpad.rs:450-465 — before extracting anything, compare `datafusion/functions/src/unicode/lpad.rs` and `datafusion/functions/src/unicode/rpad.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 229 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (16 lines × 2) datafusion/functions/src/unicode/rpad.rs:390 — datafusion/functions/src/unicode/rpad.rs:390-405 | datafusion/functions/src/unicode/rpad.rs:464-479 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) datafusion/functions-aggregate-common/src/aggregate/count_distinct/bytes.rs:80 — datafusion/functions-aggregate-common/src/aggregate/count_distinct/bytes.rs:80-95 | datafusion/functions-aggregate-common/src/aggregate/count_distinct/bytes.rs:143-158 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) datafusion/functions-nested/src/reverse.rs:173 — datafusion/functions-nested/src/reverse.rs:173-188 | datafusion/functions-nested/src/reverse.rs:240-255 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) datafusion/optimizer/src/analyzer/function_rewrite.rs:51 — datafusion/optimizer/src/analyzer/function_rewrite.rs:51-66 | datafusion/optimizer/src/analyzer/type_coercion.rs:122-137 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (16 lines × 2) datafusion/physical-plan/src/aggregates/ordered_single_stream.rs:464 — datafusion/physical-plan/src/aggregates/ordered_single_stream.rs:464-479 | datafusion/physical-plan/src/aggregates/single_stream.rs:496-511 — before extracting anything, compare `datafusion/physical-plan/src/aggregates/ordered_single_stream.rs` and `datafusion/physical-plan/src/aggregates/single_stream.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 101 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (16 lines × 2) datafusion/proto/src/logical_plan/mod.rs:708 — datafusion/proto/src/logical_plan/mod.rs:708-723 | datafusion/proto/src/logical_plan/mod.rs:1335-1350 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) datafusion/spark/src/function/string/is_valid_utf8.rs:49 — datafusion/spark/src/function/string/is_valid_utf8.rs:49-64 | datafusion/spark/src/function/string/make_valid_utf8.rs:46-61 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (16 lines × 2) datafusion/physical-plan/src/aggregates/hash_stream.rs:600 — datafusion/physical-plan/src/aggregates/hash_stream.rs:600-615 | datafusion/physical-plan/src/aggregates/single_stream.rs:202-217 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D2 · Cognitive Complexity · datafusion_spark · ×12
  • datafusion_spark::function::math::width_bucket::width_bucket_interval_mdn_exact (cognitive 73) datafusion/spark/src/function/math/width_bucket.rs:300 — datafusion_spark::function::math::width_bucket::width_bucket_interval_mdn_exact has cognitive complexity 73 (threshold 15). Drivers by points: if/else 23 (68 pts), boolean chains 4, loops 1 (nesting depth added 45). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_spark::function::map::str_to_map::str_to_map_impl (cognitive 38) datafusion/spark/src/function/map/str_to_map.rs:196 — datafusion_spark::function::map::str_to_map::str_to_map_impl has cognitive complexity 38 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 4 (10 pts), match/switch 3 (9 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_spark::function::url::url_decode::spark_handled_url_decode (cognitive 37) datafusion/spark/src/function/url/url_decode.rs:191 — datafusion_spark::function::url::url_decode::spark_handled_url_decode has cognitive complexity 37 (threshold 15). Drivers by points: match/switch 9 (18 pts), if/else 5 (12 pts), loops 4 (7 pts) (nesting depth added 19). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • datafusion_spark::function::math::round::spark_round (cognitive 36) datafusion/spark/src/function/math/round.rs:421 — datafusion_spark::function::math::round::spark_round has cognitive complexity 36 (threshold 15). Drivers by points: if/else 16 (30 pts), match/switch 3 (5 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_spark::function::math::abs::spark_abs (cognitive 30) datafusion/spark/src/function/math/abs.rs:133 — datafusion_spark::function::math::abs::spark_abs has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (25 pts), match/switch 3 (5 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_spark::function::collection::size::spark_size_inner (cognitive 29) datafusion/spark/src/function/collection/size.rs:86 — datafusion_spark::function::collection::size::spark_size_inner has cognitive complexity 29 (threshold 15). Drivers by points: if/else 16 (28 pts), match/switch 1 (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • datafusion_spark::function::json::json_tuple::json_tuple_inner (cognitive 23) datafusion/spark/src/function/json/json_tuple.rs:111 — datafusion_spark::function::json::json_tuple::json_tuple_inner has cognitive complexity 23 (threshold 15). Drivers by points: loops 4 (10 pts), match/switch 3 (7 pts), if/else 2 (6 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_spark::function::math::negative::spark_negative (cognitive 21) datafusion/spark/src/function/math/negative.rs:182 — datafusion_spark::function::math::negative::spark_negative has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (16 pts), match/switch 3 (5 pts) (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • datafusion_spark::function::map::utils::map_deduplicate_keys (cognitive 20) datafusion/spark/src/function/map/utils.rs:161 — datafusion_spark::function::map::utils::map_deduplicate_keys has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_spark::function::string::format_string::take_conversion_specifier (cognitive 18) datafusion/spark/src/function/string/format_string.rs:727 — datafusion_spark::function::string::format_string::take_conversion_specifier has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (14 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_spark::function::string::encode::encode_string (cognitive 17) datafusion/spark/src/function/string/encode.rs:79 — datafusion_spark::function::string::encode::encode_string has cognitive complexity 17 (threshold 15). Drivers by points: loops 5 (10 pts), if/else 4 (6 pts), match/switch 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • datafusion_spark::function::conversion::cast::float_secs_to_micros (cognitive 17) datafusion/spark/src/function/conversion/cast.rs:48 — datafusion_spark::function::conversion::cast::float_secs_to_micros has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) · ×12
  • Members sharing a duplicated core (4 members, 50+ identical tokens) datafusion/common/src/scalar/mod.rs:4456 — datafusion/common/src/scalar/mod.rs:4456-4467 | datafusion/common/src/scalar/mod.rs:4475-4486 | datafusion/common/src/scalar/mod.rs:4494-4505 | datafusion/common/src/scalar/mod.rs:4513-4524 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) datafusion/core/src/execution/session_state.rs:2295 — datafusion/core/src/execution/session_state.rs:2295-2301 | datafusion/core/src/execution/session_state.rs:2306-2313 | datafusion/core/src/execution/session_state.rs:2318-2324 | datafusion/core/src/execution/session_state.rs:2329-2335 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) datafusion/core/src/execution/session_state.rs:2340 — datafusion/core/src/execution/session_state.rs:2340-2349 | datafusion/core/src/execution/session_state.rs:2354-2364 | datafusion/core/src/execution/session_state.rs:2369-2378 | datafusion/core/src/execution/session_state.rs:2383-2392 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) datafusion/ffi/src/udaf/accumulator.rs:106 — datafusion/ffi/src/udaf/accumulator.rs:106-118 | datafusion/ffi/src/udaf/accumulator.rs:180-192 | datafusion/ffi/src/udwf/partition_evaluator.rs:113-132 | datafusion/ffi/src/udwf/partition_evaluator.rs:138-157 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) datafusion/functions/src/math/nanvl.rs:69 — datafusion/functions/src/math/nanvl.rs:69-100 | datafusion/functions/src/math/round.rs:184-222 | datafusion/functions/src/math/trunc.rs:80-117 | datafusion/spark/src/function/math/round.rs:60-106 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) datafusion/functions-aggregate/src/covariance.rs:287 — datafusion/functions-aggregate/src/covariance.rs:287-310 | datafusion/functions-aggregate/src/covariance.rs:312-343 | datafusion/functions-aggregate/src/regr.rs:603-628 | datafusion/functions-aggregate/src/regr.rs:634-667 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:215 — datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:215-230 | datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:295-310 | datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:388-403 | datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:482-497 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) datafusion/physical-expr/src/aggregate.rs:743 — datafusion/physical-expr/src/aggregate.rs:743-757 | datafusion/physical-expr/src/aggregate.rs:841-906 | datafusion/physical-expr/src/aggregate.rs:911-924 | datafusion/physical-expr/src/aggregate.rs:931-944 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) datafusion/physical-plan/src/filter.rs:465 — datafusion/physical-plan/src/filter.rs:465-521 | datafusion/physical-plan/src/joins/asof_join.rs:270-306 | datafusion/physical-plan/src/joins/hash_join/exec.rs:1329-1386 | datafusion/physical-plan/src/joins/nested_loop_join.rs:392-449 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) datafusion/physical-plan/src/joins/asof_join.rs:589 — datafusion/physical-plan/src/joins/asof_join.rs:589-663 | datafusion/physical-plan/src/joins/hash_join/exec.rs:2127-2232 | datafusion/physical-plan/src/joins/sort_merge_join/exec.rs:707-789 | datafusion/physical-plan/src/joins/symmetric_hash_join.rs:667-784 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) datafusion/physical-plan/src/topk/mod.rs:359 — datafusion/physical-plan/src/topk/mod.rs:359-392 | datafusion/physical-plan/src/topk/mod.rs:1332-1361 | datafusion/physical-plan/src/topk/mod.rs:1647-1677 | datafusion/physical-plan/src/topk/mod.rs:2142-2174 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) datafusion-cli/src/functions.rs:322 — datafusion-cli/src/functions.rs:322-463 | datafusion-cli/src/functions.rs:510-580 | datafusion-cli/src/functions.rs:627-710 | datafusion-cli/src/functions.rs:776-890 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D1 · Cyclomatic Complexity · ScalarValue · ×11
  • ScalarValue::deserialize (cyclomatic 136) datafusion/proto-common/src/generated/pbjson.rs:8805 — ScalarValue::deserialize has cyclomatic complexity 136 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ScalarValue::eq (cyclomatic 112) datafusion/common/src/scalar/mod.rs:486 — ScalarValue::eq has cyclomatic complexity 112 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ScalarValue::partial_cmp (cyclomatic 110) datafusion/common/src/scalar/mod.rs:621 — ScalarValue::partial_cmp has cyclomatic complexity 110 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ScalarValue::iter_to_array (cyclomatic 87) datafusion/common/src/scalar/mod.rs:2821 — ScalarValue::iter_to_array has cyclomatic complexity 87 (threshold 15). Of this number, 82 points are the body's own statements and 5 belong to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ScalarValue::to_array_of_size (cyclomatic 87) datafusion/common/src/scalar/mod.rs:3463 — ScalarValue::to_array_of_size has cyclomatic complexity 87 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ScalarValue::eq_array (cyclomatic 66) datafusion/common/src/scalar/mod.rs:4553 — ScalarValue::eq_array has cyclomatic complexity 66 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ScalarValue::try_from_array (cyclomatic 65) datafusion/common/src/scalar/mod.rs:4054 — ScalarValue::try_from_array has cyclomatic complexity 65 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ScalarValue::try_from (cyclomatic 64) datafusion/proto-common/src/to_proto/mod.rs:318 — ScalarValue::try_from has cyclomatic complexity 64 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ScalarValue::try_from (cyclomatic 57) datafusion/proto-common/src/from_proto/mod.rs:390 — ScalarValue::try_from has cyclomatic complexity 57 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ScalarValue::fmt (cyclomatic 52) datafusion/common/src/scalar/mod.rs:5579 — ScalarValue::fmt has cyclomatic complexity 52 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: ScalarValue::fmt (cyclomatic 59) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • ScalarValue::distance_u64 (cyclomatic 26) datafusion/common/src/scalar/mod.rs:2669 — ScalarValue::distance_u64 has cyclomatic complexity 26 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: ScalarValue::fmt (cyclomatic 59) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D17 · Explicit Debt · HackComment · ×11
  • HackComment benchmarks/src/imdb/run.rs:47 — // hack to avoid `default_value is meaningless for bool` errors — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment benchmarks/src/tpcds/run.rs:43 — // hack to avoid `default_value is meaningless for bool` errors — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment benchmarks/src/tpch/run.rs:48 — // hack to avoid `default_value is meaningless for bool` errors — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment datafusion/core/tests/fuzz_cases/sort_query_fuzz.rs:322 — /// Hack: If we want the query to run under certain degree of parallelism, the — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment datafusion/functions/src/unicode/substr.rs:243 — // HACK: can be simplified if function has specialized — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment datafusion/physical-plan/src/aggregates/ordered_final_stream.rs:120 — // HACK: Technically, fully ordered aggregate is a non-spillable — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment datafusion/physical-plan/src/aggregates/mod.rs:1918 — // HACK: Should check the function type more precisely — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment datafusion/physical-plan/src/joins/nested_loop_join.rs:3080 — // HACK for the doc test in https://github.com/apache/datafusion/blob/main/datafusion/core/src/dataframe/mod.rs#L1265 — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment datafusion/physical-plan/src/joins/nested_loop_join.rs:3920 — // Hack: If the left schema is not nullable, the full join result — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment datafusion/physical-plan/src/joins/nested_loop_join.rs:4000 — // Hack to deal with the borrow checker — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment datafusion/sqllogictest/src/engines/postgres_engine/mod.rs:173 — // Hacky way to find the 'filename' in the statement — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
D2 · Cognitive Complexity · datafusion_physical_optimizer · ×11
  • datafusion_physical_optimizer::ensure_requirements::enforce_distribution::ensure_distribution_with_stats (cognitive 66) datafusion/physical-optimizer/src/ensure_requirements/enforce_distribution.rs:1363 — datafusion_physical_optimizer::ensure_requirements::enforce_distribution::ensure_distribution_with_stats has cognitive complexity 66 (threshold 15). Drivers by points: if/else 21 (36 pts), boolean chains 20, match/switch 4 (10 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_physical_optimizer::ensure_requirements::enforce_distribution::enforce_distribution_relationships (cognitive 63) datafusion/physical-optimizer/src/ensure_requirements/enforce_distribution.rs:1122 — datafusion_physical_optimizer::ensure_requirements::enforce_distribution::enforce_distribution_relationships has cognitive complexity 63 (threshold 15). Drivers by points: if/else 19 (44 pts), match/switch 3 (9 pts), boolean chains 5, loops 3 (5 pts) (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_physical_optimizer::ensure_requirements::enforce_sorting::sort_pushdown::pushdown_requirement_to_children (cognitive 44) datafusion/physical-optimizer/src/ensure_requirements/enforce_sorting/sort_pushdown.rs:454 — datafusion_physical_optimizer::ensure_requirements::enforce_sorting::sort_pushdown::pushdown_requirement_to_children has cognitive complexity 44 (threshold 15). Drivers by points: if/else 23 (33 pts), match/switch 3 (7 pts), boolean chains 4 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_physical_optimizer::ensure_requirements::enforce_sorting::sort_pushdown::pushdown_sorts_helper (cognitive 39) datafusion/physical-optimizer/src/ensure_requirements/enforce_sorting/sort_pushdown.rs:240 — datafusion_physical_optimizer::ensure_requirements::enforce_sorting::sort_pushdown::pushdown_sorts_helper has cognitive complexity 39 (threshold 15). Drivers by points: if/else 21 (31 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_physical_optimizer::ensure_requirements::enforce_sorting::sort_pushdown::expr_source_side (cognitive 39) datafusion/physical-optimizer/src/ensure_requirements/enforce_sorting/sort_pushdown.rs:894 — datafusion_physical_optimizer::ensure_requirements::enforce_sorting::sort_pushdown::expr_source_side has cognitive complexity 39 (threshold 15). Drivers by points: if/else 9 (26 pts), loops 3 (11 pts), boolean chains 1, match/switch 1 (nesting depth added 25). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • datafusion_physical_optimizer::limit_pushdown::pushdown_limit_helper (cognitive 38) datafusion/physical-optimizer/src/limit_pushdown.rs:148 — datafusion_physical_optimizer::limit_pushdown::pushdown_limit_helper has cognitive complexity 38 (threshold 15). Drivers by points: if/else 22 (36 pts), boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_physical_optimizer::ensure_requirements::enforce_distribution::adjust_input_keys_ordering (cognitive 26) datafusion/physical-optimizer/src/ensure_requirements/enforce_distribution.rs:136 — datafusion_physical_optimizer::ensure_requirements::enforce_distribution::adjust_input_keys_ordering has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (18 pts), match/switch 2 (5 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • datafusion_physical_optimizer::join_selection::statistical_join_selection_subrule (cognitive 25) datafusion/physical-optimizer/src/join_selection.rs:299 — datafusion_physical_optimizer::join_selection::statistical_join_selection_subrule has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_physical_optimizer::ensure_requirements::enforce_sorting::ensure_sorting (cognitive 21) datafusion/physical-optimizer/src/ensure_requirements/enforce_sorting/mod.rs:406 — datafusion_physical_optimizer::ensure_requirements::enforce_sorting::ensure_sorting has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 3, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_physical_optimizer::ensure_requirements::enforce_sorting::remove_corresponding_sort_from_sub_plan (cognitive 18) datafusion/physical-optimizer/src/ensure_requirements/enforce_sorting/mod.rs:741 — datafusion_physical_optimizer::ensure_requirements::enforce_sorting::remove_corresponding_sort_from_sub_plan has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_physical_optimizer::ensure_requirements::enforce_sorting::remove_bottleneck_in_subplan_impl (cognitive 17) datafusion/physical-optimizer/src/ensure_requirements/enforce_sorting/mod.rs:646 — datafusion_physical_optimizer::ensure_requirements::enforce_sorting::remove_bottleneck_in_subplan_impl has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 5, loops 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D17 · Explicit Debt · FixmeComment · ×10
  • FixmeComment datafusion/core/tests/user_defined/user_defined_scalar_functions.rs:1128 — // FIXME: Definitions with invalid placeholders are allowed, fail at runtime — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment datafusion/expr/src/utils.rs:1646 — // FIXME use as_ref — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment datafusion/sql/src/expr/value.rs:141 — // FIXME: This branch is shared by params from PREPARE and CREATE FUNCTION, but — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment datafusion/sql/src/expr/value.rs:158 — // FIXME: In the CREATE FUNCTION branch, param_type = None should raise an error — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment datafusion/sql/tests/sql_integration.rs:1334 — // FIXME: add test for having in execution — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment datafusion/sql/tests/sql_integration.rs:3655 — /// FIXME: for now we are not detecting prefix of sorting keys in order to re-arrange with global — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment datafusion/sql/tests/sql_integration.rs:3758 — /// FIXME: for now we are not detecting prefix of sorting keys in order to save one sort exec phase — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment datafusion/substrait/src/physical_plan/producer.rs:84 — // FIXME: duckdb doesn't set this field, keep it as default variant 0. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment datafusion/substrait/src/physical_plan/producer.rs:97 — // FIXME: duckdb sets this to None, but it's not clear why. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment datafusion/substrait/src/physical_plan/producer.rs:117 — // FIXME: duckdb set this to true, but it's not clear why. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
D1 · Cyclomatic Complexity · SqlToRel · ×9
  • SqlToRel::sql_statement_to_plan_with_context_impl (cyclomatic 215) datafusion/sql/src/statement.rs:267 — SqlToRel::sql_statement_to_plan_with_context_impl has cyclomatic complexity 215 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • SqlToRel::sql_function_to_expr (cyclomatic 77) datafusion/sql/src/expr/function.rs:228 — SqlToRel::sql_function_to_expr has cyclomatic complexity 77 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • SqlToRel::sql_expr_to_logical_expr_internal (cyclomatic 65) datafusion/sql/src/expr/mod.rs:387 — SqlToRel::sql_expr_to_logical_expr_internal has cyclomatic complexity 65 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • SqlToRel::convert_simple_data_type (cyclomatic 40) datafusion/sql/src/planner.rs:709 — SqlToRel::convert_simple_data_type has cyclomatic complexity 40 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • SqlToRel::select_to_plan (cyclomatic 22) datafusion/sql/src/select.rs:99 — SqlToRel::select_to_plan has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • SqlToRel::merge_clause_to_plan (cyclomatic 21) datafusion/sql/src/statement.rs:2664 — SqlToRel::merge_clause_to_plan has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • SqlToRel::insert_to_plan (cyclomatic 18) datafusion/sql/src/statement.rs:2806 — SqlToRel::insert_to_plan has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • SqlToRel::sql_compound_identifier_to_expr (cyclomatic 16) datafusion/sql/src/expr/identifier.rs:116 — SqlToRel::sql_compound_identifier_to_expr has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • SqlToRel::explain_to_plan (cyclomatic 16) datafusion/sql/src/statement.rs:2113 — SqlToRel::explain_to_plan has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · datafusion_functions · ×9
  • datafusion_functions::datetime::date_bin::date_bin_impl (cyclomatic 37) datafusion/functions/src/datetime/date_bin.rs:517 — datafusion_functions::datetime::date_bin::date_bin_impl has cyclomatic complexity 37 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • datafusion_functions::regex::regexpcount::regexp_count_inner (cyclomatic 33) datafusion/functions/src/regex/regexpcount.rs:261 — datafusion_functions::regex::regexpcount::regexp_count_inner has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • datafusion_functions::math::round::round_columnar (cyclomatic 28) datafusion/functions/src/math/round.rs:473 — datafusion_functions::math::round::round_columnar has cyclomatic complexity 28 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • datafusion_functions::unicode::lpad::lpad_impl (cyclomatic 26) datafusion/functions/src/unicode/lpad.rs:366 — datafusion_functions::unicode::lpad::lpad_impl has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • datafusion_functions::unicode::rpad::rpad_impl (cyclomatic 26) datafusion/functions/src/unicode/rpad.rs:365 — datafusion_functions::unicode::rpad::rpad_impl has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • datafusion_functions::string::concat::simplify_concat (cyclomatic 21) datafusion/functions/src/string/concat.rs:309 — datafusion_functions::string::concat::simplify_concat has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • datafusion_functions::string::concat_ws::simplify_concat_ws (cyclomatic 19) datafusion/functions/src/string/concat_ws.rs:362 — datafusion_functions::string::concat_ws::simplify_concat_ws has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • datafusion_functions::datetime::date_trunc::general_date_trunc (cyclomatic 17) datafusion/functions/src/datetime/date_trunc.rs:819 — datafusion_functions::datetime::date_trunc::general_date_trunc has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: datafusion_functions::datetime::date_trunc::general_date_trunc_array_fine_granularity (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • datafusion_functions::math::trunc::trunc (cyclomatic 16) datafusion/functions/src/math/trunc.rs:289 — datafusion_functions::math::trunc::trunc has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · datafusion_spark · ×8
  • datafusion_spark::function::math::round::spark_round (cyclomatic 45) datafusion/spark/src/function/math/round.rs:421 — datafusion_spark::function::math::round::spark_round has cyclomatic complexity 45 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • datafusion_spark::function::math::negative::spark_negative (cyclomatic 37) datafusion/spark/src/function/math/negative.rs:182 — datafusion_spark::function::math::negative::spark_negative has cyclomatic complexity 37 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • datafusion_spark::function::string::format_string::take_conversion_specifier (cyclomatic 36) datafusion/spark/src/function/string/format_string.rs:727 — datafusion_spark::function::string::format_string::take_conversion_specifier has cyclomatic complexity 36 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • datafusion_spark::function::math::abs::spark_abs (cyclomatic 28) datafusion/spark/src/function/math/abs.rs:133 — datafusion_spark::function::math::abs::spark_abs has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • datafusion_spark::function::math::width_bucket::width_bucket_interval_mdn_exact (cyclomatic 27) datafusion/spark/src/function/math/width_bucket.rs:300 — datafusion_spark::function::math::width_bucket::width_bucket_interval_mdn_exact has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • datafusion_spark::function::url::url_decode::spark_handled_url_decode (cyclomatic 21) datafusion/spark/src/function/url/url_decode.rs:191 — datafusion_spark::function::url::url_decode::spark_handled_url_decode has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • datafusion_spark::function::math::hex::compute_hex (cyclomatic 19) datafusion/spark/src/function/math/hex.rs:224 — datafusion_spark::function::math::hex::compute_hex has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • datafusion_spark::function::string::encode::encode_string (cyclomatic 16) datafusion/spark/src/function/string/encode.rs:79 — datafusion_spark::function::string::encode::encode_string has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D2 · Cognitive Complexity · Unparser · ×8
  • Unparser::select_to_sql_recursively (cognitive 268) datafusion/sql/src/unparser/plan.rs:837 — Unparser::select_to_sql_recursively has cognitive complexity 268 (threshold 15). Drivers by points: if/else 93 (222 pts), match/switch 9 (23 pts), boolean chains 16, loops 3 (7 pts) (nesting depth added 147). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Unparser::unparse_table_scan_pushdown (cognitive 46) datafusion/sql/src/unparser/plan.rs:2515 — Unparser::unparse_table_scan_pushdown has cognitive complexity 46 (threshold 15). Drivers by points: if/else 20 (39 pts), boolean chains 6, match/switch 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Unparser::expr_to_sql_inner (cognitive 45) datafusion/sql/src/unparser/expr.rs:156 — Unparser::expr_to_sql_inner has cognitive complexity 45 (threshold 15). Drivers by points: if/else 16 (27 pts), match/switch 9 (17 pts), boolean chains 1 (nesting depth added 19). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Unparser::asof_join_to_sql (cognitive 19) datafusion/sql/src/unparser/plan.rs:1929 — Unparser::asof_join_to_sql has cognitive complexity 19 (threshold 15). Drivers by points: if/else 17 (19 pts) (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • Unparser::try_projection_unnest_as_lateral_flatten (cognitive 18) datafusion/sql/src/unparser/plan.rs:658 — Unparser::try_projection_unnest_as_lateral_flatten has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Unparser::interval_scalar_to_sql (cognitive 17) datafusion/sql/src/unparser/expr.rs:1696 — Unparser::interval_scalar_to_sql has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 3 (5 pts), boolean chains 2 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Unparser::peel_to_unnest_with_modifiers (cognitive 17) datafusion/sql/src/unparser/plan.rs:2077 — Unparser::peel_to_unnest_with_modifiers has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 3, match/switch 2 (3 pts) (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Unparser::reconstruct_select_statement (cognitive 16) datafusion/sql/src/unparser/plan.rs:316 — Unparser::reconstruct_select_statement has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 2, match/switch 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · datafusion_substrait · ×8
  • datafusion_substrait::logical_plan::consumer::expr::literal::from_substrait_literal (cognitive 84) datafusion/substrait/src/logical_plan/consumer/expr/literal.rs:69 — datafusion_substrait::logical_plan::consumer::expr::literal::from_substrait_literal has cognitive complexity 84 (threshold 15). Drivers by points: match/switch 24 (43 pts), if/else 14 (38 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 44). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • datafusion_substrait::logical_plan::consumer::types::from_substrait_type (cognitive 55) datafusion/substrait/src/logical_plan/consumer/types.rs:95 — datafusion_substrait::logical_plan::consumer::types::from_substrait_type has cognitive complexity 55 (threshold 15). Drivers by points: match/switch 18 (48 pts), if/else 3 (7 pts) (nesting depth added 34). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • datafusion_substrait::physical_plan::consumer::from_substrait_rel (cognitive 35) datafusion/substrait/src/physical_plan/consumer.rs:49 — datafusion_substrait::physical_plan::consumer::from_substrait_rel has cognitive complexity 35 (threshold 15). Drivers by points: if/else 7 (16 pts), match/switch 4 (10 pts), loops 2 (7 pts), boolean chains 2 (nesting depth added 20). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • datafusion_substrait::logical_plan::consumer::rel::read_rel::from_read_rel (cognitive 35) datafusion/substrait/src/logical_plan/consumer/rel/read_rel.rs:38 — datafusion_substrait::logical_plan::consumer::rel::read_rel::from_read_rel has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (17 pts), match/switch 5 (10 pts), loops 2 (5 pts), boolean chains 3 (nesting depth added 16). Of this number, 28 points are the body's own statements and 7 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_substrait::logical_plan::consumer::rel::aggregate_rel::from_aggregate_rel (cognitive 24) datafusion/substrait/src/logical_plan/consumer/rel/aggregate_rel.rs:29 — datafusion_substrait::logical_plan::consumer::rel::aggregate_rel::from_aggregate_rel has cognitive complexity 24 (threshold 15). Drivers by points: match/switch 4 (12 pts), loops 3 (7 pts), if/else 4 (5 pts) (nesting depth added 13). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • datafusion_substrait::logical_plan::consumer::expr::window_function::from_substrait_bound (cognitive 22) datafusion/substrait/src/logical_plan/consumer/expr/window_function.rs:134 — datafusion_substrait::logical_plan::consumer::expr::window_function::from_substrait_bound has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (16 pts), match/switch 3 (6 pts) (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • datafusion_substrait::logical_plan::consumer::expr::subquery::from_subquery (cognitive 21) datafusion/substrait/src/logical_plan/consumer/expr/subquery.rs:46 — datafusion_substrait::logical_plan::consumer::expr::subquery::from_subquery has cognitive complexity 21 (threshold 15). Drivers by points: match/switch 5 (12 pts), if/else 4 (9 pts) (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • datafusion_substrait::logical_plan::consumer::plan::from_substrait_plan_with_consumer (cognitive 18) datafusion/substrait/src/logical_plan/consumer/plan.rs:43 — datafusion_substrait::logical_plan::consumer::plan::from_substrait_plan_with_consumer has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 4 (10 pts), if/else 2 (8 pts) (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D4 · Code Duplication · Duplicated block (12–13 lines × 2) · ×8
  • Duplicated block (12–13 lines × 2) datafusion/functions/src/core/overlay.rs:274 — datafusion/functions/src/core/overlay.rs:274-285 | datafusion/functions/src/unicode/translate.rs:205-217 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (12–13 lines × 2) datafusion/functions/src/math/abs.rs:177 — datafusion/functions/src/math/abs.rs:177-188 | datafusion/functions/src/math/monotonicity.rs:345-357 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (12–13 lines × 2) datafusion/functions-aggregate/src/first_last.rs:1074 — datafusion/functions-aggregate/src/first_last.rs:1074-1086 | datafusion/functions-aggregate/src/first_last.rs:1468-1479 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12–13 lines × 2) datafusion/physical-plan/src/aggregates/group_values/multi_group_by/bytes.rs:127 — datafusion/physical-plan/src/aggregates/group_values/multi_group_by/bytes.rs:127-138 | datafusion/physical-plan/src/aggregates/group_values/multi_group_by/fixed_size_binary.rs:151-163 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (12–13 lines × 2) datafusion/physical-plan/src/aggregates/group_values/multi_group_by/dictionary.rs:432 — datafusion/physical-plan/src/aggregates/group_values/multi_group_by/dictionary.rs:432-444 | datafusion/physical-plan/src/aggregates/group_values/multi_group_by/dictionary.rs:453-464 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12–13 lines × 2) datafusion/physical-plan/src/aggregates/ordered_single_stream.rs:406 — datafusion/physical-plan/src/aggregates/ordered_single_stream.rs:406-417 | datafusion/physical-plan/src/aggregates/single_stream.rs:437-449 — before extracting anything, compare `datafusion/physical-plan/src/aggregates/ordered_single_stream.rs` and `datafusion/physical-plan/src/aggregates/single_stream.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 101 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (12–13 lines × 2) datafusion/physical-plan/src/aggregates/topk/hash_table.rs:401 — datafusion/physical-plan/src/aggregates/topk/hash_table.rs:401-413 | datafusion/physical-plan/src/aggregates/topk/hash_table.rs:446-457 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12–13 lines × 2) datafusion/physical-plan/src/display.rs:290 — datafusion/physical-plan/src/display.rs:290-301 | datafusion/physical-plan/src/display.rs:486-498 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (12 lines × 3) · ×8
  • Duplicated block (12 lines × 3) datafusion/catalog/src/information_schema.rs:462 — datafusion/catalog/src/information_schema.rs:462-473 | datafusion/catalog/src/information_schema.rs:502-513 | datafusion/catalog/src/information_schema.rs:538-549 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (12 lines × 3) datafusion/datasource-csv/src/file_format.rs:959 — datafusion/datasource-csv/src/file_format.rs:959-970 | datafusion/datasource-json/src/file_format.rs:602-613 | datafusion/datasource-parquet/src/sink.rs:584-595 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (12 lines × 3) datafusion/functions-aggregate-common/src/aggregate/count_distinct/bytes.rs:79 — datafusion/functions-aggregate-common/src/aggregate/count_distinct/bytes.rs:79-90 | datafusion/functions-aggregate-common/src/aggregate/count_distinct/bytes.rs:142-153 | datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:104-115 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (12 lines × 3) datafusion/spark/src/function/bitmap/bitmap_bit_position.rs:45 — datafusion/spark/src/function/bitmap/bitmap_bit_position.rs:45-56 | datafusion/spark/src/function/bitmap/bitmap_bucket_number.rs:45-56 | datafusion/spark/src/function/bitwise/bitwise_not.rs:42-53 — before extracting anything, compare `datafusion/spark/src/function/bitmap/bitmap_bit_position.rs` and `datafusion/spark/src/function/bitmap/bitmap_bucket_number.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 3) datafusion/sql/src/unparser/dialect.rs:480 — datafusion/sql/src/unparser/dialect.rs:480-491 | datafusion/sql/src/unparser/expr.rs:686-697 | datafusion/sql/src/unparser/expr.rs:1828-1839 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (12 lines × 3) datafusion/spark/src/function/hash/crc32.rs:49 — datafusion/spark/src/function/hash/crc32.rs:49-60 | datafusion/spark/src/function/string/base64.rs:46-57 | datafusion/spark/src/function/string/base64.rs:119-130 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (12 lines × 3) datafusion/expr-common/src/signature.rs:758 — datafusion/expr-common/src/signature.rs:758-769 | datafusion/expr-common/src/signature.rs:772-783 | datafusion/expr-common/src/signature.rs:786-797 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (12 lines × 3) datafusion/sql/src/parser.rs:1083 — datafusion/sql/src/parser.rs:1083-1094 | datafusion/sql/src/parser.rs:1470-1481 | datafusion/sql/src/parser.rs:1505-1516 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (9 lines × 3) · ×8
  • Duplicated block (9 lines × 3) datafusion/catalog/src/information_schema.rs:489 — datafusion/catalog/src/information_schema.rs:489-497 | datafusion/catalog/src/information_schema.rs:525-533 | datafusion/catalog/src/information_schema.rs:561-569 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (9 lines × 3) datafusion/datasource/src/boundary_stream.rs:241 — datafusion/datasource/src/boundary_stream.rs:241-249 | datafusion/datasource/src/boundary_stream.rs:282-290 | datafusion/datasource/src/boundary_stream.rs:379-387 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (9 lines × 3) datafusion/ffi/src/catalog_provider.rs:198 — datafusion/ffi/src/catalog_provider.rs:198-206 | datafusion/ffi/src/catalog_provider_list.rs:163-171 | datafusion/ffi/src/schema_provider.rs:206-214 — before extracting anything, compare `datafusion/ffi/src/catalog_provider.rs` and `datafusion/ffi/src/catalog_provider_list.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 45 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 3) datafusion/functions-nested/src/utils.rs:127 — datafusion/functions-nested/src/utils.rs:127-135 | datafusion/functions/src/utils.rs:120-128 | datafusion/spark/src/function/functions_nested_utils.rs:29-37 — before extracting anything, compare `datafusion/functions-nested/src/utils.rs` and `datafusion/spark/src/function/functions_nested_utils.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 3) datafusion/functions-nested/src/except.rs:223 — datafusion/functions-nested/src/except.rs:223-231 | datafusion/functions-nested/src/set_ops.rs:496-504 | datafusion/functions-nested/src/set_ops.rs:607-615 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (9 lines × 3) datafusion/proto/src/logical_plan/mod.rs:710 — datafusion/proto/src/logical_plan/mod.rs:710-718 | datafusion/proto/src/logical_plan/mod.rs:1189-1197 | datafusion/proto/src/logical_plan/mod.rs:1337-1345 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (9 lines × 3) datafusion/physical-plan/src/buffer.rs:290 — datafusion/physical-plan/src/buffer.rs:290-298 | datafusion/physical-plan/src/coalesce_batches.rs:278-286 | datafusion/physical-plan/src/coop.rs:348-356 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
  • Duplicated block (9 lines × 3) datafusion/sqllogictest/src/test_context/range_partitioning.rs:126 — datafusion/sqllogictest/src/test_context/range_partitioning.rs:126-134 | datafusion/sqllogictest/src/test_context/range_partitioning.rs:151-159 | datafusion/sqllogictest/src/test_context/range_partitioning.rs:174-182 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (7 lines × 3) · ×8
  • Duplicated block (7 lines × 3) datafusion/datasource-avro/src/source.rs:148 — datafusion/datasource-avro/src/source.rs:148-154 | datafusion/datasource-csv/src/source.rs:278-284 | datafusion/datasource-json/src/source.rs:221-227 — before extracting anything, compare `datafusion/datasource-csv/src/source.rs` and `datafusion/datasource-json/src/source.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 3) datafusion/functions-nested/src/lib.rs:235 — datafusion/functions-nested/src/lib.rs:235-241 | datafusion/functions/src/lib.rs:183-189 | datafusion/spark/src/lib.rs:220-226 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (7 lines × 3) datafusion/functions-nested/src/arrays_zip.rs:185 — datafusion/functions-nested/src/arrays_zip.rs:185-191 | datafusion/functions-nested/src/arrays_zip.rs:197-203 | datafusion/functions-nested/src/arrays_zip.rs:208-214 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (7 lines × 3) datafusion/physical-plan/src/joins/asof_join.rs:561 — datafusion/physical-plan/src/joins/asof_join.rs:561-567 | datafusion/physical-plan/src/joins/hash_join/exec.rs:1820-1826 | datafusion/physical-plan/src/joins/nested_loop_join.rs:681-687 — before extracting anything, compare `datafusion/physical-plan/src/joins/asof_join.rs` and `datafusion/physical-plan/src/joins/hash_join/exec.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 30 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 3) datafusion/physical-plan/src/topk/mod.rs:1480 — datafusion/physical-plan/src/topk/mod.rs:1480-1486 | datafusion/physical-plan/src/topk/mod.rs:1888-1894 | datafusion/physical-plan/src/topk/mod.rs:2381-2387 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (7 lines × 3) datafusion/spark/src/function/datetime/date_part.rs:99 — datafusion/spark/src/function/datetime/date_part.rs:99-105 | datafusion/spark/src/function/datetime/date_trunc.rs:97-103 | datafusion/spark/src/function/datetime/trunc.rs:96-102 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
  • Duplicated block (7 lines × 3) datafusion/ffi/src/execution/task_ctx.rs:153 — datafusion/ffi/src/execution/task_ctx.rs:153-159 | datafusion/ffi/src/execution/task_ctx_provider.rs:110-116 | datafusion/ffi/src/session/mod.rs:373-379 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (7 lines × 3) datafusion/sqllogictest/src/test_context/range_partitioning.rs:118 — datafusion/sqllogictest/src/test_context/range_partitioning.rs:118-124 | datafusion/sqllogictest/src/test_context/range_partitioning.rs:141-150 | datafusion/sqllogictest/src/test_context/range_partitioning.rs:166-172 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D1 · Cyclomatic Complexity · datafusion_substrait · ×7
  • datafusion_substrait::logical_plan::consumer::expr::literal::from_substrait_literal (cyclomatic 96) datafusion/substrait/src/logical_plan/consumer/expr/literal.rs:69 — datafusion_substrait::logical_plan::consumer::expr::literal::from_substrait_literal has cyclomatic complexity 96 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • datafusion_substrait::logical_plan::consumer::types::from_substrait_type (cyclomatic 66) datafusion/substrait/src/logical_plan/consumer/types.rs:95 — datafusion_substrait::logical_plan::consumer::types::from_substrait_type has cyclomatic complexity 66 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • datafusion_substrait::logical_plan::producer::expr::literal::to_substrait_literal (cyclomatic 45) datafusion/substrait/src/logical_plan/producer/expr/literal.rs:55 — datafusion_substrait::logical_plan::producer::expr::literal::to_substrait_literal has cyclomatic complexity 45 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • datafusion_substrait::logical_plan::producer::types::to_substrait_type_from_field (cyclomatic 40) datafusion/substrait/src/logical_plan/producer/types.rs:42 — datafusion_substrait::logical_plan::producer::types::to_substrait_type_from_field has cyclomatic complexity 40 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • datafusion_substrait::logical_plan::consumer::rel::read_rel::from_read_rel (cyclomatic 22) datafusion/substrait/src/logical_plan/consumer/rel/read_rel.rs:38 — datafusion_substrait::logical_plan::consumer::rel::read_rel::from_read_rel has cyclomatic complexity 22 (threshold 15). Of this number, 18 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • datafusion_substrait::physical_plan::consumer::from_substrait_rel (cyclomatic 17) datafusion/substrait/src/physical_plan/consumer.rs:49 — datafusion_substrait::physical_plan::consumer::from_substrait_rel has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • datafusion_substrait::logical_plan::consumer::expr::subquery::from_subquery (cyclomatic 16) datafusion/substrait/src/logical_plan/consumer/expr/subquery.rs:46 — datafusion_substrait::logical_plan::consumer::expr::subquery::from_subquery has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · datafusion_physical_plan · ×7
  • datafusion_physical_plan::aggregates::group_values::multi_group_by::make_group_column (cyclomatic 60) datafusion/physical-plan/src/aggregates/group_values/multi_group_by/mod.rs:959 — datafusion_physical_plan::aggregates::group_values::multi_group_by::make_group_column has cyclomatic complexity 60 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • datafusion_physical_plan::joins::utils::compare_join_arrays (cyclomatic 36) datafusion/physical-plan/src/joins/utils.rs:2553 — datafusion_physical_plan::joins::utils::compare_join_arrays has cyclomatic complexity 36 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • datafusion_physical_plan::windows::window_equivalence_properties (cyclomatic 35) datafusion/physical-plan/src/windows/mod.rs:380 — datafusion_physical_plan::windows::window_equivalence_properties has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • datafusion_physical_plan::joins::hash_join::exec::collect_left_input (cyclomatic 29) datafusion/physical-plan/src/joins/hash_join/exec.rs:3027 — datafusion_physical_plan::joins::hash_join::exec::collect_left_input has cyclomatic complexity 29 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • datafusion_physical_plan::aggregates::group_values::new_group_values (cyclomatic 24) datafusion/physical-plan/src/aggregates/group_values/mod.rs:159 — datafusion_physical_plan::aggregates::group_values::new_group_values has cyclomatic complexity 24 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • datafusion_physical_plan::joins::nested_loop_join::build_unmatched_batch (cyclomatic 19) datafusion/physical-plan/src/joins/nested_loop_join.rs:3879 — datafusion_physical_plan::joins::nested_loop_join::build_unmatched_batch has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • datafusion_physical_plan::projection::try_pushdown_through_join_with_column_indices (cyclomatic 18) datafusion/physical-plan/src/projection.rs:929 — datafusion_physical_plan::projection::try_pushdown_through_join_with_column_indices has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · datafusion_optimizer · ×7
  • datafusion_optimizer::optimize_projections::optimize_projections (cyclomatic 28) datafusion/optimizer/src/optimize_projections/mod.rs:127 — datafusion_optimizer::optimize_projections::optimize_projections has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • datafusion_optimizer::push_down_filter::push_down_all_join (cyclomatic 25) datafusion/optimizer/src/push_down_filter.rs:398 — datafusion_optimizer::push_down_filter::push_down_all_join has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • datafusion_optimizer::push_down_limit::topk_through_join::push_topk_through_join (cyclomatic 23) datafusion/optimizer/src/push_down_limit/topk_through_join.rs:92 — datafusion_optimizer::push_down_limit::topk_through_join::push_topk_through_join has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • datafusion_optimizer::decorrelate_lateral_join::rewrite_internal (cyclomatic 23) datafusion/optimizer/src/decorrelate_lateral_join.rs:76 — datafusion_optimizer::decorrelate_lateral_join::rewrite_internal has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • datafusion_optimizer::optimizer::map_children_mut (cyclomatic 19) datafusion/optimizer/src/optimizer.rs:393 — datafusion_optimizer::optimizer::map_children_mut has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • datafusion_optimizer::extract_leaf_expressions::split_and_push_projection (cyclomatic 19) datafusion/optimizer/src/extract_leaf_expressions.rs:931 — datafusion_optimizer::extract_leaf_expressions::split_and_push_projection has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • datafusion_optimizer::push_down_limit::rewrite_limit (cyclomatic 18) datafusion/optimizer/src/push_down_limit.rs:93 — datafusion_optimizer::push_down_limit::rewrite_limit has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D4 · Code Duplication · Duplicated block (20 lines × 2) · ×7
  • Duplicated block (20 lines × 2) datafusion/common/src/scalar/mod.rs:2837 — datafusion/common/src/scalar/mod.rs:2837-2856 | datafusion/common/src/scalar/mod.rs:2880-2899 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (20 lines × 2) datafusion/functions/src/string/ends_with.rs:108 — datafusion/functions/src/string/ends_with.rs:108-127 | datafusion/functions/src/string/starts_with.rs:104-123 — before extracting anything, compare `datafusion/functions/src/string/ends_with.rs` and `datafusion/functions/src/string/starts_with.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 64 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (20 lines × 2) datafusion/functions/src/unicode/lpad.rs:125 — datafusion/functions/src/unicode/lpad.rs:125-144 | datafusion/functions/src/unicode/rpad.rs:125-144 — before extracting anything, compare `datafusion/functions/src/unicode/lpad.rs` and `datafusion/functions/src/unicode/rpad.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 229 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (20 lines × 2) datafusion/functions/src/unicode/lpad.rs:466 — datafusion/functions/src/unicode/lpad.rs:466-485 | datafusion/functions/src/unicode/rpad.rs:467-486 — before extracting anything, compare `datafusion/functions/src/unicode/lpad.rs` and `datafusion/functions/src/unicode/rpad.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 229 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (20 lines × 2) datafusion/physical-plan/src/spill/mod.rs:543 — datafusion/physical-plan/src/spill/mod.rs:543-562 | datafusion/physical-plan/src/spill/mod.rs:568-587 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (20 lines × 2) datafusion/core/src/test_util/mod.rs:94 — datafusion/core/src/test_util/mod.rs:94-113 | datafusion/physical-plan/src/test.rs:383-402 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (20 lines × 2) test-utils/src/array_gen/string.rs:45 — test-utils/src/array_gen/string.rs:45-64 | test-utils/src/array_gen/string.rs:69-88 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (19 lines × 2) · ×7
  • Duplicated block (19 lines × 2) datafusion/expr-common/src/casts.rs:324 — datafusion/expr-common/src/casts.rs:324-342 | datafusion/expr-common/src/casts.rs:344-362 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (19 lines × 2) datafusion/ffi/src/config/mod.rs:48 — datafusion/ffi/src/config/mod.rs:48-66 | datafusion/ffi/src/config/mod.rs:136-154 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (19 lines × 2) datafusion/functions-nested/src/cosine_distance.rs:121 — datafusion/functions-nested/src/cosine_distance.rs:121-139 | datafusion/functions-nested/src/inner_product.rs:123-141 — before extracting anything, compare `datafusion/functions-nested/src/cosine_distance.rs` and `datafusion/functions-nested/src/inner_product.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 86 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (19 lines × 2) datafusion/functions-nested/src/utils.rs:132 — datafusion/functions-nested/src/utils.rs:132-150 | datafusion/spark/src/function/functions_nested_utils.rs:34-52 — before extracting anything, compare `datafusion/functions-nested/src/utils.rs` and `datafusion/spark/src/function/functions_nested_utils.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (19 lines × 2) datafusion/spark/src/function/string/format_string.rs:1146 — datafusion/spark/src/function/string/format_string.rs:1146-1164 | datafusion/spark/src/function/string/format_string.rs:1172-1190 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (19 lines × 2) datafusion/sql/src/select.rs:711 — datafusion/sql/src/select.rs:711-729 | datafusion/sql/src/select.rs:870-888 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (19 lines × 2) datafusion/sqllogictest/src/engines/datafusion_engine/runner.rs:158 — datafusion/sqllogictest/src/engines/datafusion_engine/runner.rs:158-176 | datafusion/sqllogictest/src/engines/datafusion_substrait_roundtrip_engine/runner.rs:104-122 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (11 lines × 3) · ×7
  • Duplicated block (11 lines × 3) datafusion/catalog/src/information_schema.rs:262 — datafusion/catalog/src/information_schema.rs:262-272 | datafusion/catalog/src/information_schema.rs:282-292 | datafusion/catalog/src/information_schema.rs:302-312 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (11 lines × 3) datafusion/ffi/src/table_provider.rs:295 — datafusion/ffi/src/table_provider.rs:295-305 | datafusion/ffi/src/table_provider.rs:376-386 | datafusion/ffi/src/table_provider.rs:414-424 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (11 lines × 3) datafusion/functions/src/regex/regexpcount.rs:419 — datafusion/functions/src/regex/regexpcount.rs:419-429 | datafusion/functions/src/regex/regexpcount.rs:456-466 | datafusion/functions/src/regex/regexpcount.rs:492-502 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (11 lines × 3) datafusion/functions/src/string/btrim.rs:97 — datafusion/functions/src/string/btrim.rs:97-107 | datafusion/functions/src/string/ltrim.rs:102-112 | datafusion/functions/src/string/rtrim.rs:102-112 — before extracting anything, compare `datafusion/functions/src/string/ltrim.rs` and `datafusion/functions/src/string/rtrim.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (11 lines × 3) datafusion/functions-aggregate/src/first_last/state.rs:204 — datafusion/functions-aggregate/src/first_last/state.rs:204-214 | datafusion/functions-aggregate/src/first_last/state.rs:218-228 | datafusion/functions-aggregate/src/first_last/state.rs:231-241 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (11 lines × 3) datafusion/physical-plan/src/joins/hash_join/exec.rs:1514 — datafusion/physical-plan/src/joins/hash_join/exec.rs:1514-1524 | datafusion/physical-plan/src/joins/sort_merge_join/exec.rs:442-452 | datafusion/physical-plan/src/joins/symmetric_hash_join.rs:385-395 — `datafusion/physical-plan/src/joins/hash_join/exec.rs` and `datafusion/physical-plan/src/joins/sort_merge_join/exec.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 33 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (11 lines × 3) datafusion/functions-aggregate/src/correlation.rs:122 — datafusion/functions-aggregate/src/correlation.rs:122-132 | datafusion/functions-aggregate/src/covariance.rs:109-119 | datafusion/functions-aggregate/src/covariance.rs:196-206 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
D1 · Cyclomatic Complexity · datafusion_physical_optimizer · ×6
  • datafusion_physical_optimizer::ensure_requirements::enforce_distribution::ensure_distribution_with_stats (cyclomatic 42) datafusion/physical-optimizer/src/ensure_requirements/enforce_distribution.rs:1363 — datafusion_physical_optimizer::ensure_requirements::enforce_distribution::ensure_distribution_with_stats has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • datafusion_physical_optimizer::ensure_requirements::enforce_sorting::sort_pushdown::pushdown_requirement_to_children (cyclomatic 29) datafusion/physical-optimizer/src/ensure_requirements/enforce_sorting/sort_pushdown.rs:454 — datafusion_physical_optimizer::ensure_requirements::enforce_sorting::sort_pushdown::pushdown_requirement_to_children has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • datafusion_physical_optimizer::ensure_requirements::enforce_distribution::enforce_distribution_relationships (cyclomatic 27) datafusion/physical-optimizer/src/ensure_requirements/enforce_distribution.rs:1122 — datafusion_physical_optimizer::ensure_requirements::enforce_distribution::enforce_distribution_relationships has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • datafusion_physical_optimizer::ensure_requirements::enforce_sorting::sort_pushdown::pushdown_sorts_helper (cyclomatic 20) datafusion/physical-optimizer/src/ensure_requirements/enforce_sorting/sort_pushdown.rs:240 — datafusion_physical_optimizer::ensure_requirements::enforce_sorting::sort_pushdown::pushdown_sorts_helper has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • datafusion_physical_optimizer::limit_pushdown::pushdown_limit_helper (cyclomatic 18) datafusion/physical-optimizer/src/limit_pushdown.rs:148 — datafusion_physical_optimizer::limit_pushdown::pushdown_limit_helper has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • datafusion_physical_optimizer::ensure_requirements::enforce_distribution::adjust_input_keys_ordering (cyclomatic 17) datafusion/physical-optimizer/src/ensure_requirements/enforce_distribution.rs:136 — datafusion_physical_optimizer::ensure_requirements::enforce_distribution::adjust_input_keys_ordering has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ScalarValue · ×6
  • ScalarValue::deserialize (cognitive 139) datafusion/proto-common/src/generated/pbjson.rs:8805 — ScalarValue::deserialize has cognitive complexity 139 (threshold 15). Drivers by points: if/else 45 (135 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 91). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ScalarValue::iter_to_array (cognitive 81) datafusion/common/src/scalar/mod.rs:2821 — ScalarValue::iter_to_array has cognitive complexity 81 (threshold 15). Drivers by points: if/else 33 (53 pts), match/switch 12 (22 pts), loops 2 (5 pts), boolean chains 1 (nesting depth added 33). Of this number, 69 points are the body's own statements and 12 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ScalarValue::to_array_of_size (cognitive 45) datafusion/common/src/scalar/mod.rs:3463 — ScalarValue::to_array_of_size has cognitive complexity 45 (threshold 15). Drivers by points: match/switch 14 (23 pts), if/else 9 (19 pts), loops 1 (3 pts) (nesting depth added 21). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • ScalarValue::partial_cmp (cognitive 28) datafusion/common/src/scalar/mod.rs:621 — ScalarValue::partial_cmp has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (21 pts), match/switch 4 (5 pts), boolean chains 2 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • ScalarValue::try_from (cognitive 23) datafusion/proto-common/src/to_proto/mod.rs:318 — ScalarValue::try_from has cognitive complexity 23 (threshold 15). Drivers by points: match/switch 11 (15 pts), if/else 4 (6 pts), loops 1 (2 pts) (nesting depth added 7). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • ScalarValue::try_from (cognitive 21) datafusion/proto-common/src/from_proto/mod.rs:390 — ScalarValue::try_from has cognitive complexity 21 (threshold 15). Drivers by points: match/switch 7 (13 pts), if/else 4 (6 pts), loops 1 (2 pts) (nesting depth added 9). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · datafusion_expr · ×6
  • datafusion_expr::type_coercion::functions::get_valid_types (cognitive 103) datafusion/expr/src/type_coercion/functions.rs:580 — datafusion_expr::type_coercion::functions::get_valid_types has cognitive complexity 103 (threshold 15). Drivers by points: if/else 40 (72 pts), match/switch 11 (20 pts), loops 6 (11 pts) (nesting depth added 46). Of this number, 63 points are the body's own statements and 40 belong to 8 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_expr::logical_plan::builder::project_with_validation (cognitive 39) datafusion/expr/src/logical_plan/builder.rs:2080 — datafusion_expr::logical_plan::builder::project_with_validation has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (27 pts), loops 4 (9 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_expr::logical_plan::invariants::check_subquery_expr (cognitive 38) datafusion/expr/src/logical_plan/invariants.rs:157 — datafusion_expr::logical_plan::invariants::check_subquery_expr has cognitive complexity 38 (threshold 15). Drivers by points: if/else 13 (28 pts), match/switch 3 (8 pts), boolean chains 2 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_expr::higher_order_function::resolve_higher_order_function (cognitive 37) datafusion/expr/src/higher_order_function.rs:1215 — datafusion_expr::higher_order_function::resolve_higher_order_function has cognitive complexity 37 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 4 (12 pts), match/switch 5 (9 pts), boolean chains 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_expr::type_coercion::functions::value_fields_with_higher_order_udf (cognitive 20) datafusion/expr/src/type_coercion/functions.rs:169 — datafusion_expr::type_coercion::functions::value_fields_with_higher_order_udf has cognitive complexity 20 (threshold 15). Drivers by points: match/switch 6 (10 pts), if/else 4 (8 pts), loops 1 (2 pts) (nesting depth added 9). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • datafusion_expr::expr_rewriter::guarantees::rewrite_between (cognitive 20) datafusion/expr/src/expr_rewriter/guarantees.rs:130 — datafusion_expr::expr_rewriter::guarantees::rewrite_between has cognitive complexity 20 (threshold 15). Drivers by points: if/else 15 (18 pts), boolean chains 1, match/switch 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ConversionSpecifier · ×6
  • ConversionSpecifier::format_hex_float (cognitive 84) datafusion/spark/src/function/string/format_string.rs:1432 — ConversionSpecifier::format_hex_float has cognitive complexity 84 (threshold 15). Drivers by points: if/else 38 (68 pts), boolean chains 8, loops 3 (6 pts), match/switch 2 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ConversionSpecifier::format_float (cognitive 49) datafusion/spark/src/function/string/format_string.rs:1691 — ConversionSpecifier::format_float has cognitive complexity 49 (threshold 15). Drivers by points: if/else 22 (41 pts), match/switch 3 (6 pts), boolean chains 2 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ConversionSpecifier::format (cognitive 43) datafusion/spark/src/function/string/format_string.rs:996 — ConversionSpecifier::format has cognitive complexity 43 (threshold 15). Drivers by points: match/switch 20 (37 pts), if/else 4 (6 pts) (nesting depth added 19). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • ConversionSpecifier::format_char (cognitive 24) datafusion/spark/src/function/string/format_string.rs:1621 — ConversionSpecifier::format_char has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 2 (6 pts), match/switch 1 (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • ConversionSpecifier::format_decimal (cognitive 21) datafusion/spark/src/function/string/format_string.rs:1958 — ConversionSpecifier::format_decimal has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (18 pts), match/switch 2, boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ConversionSpecifier::format_unsigned (cognitive 18) datafusion/spark/src/function/string/format_string.rs:1833 — ConversionSpecifier::format_unsigned has cognitive complexity 18 (threshold 15). Drivers by points: loops 3 (9 pts), if/else 7 (8 pts), match/switch 1 (nesting depth added 7). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D4 · Code Duplication · Duplicated block (6 lines × 3) · ×6
  • Duplicated block (6 lines × 3) datafusion/catalog/src/information_schema.rs:690 — datafusion/catalog/src/information_schema.rs:690-695 | datafusion/catalog/src/information_schema.rs:778-783 | datafusion/catalog/src/information_schema.rs:983-988 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (6 lines × 3) datafusion/functions/src/string/btrim.rs:36 — datafusion/functions/src/string/btrim.rs:36-41 | datafusion/functions/src/string/ltrim.rs:37-42 | datafusion/functions/src/string/rtrim.rs:37-42 — before extracting anything, compare `datafusion/functions/src/string/ltrim.rs` and `datafusion/functions/src/string/rtrim.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 3) datafusion/physical-plan/src/aggregates/hash_stream.rs:224 — datafusion/physical-plan/src/aggregates/hash_stream.rs:224-229 | datafusion/physical-plan/src/aggregates/ordered_partial_stream.rs:151-156 | datafusion/physical-plan/src/aggregates/partial_reduce_stream.rs:189-194 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
  • Duplicated block (6 lines × 3) datafusion/spark/src/function/bitwise/bit_shift.rs:49 — datafusion/spark/src/function/bitwise/bit_shift.rs:49-54 | datafusion/spark/src/function/bitwise/bit_shift.rs:72-77 | datafusion/spark/src/function/bitwise/bit_shift.rs:127-132 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (6 lines × 3) datafusion/functions-aggregate/src/array_agg.rs:167 — datafusion/functions-aggregate/src/array_agg.rs:167-172 | datafusion/functions-aggregate/src/first_last.rs:363-368 | datafusion/functions-aggregate/src/first_last.rs:1272-1277 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (6 lines × 3) datafusion/sqllogictest/src/test_context/range_partitioning.rs:85 — datafusion/sqllogictest/src/test_context/range_partitioning.rs:85-90 | datafusion/sqllogictest/src/test_context/range_partitioning.rs:125-130 | datafusion/sqllogictest/src/test_context/range_partitioning.rs:173-178 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D1 · Cyclomatic Complexity · ConversionSpecifier · ×5
  • ConversionSpecifier::format (cyclomatic 83) datafusion/spark/src/function/string/format_string.rs:996 — ConversionSpecifier::format has cyclomatic complexity 83 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ConversionSpecifier::format_hex_float (cyclomatic 38) datafusion/spark/src/function/string/format_string.rs:1432 — ConversionSpecifier::format_hex_float has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ConversionSpecifier::format_time_component (cyclomatic 34) datafusion/spark/src/function/string/format_string.rs:2143 — ConversionSpecifier::format_time_component has cyclomatic complexity 34 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ConversionSpecifier::format_float (cyclomatic 25) datafusion/spark/src/function/string/format_string.rs:1691 — ConversionSpecifier::format_float has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: TimeFormat::try_from (cyclomatic 31) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • ConversionSpecifier::format_decimal (cyclomatic 16) datafusion/spark/src/function/string/format_string.rs:1958 — ConversionSpecifier::format_decimal has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: TimeFormat::try_from (cyclomatic 31) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · datafusion_expr · ×5
  • datafusion_expr::type_coercion::functions::get_valid_types (cyclomatic 66) datafusion/expr/src/type_coercion/functions.rs:580 — datafusion_expr::type_coercion::functions::get_valid_types has cyclomatic complexity 66 (threshold 15). Of this number, 38 points are the body's own statements and 28 belong to 8 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • datafusion_expr::higher_order_function::resolve_higher_order_function (cyclomatic 19) datafusion/expr/src/higher_order_function.rs:1215 — datafusion_expr::higher_order_function::resolve_higher_order_function has cyclomatic complexity 19 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • datafusion_expr::logical_plan::invariants::check_subquery_expr (cyclomatic 17) datafusion/expr/src/logical_plan/invariants.rs:157 — datafusion_expr::logical_plan::invariants::check_subquery_expr has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • datafusion_expr::type_coercion::functions::value_fields_with_higher_order_udf (cyclomatic 16) datafusion/expr/src/type_coercion/functions.rs:169 — datafusion_expr::type_coercion::functions::value_fields_with_higher_order_udf has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: datafusion_expr::type_coercion::functions::coerced_from (cyclomatic 32) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • datafusion_expr::logical_plan::builder::project_with_validation (cyclomatic 16) datafusion/expr/src/logical_plan/builder.rs:2080 — datafusion_expr::logical_plan::builder::project_with_validation has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Expr · ×5
  • Expr::fmt (cyclomatic 60) datafusion/expr/src/expr.rs:3559 — Expr::fmt has cyclomatic complexity 60 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Expr::normalize_eq (cyclomatic 50) datafusion/expr/src/expr.rs:2365 — Expr::normalize_eq has cyclomatic complexity 50 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Expr::nullable (cyclomatic 38) datafusion/expr/src/expr_schema.rs:294 — Expr::nullable has cyclomatic complexity 38 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Expr::get_type (cyclomatic 26) datafusion/expr/src/expr_schema.rs:183 — Expr::get_type has cyclomatic complexity 26 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Expr::to_field (cyclomatic 24) datafusion/expr/src/expr_schema.rs:522 — Expr::to_field has cyclomatic complexity 24 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · LogicalPlan · ×5
  • LogicalPlan::display (cyclomatic 55) datafusion/expr/src/logical_plan/plan.rs:2068 — LogicalPlan::display has cyclomatic complexity 55 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • LogicalPlan::with_new_exprs (cyclomatic 40) datafusion/expr/src/logical_plan/plan.rs:837 — LogicalPlan::with_new_exprs has cyclomatic complexity 40 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • LogicalPlan::max_rows (cyclomatic 31) datafusion/expr/src/logical_plan/plan.rs:1446 — LogicalPlan::max_rows has cyclomatic complexity 31 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • LogicalPlan::map_expressions (cyclomatic 23) datafusion/expr/src/logical_plan/tree_node.rs:537 — LogicalPlan::map_expressions has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: LogicalPlan::map_children (cyclomatic 27) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • LogicalPlan::head_output_expr (cyclomatic 16) datafusion/expr/src/logical_plan/plan.rs:550 — LogicalPlan::head_output_expr has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: LogicalPlan::recompute_schema (cyclomatic 28) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D4 · Code Duplication · Duplicated block (25 lines × 2) · ×5
  • Duplicated block (25 lines × 2) datafusion/expr/src/higher_order_function.rs:906 — datafusion/expr/src/higher_order_function.rs:906-930 | datafusion/expr/src/udf.rs:95-119 — before extracting anything, compare `datafusion/expr/src/higher_order_function.rs` and `datafusion/expr/src/udf.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 41 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (25 lines × 2) datafusion/expr/src/logical_plan/plan.rs:1627 — datafusion/expr/src/logical_plan/plan.rs:1627-1651 | datafusion/expr/src/logical_plan/plan.rs:1666-1690 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (25 lines × 2) datafusion/physical-expr/src/simplifier/const_evaluator.rs:57 — datafusion/physical-expr/src/simplifier/const_evaluator.rs:57-81 | datafusion/physical-expr/src/simplifier/const_evaluator.rs:131-155 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (25 lines × 2) datafusion/physical-plan/src/aggregates/group_values/single_group_by/bytes.rs:53 — datafusion/physical-plan/src/aggregates/group_values/single_group_by/bytes.rs:53-77 | datafusion/physical-plan/src/aggregates/group_values/single_group_by/bytes_view.rs:55-79 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (25 lines × 2) datafusion/spark/src/function/datetime/make_dt_interval.rs:48 — datafusion/spark/src/function/datetime/make_dt_interval.rs:48-72 | datafusion/spark/src/function/datetime/make_interval.rs:45-69 — before extracting anything, compare `datafusion/spark/src/function/datetime/make_dt_interval.rs` and `datafusion/spark/src/function/datetime/make_interval.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (21 lines × 2) · ×5
  • Duplicated block (21 lines × 2) datafusion/functions/src/math/ceil.rs:111 — datafusion/functions/src/math/ceil.rs:111-131 | datafusion/functions/src/math/floor.rs:157-177 — before extracting anything, compare `datafusion/functions/src/math/ceil.rs` and `datafusion/functions/src/math/floor.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (21 lines × 2) datafusion/functions/src/regex/regexpreplace.rs:379 — datafusion/functions/src/regex/regexpreplace.rs:379-399 | datafusion/functions/src/regex/regexpreplace.rs:446-466 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (21 lines × 2) datafusion/functions-aggregate/src/percentile_cont.rs:318 — datafusion/functions-aggregate/src/percentile_cont.rs:318-338 | datafusion/functions-aggregate/src/percentile_cont.rs:351-371 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (21 lines × 2) datafusion/physical-expr-common/src/binary_map.rs:592 — datafusion/physical-expr-common/src/binary_map.rs:592-612 | datafusion/physical-plan/src/aggregates/group_values/multi_group_by/bytes.rs:366-386 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (21 lines × 2) datafusion/physical-plan/src/joins/hash_join/exec.rs:1458 — datafusion/physical-plan/src/joins/hash_join/exec.rs:1458-1478 | datafusion/physical-plan/src/joins/nested_loop_join.rs:526-546 — before extracting anything, compare `datafusion/physical-plan/src/joins/hash_join/exec.rs` and `datafusion/physical-plan/src/joins/nested_loop_join.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 67 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (18 lines × 2) · ×5
  • Duplicated block (18 lines × 2) datafusion/common/src/hash_utils/build_hasher.rs:227 — datafusion/common/src/hash_utils/build_hasher.rs:227-244 | datafusion/common/src/hash_utils/build_hasher.rs:272-289 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18 lines × 2) datafusion/functions-aggregate/src/min_max/min_max_bytes.rs:517 — datafusion/functions-aggregate/src/min_max/min_max_bytes.rs:517-534 | datafusion/functions-aggregate/src/min_max/min_max_struct.rs:311-328 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (18 lines × 2) datafusion/functions-nested/src/cosine_distance.rs:101 — datafusion/functions-nested/src/cosine_distance.rs:101-118 | datafusion/functions-nested/src/inner_product.rs:103-120 — before extracting anything, compare `datafusion/functions-nested/src/cosine_distance.rs` and `datafusion/functions-nested/src/inner_product.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 86 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (18 lines × 2) datafusion/physical-expr/src/intervals/cp_solver.rs:659 — datafusion/physical-expr/src/intervals/cp_solver.rs:659-676 | datafusion/physical-expr/src/statistics/stats_solver.rs:182-199 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (18 lines × 2) datafusion/physical-plan/src/aggregates/mod.rs:2020 — datafusion/physical-plan/src/aggregates/mod.rs:2020-2037 | datafusion/physical-plan/src/aggregates/mod.rs:2077-2094 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (17 lines × 2) · ×5
  • Duplicated block (17 lines × 2) datafusion/functions/src/math/gcd.rs:95 — datafusion/functions/src/math/gcd.rs:95-111 | datafusion/functions/src/math/lcm.rs:91-107 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (17 lines × 2) datafusion/functions/src/regex/regexpcount.rs:318 — datafusion/functions/src/regex/regexpcount.rs:318-334 | datafusion/functions/src/regex/regexpcount.rs:393-409 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (17 lines × 2) datafusion/functions/src/unicode/lpad.rs:376 — datafusion/functions/src/unicode/lpad.rs:376-392 | datafusion/functions/src/unicode/rpad.rs:375-391 — before extracting anything, compare `datafusion/functions/src/unicode/lpad.rs` and `datafusion/functions/src/unicode/rpad.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 229 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (17 lines × 2) datafusion/functions-aggregate/src/stddev.rs:100 — datafusion/functions-aggregate/src/stddev.rs:100-116 | datafusion/functions-aggregate/src/stddev.rs:208-224 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (17 lines × 2) datafusion/physical-expr/src/higher_order_function.rs:390 — datafusion/physical-expr/src/higher_order_function.rs:390-406 | datafusion/physical-expr/src/scalar_function.rs:256-272 — before extracting anything, compare `datafusion/physical-expr/src/higher_order_function.rs` and `datafusion/physical-expr/src/scalar_function.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 42 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (10–11 lines × 2) · ×5
  • Duplicated block (10–11 lines × 2) datafusion/common/src/dfschema.rs:638 — datafusion/common/src/dfschema.rs:638-648 | datafusion/common/src/dfschema.rs:1322-1331 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10–11 lines × 2) datafusion/expr/src/logical_plan/builder.rs:1312 — datafusion/expr/src/logical_plan/builder.rs:1312-1322 | datafusion/expr/src/logical_plan/builder.rs:1324-1333 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10–11 lines × 2) datafusion/physical-plan/src/aggregates/ordered_final_stream.rs:416 — datafusion/physical-plan/src/aggregates/ordered_final_stream.rs:416-425 | datafusion/physical-plan/src/aggregates/ordered_partial_stream.rs:378-388 — before extracting anything, compare `datafusion/physical-plan/src/aggregates/ordered_final_stream.rs` and `datafusion/physical-plan/src/aggregates/ordered_partial_stream.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 50 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (10–11 lines × 2) datafusion/physical-plan/src/joins/nested_loop_join.rs:2654 — datafusion/physical-plan/src/joins/nested_loop_join.rs:2654-2664 | datafusion/physical-plan/src/joins/nested_loop_join.rs:3014-3023 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10–11 lines × 2) datafusion/sql/src/unparser/plan.rs:2527 — datafusion/sql/src/unparser/plan.rs:2527-2536 | datafusion/sql/src/unparser/utils.rs:393-403 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (10 lines × 4) · ×5
  • Duplicated block (10 lines × 4) datafusion/common/src/scalar/mod.rs:4458 — datafusion/common/src/scalar/mod.rs:4458-4467 | datafusion/common/src/scalar/mod.rs:4477-4486 | datafusion/common/src/scalar/mod.rs:4496-4505 | datafusion/common/src/scalar/mod.rs:4515-4524 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (10 lines × 4) datafusion/ffi/src/table_provider.rs:297 — datafusion/ffi/src/table_provider.rs:297-306 | datafusion/ffi/src/table_provider.rs:378-387 | datafusion/ffi/src/table_provider.rs:416-425 | datafusion/ffi/src/table_provider.rs:477-486 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (10 lines × 4) datafusion/functions/src/math/nanvl.rs:76 — datafusion/functions/src/math/nanvl.rs:76-85 | datafusion/functions/src/math/round.rs:193-202 | datafusion/functions/src/math/trunc.rs:88-102 | datafusion/spark/src/function/math/round.rs:69-79 — before extracting anything, compare `datafusion/functions/src/math/round.rs` and `datafusion/functions/src/math/trunc.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 4) datafusion/physical-plan/src/filter.rs:508 — datafusion/physical-plan/src/filter.rs:508-517 | datafusion/physical-plan/src/joins/asof_join.rs:293-302 | datafusion/physical-plan/src/joins/hash_join/exec.rs:1373-1382 | datafusion/physical-plan/src/joins/nested_loop_join.rs:436-445 — before extracting anything, compare `datafusion/physical-plan/src/joins/asof_join.rs` and `datafusion/physical-plan/src/joins/hash_join/exec.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 30 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 4) datafusion/proto-common/src/to_proto/mod.rs:436 — datafusion/proto-common/src/to_proto/mod.rs:436-445 | datafusion/proto-common/src/to_proto/mod.rs:452-461 | datafusion/proto-common/src/to_proto/mod.rs:468-477 | datafusion/proto-common/src/to_proto/mod.rs:484-493 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (9–10 lines × 2) · ×5
  • Duplicated block (9–10 lines × 2) datafusion/functions/src/core/overlay.rs:283 — datafusion/functions/src/core/overlay.rs:283-291 | datafusion/functions/src/core/overlay.rs:295-304 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9–10 lines × 2) datafusion/functions/src/string/chr.rs:52 — datafusion/functions/src/string/chr.rs:52-60 | datafusion/functions/src/string/chr.rs:64-73 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9–10 lines × 2) datafusion/functions/src/string/repeat.rs:324 — datafusion/functions/src/string/repeat.rs:324-332 | datafusion/functions/src/string/split_part.rs:567-576 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (9–10 lines × 2) datafusion/functions/src/string/repeat.rs:332 — datafusion/functions/src/string/repeat.rs:332-340 | datafusion/functions/src/string/repeat.rs:345-354 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9–10 lines × 2) datafusion/physical-plan/src/joins/asof_join.rs:746 — datafusion/physical-plan/src/joins/asof_join.rs:746-754 | datafusion/physical-plan/src/joins/sort_merge_join/exec.rs:874-883 — before extracting anything, compare `datafusion/physical-plan/src/joins/asof_join.rs` and `datafusion/physical-plan/src/joins/sort_merge_join/exec.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 48 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (8 lines × 3) · ×5
  • Duplicated block (8 lines × 3) datafusion/functions/src/string/levenshtein.rs:258 — datafusion/functions/src/string/levenshtein.rs:258-265 | datafusion/functions/src/string/levenshtein.rs:278-285 | datafusion/functions/src/string/levenshtein.rs:298-305 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (8 lines × 3) datafusion/functions-aggregate/src/average.rs:302 — datafusion/functions-aggregate/src/average.rs:302-309 | datafusion/functions-aggregate/src/average.rs:324-331 | datafusion/functions-aggregate/src/average.rs:427-434 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (8 lines × 3) datafusion/functions-aggregate/src/covariance.rs:348 — datafusion/functions-aggregate/src/covariance.rs:348-355 | datafusion/functions-aggregate/src/regr.rs:674-681 | datafusion/functions-aggregate/src/variance.rs:391-398 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
  • Duplicated block (8 lines × 3) datafusion/functions-table/src/generate_series.rs:807 — datafusion/functions-table/src/generate_series.rs:807-814 | datafusion/functions-table/src/generate_series.rs:833-840 | datafusion/functions-table/src/generate_series.rs:861-868 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (8 lines × 3) datafusion/spark/src/function/datetime/add_months.rs:66 — datafusion/spark/src/function/datetime/add_months.rs:66-74 | datafusion/spark/src/function/datetime/date_add.rs:79-86 | datafusion/spark/src/function/datetime/date_sub.rs:72-79 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
D1 · Cyclomatic Complexity · datafusion_functions_nested · ×4
  • datafusion_functions_nested::string::compute_array_to_string (cyclomatic 38) datafusion/functions-nested/src/string.rs:592 — datafusion_functions_nested::string::compute_array_to_string has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • datafusion_functions_nested::arrays_zip::arrays_zip_inner (cyclomatic 18) datafusion/functions-nested/src/arrays_zip.rs:161 — datafusion_functions_nested::arrays_zip::arrays_zip_inner has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • datafusion_functions_nested::set_ops::generic_set_loop (cyclomatic 17) datafusion/functions-nested/src/set_ops.rs:404 — datafusion_functions_nested::set_ops::generic_set_loop has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • datafusion_functions_nested::resize::general_list_resize (cyclomatic 16) datafusion/functions-nested/src/resize.rs:200 — datafusion_functions_nested::resize::general_list_resize has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D2 · Cognitive Complexity · TreeRenderVisitor · ×4
  • TreeRenderVisitor::render_box_content (cognitive 65) datafusion/physical-plan/src/display.rs:1072 — TreeRenderVisitor::render_box_content has cognitive complexity 65 (threshold 15). Drivers by points: if/else 21 (53 pts), loops 4 (7 pts), boolean chains 5 (nesting depth added 35). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • TreeRenderVisitor::split_up_extra_info (cognitive 24) datafusion/physical-plan/src/display.rs:1271 — TreeRenderVisitor::split_up_extra_info has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 4 (9 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TreeRenderVisitor::render_bottom_layer (cognitive 20) datafusion/physical-plan/src/display.rs:1213 — TreeRenderVisitor::render_bottom_layer has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TreeRenderVisitor::render_top_layer (cognitive 18) datafusion/physical-plan/src/display.rs:1016 — TreeRenderVisitor::render_top_layer has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MaterializingSortMergeJoinStream · ×4
  • MaterializingSortMergeJoinStream::freeze_streamed_matched (cognitive 42) datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs:1547 — MaterializingSortMergeJoinStream::freeze_streamed_matched has cognitive complexity 42 (threshold 15). Drivers by points: if/else 15 (27 pts), loops 2 (9 pts), match/switch 1 (6 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • MaterializingSortMergeJoinStream::join (cognitive 25) datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs:613 — MaterializingSortMergeJoinStream::join has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 2 (4 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • MaterializingSortMergeJoinStream::extend_buffered_group (cognitive 22) datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs:1295 — MaterializingSortMergeJoinStream::extend_buffered_group has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 2 (4 pts), match/switch 1 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • MaterializingSortMergeJoinStream::materialize_right_columns (cognitive 22) datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs:1683 — MaterializingSortMergeJoinStream::materialize_right_columns has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 3 (5 pts), match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · datafusion_expr_common · ×4
  • datafusion_expr_common::type_coercion::binary::try_type_union_resolution_with_struct (cognitive 32) datafusion/expr-common/src/type_coercion/binary.rs:858 — datafusion_expr_common::type_coercion::binary::try_type_union_resolution_with_struct has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (23 pts), loops 5 (9 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_expr_common::casts::try_cast_numeric_literal (cognitive 26) datafusion/expr-common/src/casts.rs:239 — datafusion_expr_common::casts::try_cast_numeric_literal has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (17 pts), match/switch 5 (7 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • datafusion_expr_common::statistics::create_bernoulli_from_comparison (cognitive 21) datafusion/expr-common/src/statistics.rs:722 — datafusion_expr_common::statistics::create_bernoulli_from_comparison has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (18 pts), match/switch 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_expr_common::interval_arithmetic::satisfy_greater (cognitive 19) datafusion/expr-common/src/interval_arithmetic.rs:1403 — datafusion_expr_common::interval_arithmetic::satisfy_greater has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 5 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · NestedLoopJoinStream · ×4
  • NestedLoopJoinStream::process_left_range_join (cognitive 31) datafusion/physical-plan/src/joins/nested_loop_join.rs:3186 — NestedLoopJoinStream::process_left_range_join has cognitive complexity 31 (threshold 15). Drivers by points: if/else 17 (24 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • NestedLoopJoinStream::poll_next (cognitive 27) datafusion/physical-plan/src/joins/nested_loop_join.rs:2103 — NestedLoopJoinStream::poll_next has cognitive complexity 27 (threshold 15). Drivers by points: match/switch 9 (26 pts), loops 1 (nesting depth added 17). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • NestedLoopJoinStream::handle_emit_global_right_unmatched (cognitive 20) datafusion/physical-plan/src/joins/nested_loop_join.rs:2982 — NestedLoopJoinStream::handle_emit_global_right_unmatched has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (11 pts), match/switch 5 (9 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • NestedLoopJoinStream::handle_emit_left_unmatched_memory_limited (cognitive 17) datafusion/physical-plan/src/joins/nested_loop_join.rs:2893 — NestedLoopJoinStream::handle_emit_left_unmatched_memory_limited has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 7 (13 pts), if/else 3, boolean chains 1 (nesting depth added 6). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D4 · Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) · ×4
  • Members sharing a duplicated core (6 members, 50+ identical tokens) datafusion/ffi/src/catalog_provider.rs:236 — datafusion/ffi/src/catalog_provider.rs:236-246 | datafusion/ffi/src/catalog_provider_list.rs:200-210 | datafusion/ffi/src/schema_provider.rs:246-256 | datafusion/ffi/src/table_provider.rs:551-566 | datafusion/ffi/src/table_provider_factory.rs:104-114 | datafusion/ffi/src/udtf.rs:204-215 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) datafusion/ffi/src/query_planner.rs:140 — datafusion/ffi/src/query_planner.rs:140-177 | datafusion/ffi/src/table_provider.rs:292-330 | datafusion/ffi/src/table_provider.rs:337-367 | datafusion/ffi/src/table_provider.rs:373-404 | datafusion/ffi/src/table_provider.rs:411-470 | datafusion/ffi/src/table_provider.rs:475-496 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) datafusion/functions-nested/src/string.rs:204 — datafusion/functions-nested/src/string.rs:204-222 | datafusion/functions/src/crypto/digest.rs:71-87 | datafusion/functions/src/regex/regexplike.rs:82-99 | datafusion/functions/src/string/btrim.rs:91-110 | datafusion/functions/src/string/ltrim.rs:96-114 | datafusion/functions/src/string/rtrim.rs:96-114 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) datafusion/functions/src/math/abs.rs:175 — datafusion/functions/src/math/abs.rs:175-188 | datafusion/functions/src/math/monotonicity.rs:344-357 | datafusion/functions/src/math/monotonicity.rs:447-458 | datafusion/functions/src/math/monotonicity.rs:485-496 | datafusion/functions/src/math/monotonicity.rs:523-534 | datafusion/functions/src/math/monotonicity.rs:650-661 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
D4 · Code Duplication · Duplicated block (19–20 lines × 2) · ×4
  • Duplicated block (19–20 lines × 2) datafusion/datasource-arrow/src/file_format.rs:283 — datafusion/datasource-arrow/src/file_format.rs:283-301 | datafusion/datasource-avro/src/file_format.rs:234-253 — before extracting anything, compare `datafusion/datasource-arrow/src/file_format.rs` and `datafusion/datasource-avro/src/file_format.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 64 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (19–20 lines × 2) datafusion/datasource-json/src/file_format.rs:281 — datafusion/datasource-json/src/file_format.rs:281-300 | datafusion/datasource-json/src/file_format.rs:304-322 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (19–20 lines × 2) datafusion/functions/src/binaries.rs:230 — datafusion/functions/src/binaries.rs:230-248 | datafusion/functions/src/strings.rs:281-300 — before extracting anything, compare `datafusion/functions/src/binaries.rs` and `datafusion/functions/src/strings.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (19–20 lines × 2) datafusion/functions/src/math/round.rs:659 — datafusion/functions/src/math/round.rs:659-677 | datafusion/functions/src/math/round.rs:697-716 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (13 lines × 3) · ×4
  • Duplicated block (13 lines × 3) datafusion/functions-nested/src/cosine_distance.rs:113 — datafusion/functions-nested/src/cosine_distance.rs:113-125 | datafusion/functions-nested/src/inner_product.rs:115-127 | datafusion/functions-nested/src/utils.rs:371-383 — before extracting anything, compare `datafusion/functions-nested/src/cosine_distance.rs` and `datafusion/functions-nested/src/inner_product.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 86 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (13 lines × 3) datafusion/physical-plan/src/aggregates/group_values/multi_group_by/bytes.rs:149 — datafusion/physical-plan/src/aggregates/group_values/multi_group_by/bytes.rs:149-161 | datafusion/physical-plan/src/aggregates/group_values/multi_group_by/bytes_view.rs:155-167 | datafusion/physical-plan/src/aggregates/group_values/multi_group_by/fixed_size_binary.rs:174-186 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
  • Duplicated block (13 lines × 3) datafusion/sql/src/parser.rs:839 — datafusion/sql/src/parser.rs:839-851 | datafusion/sql/src/parser.rs:1316-1328 | datafusion/sql/src/parser.rs:1403-1415 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (13 lines × 3) datafusion/spark/src/function/hash/sha2.rs:131 — datafusion/spark/src/function/hash/sha2.rs:131-143 | datafusion/spark/src/function/hash/sha2.rs:145-157 | datafusion/spark/src/function/hash/sha2.rs:158-170 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (8–9 lines × 2) · ×4
  • Duplicated block (8–9 lines × 2) datafusion/expr/src/expr.rs:2813 — datafusion/expr/src/expr.rs:2813-2821 | datafusion/optimizer/src/eliminate_filter.rs:215-222 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8–9 lines × 2) datafusion/functions/src/unicode/find_in_set.rs:280 — datafusion/functions/src/unicode/find_in_set.rs:280-287 | datafusion/functions/src/unicode/find_in_set.rs:308-316 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8–9 lines × 2) datafusion/functions-aggregate/src/lib.rs:196 — datafusion/functions-aggregate/src/lib.rs:196-204 | datafusion/spark/src/lib.rs:228-235 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8–9 lines × 2) datafusion/spark/src/function/map/str_to_map.rs:252 — datafusion/spark/src/function/map/str_to_map.rs:252-259 | datafusion/spark/src/function/map/str_to_map.rs:276-284 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (8 lines × 6) · ×4
  • Duplicated block (8 lines × 6) datafusion/ffi/src/catalog_provider.rs:237 — datafusion/ffi/src/catalog_provider.rs:237-244 | datafusion/ffi/src/catalog_provider_list.rs:201-208 | datafusion/ffi/src/schema_provider.rs:247-254 | datafusion/ffi/src/table_provider.rs:552-562 | datafusion/ffi/src/table_provider_factory.rs:105-112 | datafusion/ffi/src/udtf.rs:205-212 — before extracting anything, compare `datafusion/ffi/src/catalog_provider.rs` and `datafusion/ffi/src/catalog_provider_list.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 45 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 6) datafusion/ffi/src/query_planner.rs:146 — datafusion/ffi/src/query_planner.rs:146-153 | datafusion/ffi/src/table_provider.rs:299-306 | datafusion/ffi/src/table_provider.rs:342-349 | datafusion/ffi/src/table_provider.rs:380-387 | datafusion/ffi/src/table_provider.rs:418-425 | datafusion/ffi/src/table_provider.rs:479-486 — there are 6 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 6 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (8 lines × 6) datafusion/functions-nested/src/string.rs:205 — datafusion/functions-nested/src/string.rs:205-212 | datafusion/functions/src/crypto/digest.rs:72-79 | datafusion/functions/src/regex/regexplike.rs:83-90 | datafusion/functions/src/string/btrim.rs:92-99 | datafusion/functions/src/string/ltrim.rs:97-104 | datafusion/functions/src/string/rtrim.rs:97-104 — before extracting anything, compare `datafusion/functions/src/string/ltrim.rs` and `datafusion/functions/src/string/rtrim.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 6) datafusion/physical-plan/src/aggregates/mod.rs:2211 — datafusion/physical-plan/src/aggregates/mod.rs:2211-2218 | datafusion/physical-plan/src/buffer.rs:177-184 | datafusion/physical-plan/src/coalesce_partitions.rs:166-173 | datafusion/physical-plan/src/filter.rs:600-607 | datafusion/physical-plan/src/limit.rs:185-192 | datafusion/physical-plan/src/limit.rs:466-473 — there are 6 copies across 5 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 6 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (8 lines × 4) · ×4
  • Duplicated block (8 lines × 4) datafusion/ffi/src/udaf/accumulator.rs:107 — datafusion/ffi/src/udaf/accumulator.rs:107-114 | datafusion/ffi/src/udaf/accumulator.rs:181-188 | datafusion/ffi/src/udwf/partition_evaluator.rs:114-121 | datafusion/ffi/src/udwf/partition_evaluator.rs:139-146 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (8 lines × 4) datafusion/functions/src/math/monotonicity.rs:448 — datafusion/functions/src/math/monotonicity.rs:448-455 | datafusion/functions/src/math/monotonicity.rs:486-493 | datafusion/functions/src/math/monotonicity.rs:524-531 | datafusion/functions/src/math/monotonicity.rs:651-658 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (8 lines × 4) datafusion/expr/src/higher_order_function.rs:1099 — datafusion/expr/src/higher_order_function.rs:1099-1106 | datafusion/expr/src/udaf.rs:1542-1550 | datafusion/expr/src/udf.rs:1102-1109 | datafusion/expr/src/udwf.rs:506-514 — before extracting anything, compare `datafusion/expr/src/higher_order_function.rs` and `datafusion/expr/src/udf.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 41 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 4) datafusion/physical-plan/src/coalesce_partitions.rs:349 — datafusion/physical-plan/src/coalesce_partitions.rs:349-356 | datafusion/physical-plan/src/filter.rs:888-895 | datafusion/physical-plan/src/projection.rs:628-635 | datafusion/physical-plan/src/sorts/sort_preserving_merge.rs:252-259 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times.
D4 · Code Duplication · Duplicated block (5 lines × 3) · ×4
  • Duplicated block (5 lines × 3) datafusion/common/src/stats.rs:148 — datafusion/common/src/stats.rs:148-152 | datafusion/common/src/stats.rs:166-170 | datafusion/common/src/stats.rs:184-188 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (5 lines × 3) datafusion/ffi/src/udaf/mod.rs:386 — datafusion/ffi/src/udaf/mod.rs:386-390 | datafusion/ffi/src/udf/mod.rs:299-303 | datafusion/ffi/src/udwf/mod.rs:228-232 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (5 lines × 3) datafusion/functions-aggregate/src/variance.rs:622 — datafusion/functions-aggregate/src/variance.rs:622-626 | datafusion/functions-aggregate/src/variance.rs:656-660 | datafusion/functions-aggregate/src/variance.rs:682-686 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (5 lines × 3) datafusion/physical-plan/src/joins/asof_join.rs:745 — datafusion/physical-plan/src/joins/asof_join.rs:745-749 | datafusion/physical-plan/src/joins/nested_loop_join.rs:1025-1029 | datafusion/physical-plan/src/joins/sort_merge_join/exec.rs:873-877 — before extracting anything, compare `datafusion/physical-plan/src/joins/asof_join.rs` and `datafusion/physical-plan/src/joins/sort_merge_join/exec.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 48 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D1 · Cyclomatic Complexity · Unparser · ×3
  • Unparser::select_to_sql_recursively (cyclomatic 124) datafusion/sql/src/unparser/plan.rs:837 — Unparser::select_to_sql_recursively has cyclomatic complexity 124 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Unparser::expr_to_sql_inner (cyclomatic 61) datafusion/sql/src/unparser/expr.rs:156 — Unparser::expr_to_sql_inner has cyclomatic complexity 61 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: Unparser::scalar_to_sql (cyclomatic 82) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • Unparser::unparse_table_scan_pushdown (cyclomatic 24) datafusion/sql/src/unparser/plan.rs:2515 — Unparser::unparse_table_scan_pushdown has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CsvOptions · ×3
  • CsvOptions::deserialize (cyclomatic 67) datafusion/proto-common/src/generated/pbjson.rs:1841 — CsvOptions::deserialize has cyclomatic complexity 67 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • CsvOptions::serialize (cyclomatic 45) datafusion/proto-common/src/generated/pbjson.rs:1669 — CsvOptions::serialize has cyclomatic complexity 45 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: ScalarValue::serialize (cyclomatic 47) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • CsvOptions::try_from (cyclomatic 25) datafusion/proto-models/src/from_proto.rs:195 — CsvOptions::try_from has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · CsvWriterOptions · ×3
  • CsvWriterOptions::deserialize (cyclomatic 52) datafusion/proto-common/src/generated/pbjson.rs:2384 — CsvWriterOptions::deserialize has cyclomatic complexity 52 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • CsvWriterOptions::serialize (cyclomatic 35) datafusion/proto-common/src/generated/pbjson.rs:2264 — CsvWriterOptions::serialize has cyclomatic complexity 35 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: ScalarValue::serialize (cyclomatic 47) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • CsvWriterOptions::try_from (cyclomatic 22) datafusion/proto-common/src/from_proto/mod.rs:990 — CsvWriterOptions::try_from has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · datafusion_physical_expr · ×3
  • datafusion_physical_expr::planner::create_physical_expr (cyclomatic 48) datafusion/physical-expr/src/planner.rs:133 — datafusion_physical_expr::planner::create_physical_expr has cyclomatic complexity 48 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • datafusion_physical_expr::expressions::in_list::primitive_filter::instantiate_branchless_filter (cyclomatic 32) datafusion/physical-expr/src/expressions/in_list/primitive_filter.rs:84 — datafusion_physical_expr::expressions::in_list::primitive_filter::instantiate_branchless_filter has cyclomatic complexity 32 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • datafusion_physical_expr::expressions::binary::check_short_circuit (cyclomatic 20) datafusion/physical-expr/src/expressions/binary.rs:1260 — datafusion_physical_expr::expressions::binary::check_short_circuit has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D2 · Cognitive Complexity · CsvOptions · ×3
  • CsvOptions::deserialize (cognitive 70) datafusion/proto-common/src/generated/pbjson.rs:1841 — CsvOptions::deserialize has cognitive complexity 70 (threshold 15). Drivers by points: if/else 22 (66 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 45). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CsvOptions::serialize (cognitive 44) datafusion/proto-common/src/generated/pbjson.rs:1669 — CsvOptions::serialize has cognitive complexity 44 (threshold 15). Drivers by points: if/else 44. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • CsvOptions::try_from (cognitive 34) datafusion/proto-models/src/from_proto.rs:195 — CsvOptions::try_from has cognitive complexity 34 (threshold 15). Drivers by points: if/else 32, match/switch 2. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · LogicalPlan · ×3
  • LogicalPlan::display (cognitive 57) datafusion/expr/src/logical_plan/plan.rs:2068 — LogicalPlan::display has cognitive complexity 57 (threshold 15). Drivers by points: if/else 17 (34 pts), match/switch 8 (17 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LogicalPlan::with_new_exprs (cognitive 29) datafusion/expr/src/logical_plan/plan.rs:837 — LogicalPlan::with_new_exprs has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (15 pts), match/switch 5 (10 pts), loops 2 (4 pts) (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • LogicalPlan::max_rows (cognitive 16) datafusion/expr/src/logical_plan/plan.rs:1446 — LogicalPlan::max_rows has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 5 (10 pts), if/else 4 (6 pts) (nesting depth added 7). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · CsvWriterOptions · ×3
  • CsvWriterOptions::deserialize (cognitive 55) datafusion/proto-common/src/generated/pbjson.rs:2384 — CsvWriterOptions::deserialize has cognitive complexity 55 (threshold 15). Drivers by points: if/else 17 (51 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CsvWriterOptions::serialize (cognitive 34) datafusion/proto-common/src/generated/pbjson.rs:2264 — CsvWriterOptions::serialize has cognitive complexity 34 (threshold 15). Drivers by points: if/else 34. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • CsvWriterOptions::try_from (cognitive 31) datafusion/proto-common/src/from_proto/mod.rs:990 — CsvWriterOptions::try_from has cognitive complexity 31 (threshold 15). Drivers by points: if/else 20 (29 pts), match/switch 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · datafusion_cli · ×3
  • datafusion_cli::exec::exec_from_repl (cognitive 48) datafusion-cli/src/exec.rs:124 — datafusion_cli::exec::exec_from_repl has cognitive complexity 48 (threshold 15). Drivers by points: if/else 8 (29 pts), match/switch 4 (15 pts), loops 2 (4 pts) (nesting depth added 34). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • datafusion_cli::main_inner (cognitive 18) datafusion-cli/src/main.rs:200 — datafusion_cli::main_inner has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (15 pts), match/switch 2 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_cli::object_storage::get_s3_object_store_builder_inner (cognitive 18) datafusion-cli/src/object_storage.rs:86 — datafusion_cli::object_storage::get_s3_object_store_builder_inner has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Expr · ×3
  • Expr::fmt (cognitive 45) datafusion/expr/src/expr.rs:3559 — Expr::fmt has cognitive complexity 45 (threshold 15). Drivers by points: if/else 18 (29 pts), match/switch 7 (14 pts), loops 1 (2 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Expr::normalize_eq (cognitive 36) datafusion/expr/src/expr.rs:2365 — Expr::normalize_eq has cognitive complexity 36 (threshold 15). Drivers by points: boolean chains 22, match/switch 5 (9 pts), if/else 3 (5 pts) (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Expr::nullable (cognitive 30) datafusion/expr/src/expr_schema.rs:294 — Expr::nullable has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (14 pts), match/switch 7 (13 pts), boolean chains 3 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · MultiLevelMergeBuilder · ×3
  • MultiLevelMergeBuilder::get_sorted_spill_files_to_merge (cognitive 32) datafusion/physical-plan/src/sorts/multi_level_merge.rs:568 — MultiLevelMergeBuilder::get_sorted_spill_files_to_merge has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (22 pts), match/switch 2 (5 pts), boolean chains 4, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • MultiLevelMergeBuilder::split_spill_file_in_half (cognitive 29) datafusion/physical-plan/src/sorts/multi_level_merge.rs:710 — MultiLevelMergeBuilder::split_spill_file_in_half has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 6, loops 1 (2 pts), match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • MultiLevelMergeBuilder::merge_sorted_runs_within_mem_limit (cognitive 25) datafusion/physical-plan/src/sorts/multi_level_merge.rs:323 — MultiLevelMergeBuilder::merge_sorted_runs_within_mem_limit has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (18 pts), match/switch 2 (3 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · InformationSchemaConfig · ×3
  • InformationSchemaConfig::make_columns (cognitive 28) datafusion/catalog/src/information_schema.rs:199 — InformationSchemaConfig::make_columns has cognitive complexity 28 (threshold 15). Drivers by points: loops 4 (15 pts), if/else 3 (13 pts) (nesting depth added 21). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • InformationSchemaConfig::make_tables (cognitive 23) datafusion/catalog/src/information_schema.rs:111 — InformationSchemaConfig::make_tables has cognitive complexity 23 (threshold 15). Drivers by points: if/else 3 (13 pts), loops 4 (10 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • InformationSchemaConfig::make_views (cognitive 21) datafusion/catalog/src/information_schema.rs:169 — InformationSchemaConfig::make_views has cognitive complexity 21 (threshold 15). Drivers by points: if/else 3 (13 pts), loops 3 (8 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DictionaryGroupValuesColumn · ×3
  • DictionaryGroupValuesColumn::vectorized_append (cognitive 28) datafusion/physical-plan/src/aggregates/group_values/multi_group_by/dictionary.rs:411 — DictionaryGroupValuesColumn::vectorized_append has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (24 pts), loops 2 (4 pts) (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • DictionaryGroupValuesColumn::vectorized_equal_to (cognitive 24) datafusion/physical-plan/src/aggregates/group_values/multi_group_by/dictionary.rs:341 — DictionaryGroupValuesColumn::vectorized_equal_to has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • DictionaryGroupValuesColumn::take_n (cognitive 20) datafusion/physical-plan/src/aggregates/group_values/multi_group_by/dictionary.rs:522 — DictionaryGroupValuesColumn::take_n has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TDigest · ×3
  • TDigest::estimate_quantile (cognitive 26) datafusion/functions-aggregate-common/src/tdigest.rs:449 — TDigest::estimate_quantile has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (20 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TDigest::merge_digests (cognitive 23) datafusion/functions-aggregate-common/src/tdigest.rs:351 — TDigest::merge_digests has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 5 (8 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TDigest::merge_sorted_f64 (cognitive 21) datafusion/functions-aggregate-common/src/tdigest.rs:216 — TDigest::merge_sorted_f64 has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · datafusion_sql · ×3
  • datafusion_sql::unparser::rewrite::rewrite_plan_for_sort_on_non_projected_fields (cognitive 26) datafusion/sql/src/unparser/rewrite.rs:186 — datafusion_sql::unparser::rewrite::rewrite_plan_for_sort_on_non_projected_fields has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 4 (10 pts), match/switch 3 (5 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_sql::unparser::utils::try_transform_to_simple_table_scan_with_filters (cognitive 20) datafusion/sql/src/unparser/utils.rs:372 — datafusion_sql::unparser::utils::try_transform_to_simple_table_scan_with_filters has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 2 (4 pts), match/switch 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_sql::utils::check_columns_satisfy_exprs (cognitive 17) datafusion/sql/src/utils.rs:139 — datafusion_sql::utils::check_columns_satisfy_exprs has cognitive complexity 17 (threshold 15). Drivers by points: loops 5 (14 pts), match/switch 2 (3 pts) (nesting depth added 10). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · datafusion_sqllogictest · ×3
  • datafusion_sqllogictest::bin::sqllogictests::run_tests (cognitive 24) datafusion/sqllogictest/bin/sqllogictests.rs:124 — datafusion_sqllogictest::bin::sqllogictests::run_tests has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 5, loops 2 (4 pts), match/switch 3 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • datafusion_sqllogictest::util::df_value_validator (cognitive 19) datafusion/sqllogictest/src/util.rs:80 — datafusion_sqllogictest::util::df_value_validator has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_sqllogictest::bin::sqllogictests::run_file_in_runner (cognitive 17) datafusion/sqllogictest/bin/sqllogictests.rs:711 — datafusion_sqllogictest::bin::sqllogictests::run_file_in_runner has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GroupValuesColumn · ×3
  • GroupValuesColumn::emit (cognitive 22) datafusion/physical-plan/src/aggregates/group_values/multi_group_by/mod.rs:1174 — GroupValuesColumn::emit has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 2 (4 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • GroupValuesColumn::scalarized_equal_to_remaining (cognitive 19) datafusion/physical-plan/src/aggregates/group_values/multi_group_by/mod.rs:839 — GroupValuesColumn::scalarized_equal_to_remaining has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 3 (7 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • GroupValuesColumn::scalarized_intern (cognitive 18) datafusion/physical-plan/src/aggregates/group_values/multi_group_by/mod.rs:361 — GroupValuesColumn::scalarized_intern has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (6 pts), match/switch 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D29 · Static Analysis (SAST) · REDACTED · ×3
  • REDACTED
  • REDACTED
  • REDACTED
D3 · God Classes · TooManyFunctions · ×3
  • TooManyFunctions: datafusion_common::cast datafusion/common/src/cast.rs:48 — TooManyFunctions — 55 free functions. The bar is 30 free functions; this is 25 over it, 1.83× the bar. This type is on a published API surface — a cargo-semver-checks gate in CI (.github/workflows/breaking_changes_detector.yml) declares its compatibility contractual — so moving members onto a smaller type is a breaking change for every consumer, not a local refactor. To reduce it, treat the split as an API migration: move each cohesive group onto its own published type and keep the old members as deprecated forwards for a deprecation period, removing them at the next compatibility break. Where the surface has to stay as it is, that is a decision to record rather than a change to make.
  • TooManyFunctions: datafusion_functions::math::monotonicity datafusion/functions/src/math/monotonicity.rs:27 — TooManyFunctions — 44 free functions. The bar is 30 free functions; this is 14 over it, 1.47× the bar. This type is on a published API surface — a cargo-semver-checks gate in CI (.github/workflows/breaking_changes_detector.yml) declares its compatibility contractual — so moving members onto a smaller type is a breaking change for every consumer, not a local refactor. To reduce it, treat the split as an API migration: move each cohesive group onto its own published type and keep the old members as deprecated forwards for a deprecation period, removing them at the next compatibility break. Where the surface has to stay as it is, that is a decision to record rather than a change to make.
  • TooManyFunctions: datafusion_functions::math::expr_fn datafusion/functions/src/math/mod.rs:399 — TooManyFunctions — 38 free functions. The bar is 30 free functions; this is 8 over it, 1.27× the bar. This type is on a published API surface — a cargo-semver-checks gate in CI (.github/workflows/breaking_changes_detector.yml) declares its compatibility contractual — so moving members onto a smaller type is a breaking change for every consumer, not a local refactor. To reduce it, treat the split as an API migration: move each cohesive group onto its own published type and keep the old members as deprecated forwards for a deprecation period, removing them at the next compatibility break. Where the surface has to stay as it is, that is a decision to record rather than a change to make.
D30 · Dependency Vulnerabilities · Medium advisory (unmaintained) · ×3
  • REDACTED
  • REDACTED
  • REDACTED
D35 · Change Coupling · Change-coupling hub · ×3
  • Change-coupling hub: from_proto.rs → aggregates.rs, tree_node.rs, mod.rs, to_proto.rs datafusion/proto/src/logical_plan/from_proto.rs — `datafusion/proto/src/logical_plan/from_proto.rs` changes together with 4 other files — `datafusion/expr-common/src/type_coercion/aggregates.rs`, `datafusion/expr/src/tree_node.rs`, `datafusion/functions/src/math/mod.rs`, `datafusion/proto/src/logical_plan/to_proto.rs` — none of which declares a dependency on it: one file is the hub of 4 separate couplings, not 4 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 4.
  • Change-coupling hub: to_proto.rs → aggregates.rs, tree_node.rs, mod.rs datafusion/proto/src/logical_plan/to_proto.rs — `datafusion/proto/src/logical_plan/to_proto.rs` changes together with 3 other files — `datafusion/expr-common/src/type_coercion/aggregates.rs`, `datafusion/expr/src/tree_node.rs`, `datafusion/functions/src/math/mod.rs` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
  • Change-coupling hub: external_aggr.rs → run.rs, sort_tpch.rs, run.rs benchmarks/src/bin/external_aggr.rs — `benchmarks/src/bin/external_aggr.rs` changes together with 3 other files — `benchmarks/src/imdb/run.rs`, `benchmarks/src/sort_tpch.rs`, `benchmarks/src/tpch/run.rs` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
D4 · Code Duplication · Duplicated block (30 lines × 2) · ×3
  • Duplicated block (30 lines × 2) datafusion/datasource-arrow/src/file_format.rs:312 — datafusion/datasource-arrow/src/file_format.rs:312-341 | datafusion/datasource-avro/src/file_format.rs:277-306 — before extracting anything, compare `datafusion/datasource-arrow/src/file_format.rs` and `datafusion/datasource-avro/src/file_format.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 64 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (30 lines × 2) datafusion/functions/src/unicode/lpad.rs:205 — datafusion/functions/src/unicode/lpad.rs:205-234 | datafusion/functions/src/unicode/rpad.rs:205-234 — before extracting anything, compare `datafusion/functions/src/unicode/lpad.rs` and `datafusion/functions/src/unicode/rpad.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 229 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (30 lines × 2) datafusion/spark/src/function/datetime/from_utc_timestamp.rs:106 — datafusion/spark/src/function/datetime/from_utc_timestamp.rs:106-135 | datafusion/spark/src/function/datetime/to_utc_timestamp.rs:108-137 — before extracting anything, compare `datafusion/spark/src/function/datetime/from_utc_timestamp.rs` and `datafusion/spark/src/function/datetime/to_utc_timestamp.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 70 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (23 lines × 2) · ×3
  • Duplicated block (23 lines × 2) datafusion/physical-expr/src/expressions/cast.rs:562 — datafusion/physical-expr/src/expressions/cast.rs:562-584 | datafusion/physical-expr/src/expressions/try_cast.rs:302-324 — before extracting anything, compare `datafusion/physical-expr/src/expressions/cast.rs` and `datafusion/physical-expr/src/expressions/try_cast.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 48 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (23 lines × 2) datafusion/physical-plan/src/topk/mod.rs:1468 — datafusion/physical-plan/src/topk/mod.rs:1468-1490 | datafusion/physical-plan/src/topk/mod.rs:1876-1898 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (23 lines × 2) datafusion/sql/src/unparser/dialect.rs:859 — datafusion/sql/src/unparser/dialect.rs:859-881 | datafusion/sql/src/unparser/dialect.rs:1052-1074 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (9–12 lines × 2) · ×3
  • Duplicated block (9–12 lines × 2) datafusion/functions/src/unicode/substr.rs:274 — datafusion/functions/src/unicode/substr.rs:274-285 | datafusion/functions/src/unicode/substr.rs:325-333 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9–12 lines × 2) datafusion/physical-plan/src/joins/piecewise_merge_join/classic_join.rs:236 — datafusion/physical-plan/src/joins/piecewise_merge_join/classic_join.rs:236-244 | datafusion/physical-plan/src/joins/piecewise_merge_join/existence_join.rs:238-249 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (9–12 lines × 2) datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs:1266 — datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs:1266-1274 | datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs:1318-1329 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (7 lines × 4) · ×3
  • Duplicated block (7 lines × 4) datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:216 — datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:216-222 | datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:296-302 | datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:389-395 | datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:483-489 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (7 lines × 4) datafusion/spark/src/function/string/format_string.rs:1276 — datafusion/spark/src/function/string/format_string.rs:1276-1282 | datafusion/spark/src/function/string/format_string.rs:1295-1302 | datafusion/spark/src/function/string/format_string.rs:1315-1321 | datafusion/spark/src/function/string/format_string.rs:1335-1341 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (7 lines × 4) datafusion/physical-plan/src/topk/mod.rs:360 — datafusion/physical-plan/src/topk/mod.rs:360-369 | datafusion/physical-plan/src/topk/mod.rs:1334-1340 | datafusion/physical-plan/src/topk/mod.rs:1649-1656 | datafusion/physical-plan/src/topk/mod.rs:2144-2151 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D5 · Coupling · Off the main sequence · ×3
  • Off the main sequence: datafusion-doc — datafusion-doc: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 6 project(s), so it's rigid to change.
  • Off the main sequence: datafusion-common-runtime — datafusion-common-runtime: abstractness 0.25, instability 0.00, distance 0.75 — the shape a shared-kernel / building-block library has BY DESIGN — concrete and widely depended-on is what makes it useful, and this dimension does not penalise it (the distance is reported for completeness, not as a defect). Worth a look only if it has grown past one coherent kernel into an everything-bucket.
  • Off the main sequence: datafusion-physical-expr-common — datafusion-physical-expr-common: abstractness 0.15, instability 0.11, distance 0.74 — the shape a shared-kernel / building-block library has BY DESIGN — concrete and widely depended-on is what makes it useful, and this dimension does not penalise it (the distance is reported for completeness, not as a defect). Worth a look only if it has grown past one coherent kernel into an everything-bucket.
D1 · Cyclomatic Complexity · DefaultPhysicalPlanner · ×2
  • DefaultPhysicalPlanner::map_logical_node_to_physical (cyclomatic 121) REDACTED:574 — DefaultPhysicalPlanner::map_logical_node_to_physical has cyclomatic complexity 121 (threshold 15). Of this number, 117 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • DefaultPhysicalPlanner::handle_explain (cyclomatic 19) REDACTED:2860 — DefaultPhysicalPlanner::handle_explain has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ParquetOptions · ×2
  • ParquetOptions::deserialize (cyclomatic 109) datafusion/proto-common/src/generated/pbjson.rs:6733 — ParquetOptions::deserialize has cyclomatic complexity 109 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ParquetOptions::serialize (cyclomatic 73) datafusion/proto-common/src/generated/pbjson.rs:6425 — ParquetOptions::serialize has cyclomatic complexity 73 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · LogicalPlanNode · ×2
  • LogicalPlanNode::deserialize (cyclomatic 103) datafusion/proto-models/src/generated/pbjson.rs:14451 — LogicalPlanNode::deserialize has cyclomatic complexity 103 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • LogicalPlanNode::try_into_logical_plan (cyclomatic 75) datafusion/proto/src/logical_plan/mod.rs:499 — LogicalPlanNode::try_into_logical_plan has cyclomatic complexity 75 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · datafusion_proto · ×2
  • datafusion_proto::logical_plan::from_proto::parse_expr (cyclomatic 48) datafusion/proto/src/logical_plan/from_proto.rs:170 — datafusion_proto::logical_plan::from_proto::parse_expr has cyclomatic complexity 48 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • datafusion_proto::logical_plan::to_proto::serialize_expr (cyclomatic 45) datafusion/proto/src/logical_plan/to_proto.rs:53 — datafusion_proto::logical_plan::to_proto::serialize_expr has cyclomatic complexity 45 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · CreateExternalTableNode · ×2
  • CreateExternalTableNode::deserialize (cyclomatic 46) datafusion/proto-models/src/generated/pbjson.rs:4378 — CreateExternalTableNode::deserialize has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • CreateExternalTableNode::serialize (cyclomatic 31) datafusion/proto-models/src/generated/pbjson.rs:4276 — CreateExternalTableNode::serialize has cyclomatic complexity 31 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · FileScanExecConf · ×2
  • FileScanExecConf::deserialize (cyclomatic 43) datafusion/proto-models/src/generated/pbjson.rs:7732 — FileScanExecConf::deserialize has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (AggregateExecNode::deserialize) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • FileScanExecConf::serialize (cyclomatic 29) datafusion/proto-models/src/generated/pbjson.rs:7632 — FileScanExecConf::serialize has cyclomatic complexity 29 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (AggregateExecNode::serialize) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · AggregateExecNode · ×2
  • AggregateExecNode::deserialize (cyclomatic 43) datafusion/proto-models/src/generated/pbjson.rs:213 — AggregateExecNode::deserialize has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (FileScanExecConf::deserialize) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • AggregateExecNode::serialize (cyclomatic 29) datafusion/proto-models/src/generated/pbjson.rs:115 — AggregateExecNode::serialize has cyclomatic complexity 29 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (FileScanExecConf::serialize) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · ListingTableScanNode · ×2
  • ListingTableScanNode::deserialize (cyclomatic 40) datafusion/proto-models/src/generated/pbjson.rs:13142 — ListingTableScanNode::deserialize has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (PlanType::deserialize) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • ListingTableScanNode::serialize (cyclomatic 23) datafusion/proto-models/src/generated/pbjson.rs:13060 — ListingTableScanNode::serialize has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · HashJoinExecNode · ×2
  • HashJoinExecNode::deserialize (cyclomatic 34) datafusion/proto-models/src/generated/pbjson.rs:9804 — HashJoinExecNode::deserialize has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • HashJoinExecNode::serialize (cyclomatic 23) datafusion/proto-models/src/generated/pbjson.rs:9718 — HashJoinExecNode::serialize has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · WindowExprNode · ×2
  • WindowExprNode::deserialize (cyclomatic 31) datafusion/proto-models/src/generated/pbjson.rs:29874 — WindowExprNode::deserialize has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (PhysicalWindowExprNode::deserialize) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • WindowExprNode::serialize (cyclomatic 20) datafusion/proto-models/src/generated/pbjson.rs:29797 — WindowExprNode::serialize has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (PhysicalWindowExprNode::serialize) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · PhysicalWindowExprNode · ×2
  • PhysicalWindowExprNode::deserialize (cyclomatic 31) datafusion/proto-models/src/generated/pbjson.rs:23275 — PhysicalWindowExprNode::deserialize has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (WindowExprNode::deserialize) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • PhysicalWindowExprNode::serialize (cyclomatic 20) datafusion/proto-models/src/generated/pbjson.rs:23200 — PhysicalWindowExprNode::serialize has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (WindowExprNode::serialize) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · datafusion_pruning · ×2
  • datafusion_pruning::pruning_predicate::build_predicate_expression (cyclomatic 31) datafusion/pruning/src/pruning_predicate.rs:1732 — datafusion_pruning::pruning_predicate::build_predicate_expression has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • datafusion_pruning::pruning_predicate::build_compact_in_list_expr (cyclomatic 17) datafusion/pruning/src/pruning_predicate.rs:1538 — datafusion_pruning::pruning_predicate::build_compact_in_list_expr has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · JoinNode · ×2
  • JoinNode::deserialize (cyclomatic 28) datafusion/proto-models/src/generated/pbjson.rs:11601 — JoinNode::deserialize has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 4 other methods here (AnalyzeExecNode::deserialize, CsvScanExecNode::deserialize, FileSinkConfig::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • JoinNode::serialize (cyclomatic 19) datafusion/proto-models/src/generated/pbjson.rs:11529 — JoinNode::serialize has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: 3 other methods here (AnalyzeExecNode::serialize, FileSinkConfig::serialize, SymmetricHashJoinExecNode::serialize) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · FileSinkConfig · ×2
  • FileSinkConfig::deserialize (cyclomatic 28) datafusion/proto-models/src/generated/pbjson.rs:8032 — FileSinkConfig::deserialize has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 4 other methods here (AnalyzeExecNode::deserialize, CsvScanExecNode::deserialize, JoinNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • FileSinkConfig::serialize (cyclomatic 19) datafusion/proto-models/src/generated/pbjson.rs:7962 — FileSinkConfig::serialize has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: 3 other methods here (AnalyzeExecNode::serialize, JoinNode::serialize, SymmetricHashJoinExecNode::serialize) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · CsvScanExecNode · ×2
  • CsvScanExecNode::deserialize (cyclomatic 28) datafusion/proto-models/src/generated/pbjson.rs:5067 — CsvScanExecNode::deserialize has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 4 other methods here (AnalyzeExecNode::deserialize, FileSinkConfig::deserialize, JoinNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • CsvScanExecNode::serialize (cyclomatic 19) datafusion/proto-models/src/generated/pbjson.rs:4991 — CsvScanExecNode::serialize has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SymmetricHashJoinExecNode · ×2
  • SymmetricHashJoinExecNode::deserialize (cyclomatic 28) datafusion/proto-models/src/generated/pbjson.rs:27780 — SymmetricHashJoinExecNode::deserialize has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 4 other methods here (AnalyzeExecNode::deserialize, CsvScanExecNode::deserialize, FileSinkConfig::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • SymmetricHashJoinExecNode::serialize (cyclomatic 19) datafusion/proto-models/src/generated/pbjson.rs:27708 — SymmetricHashJoinExecNode::serialize has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: 3 other methods here (AnalyzeExecNode::serialize, FileSinkConfig::serialize, JoinNode::serialize) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · AnalyzeExecNode · ×2
  • AnalyzeExecNode::deserialize (cyclomatic 28) datafusion/proto-models/src/generated/pbjson.rs:1067 — AnalyzeExecNode::deserialize has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 4 other methods here (CsvScanExecNode::deserialize, FileSinkConfig::deserialize, JoinNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • AnalyzeExecNode::serialize (cyclomatic 19) datafusion/proto-models/src/generated/pbjson.rs:995 — AnalyzeExecNode::serialize has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: 3 other methods here (FileSinkConfig::serialize, JoinNode::serialize, SymmetricHashJoinExecNode::serialize) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · BinaryExpr · ×2
  • BinaryExpr::evaluate (cyclomatic 25) datafusion/physical-expr/src/expressions/binary.rs:559 — BinaryExpr::evaluate has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • BinaryExpr::propagate_constraints (cyclomatic 24) datafusion/physical-expr/src/expressions/binary.rs:728 — BinaryExpr::propagate_constraints has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AsOfJoinNode · ×2
  • AsOfJoinNode::deserialize (cyclomatic 25) datafusion/proto-models/src/generated/pbjson.rs:1937 — AsOfJoinNode::deserialize has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 2 other methods here (PhysicalAggregateExprNode::deserialize, SortMergeJoinExecNode::deserialize) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • AsOfJoinNode::serialize (cyclomatic 17) datafusion/proto-models/src/generated/pbjson.rs:1873 — AsOfJoinNode::serialize has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (SortMergeJoinExecNode::serialize) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · PhysicalAggregateExprNode · ×2
  • PhysicalAggregateExprNode::deserialize (cyclomatic 25) datafusion/proto-models/src/generated/pbjson.rs:18391 — PhysicalAggregateExprNode::deserialize has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 2 other methods here (AsOfJoinNode::deserialize, SortMergeJoinExecNode::deserialize) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • PhysicalAggregateExprNode::serialize (cyclomatic 17) datafusion/proto-models/src/generated/pbjson.rs:18325 — PhysicalAggregateExprNode::serialize has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SortMergeJoinExecNode · ×2
  • SortMergeJoinExecNode::deserialize (cyclomatic 25) datafusion/proto-models/src/generated/pbjson.rs:26897 — SortMergeJoinExecNode::deserialize has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 2 other methods here (AsOfJoinNode::deserialize, PhysicalAggregateExprNode::deserialize) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • SortMergeJoinExecNode::serialize (cyclomatic 17) datafusion/proto-models/src/generated/pbjson.rs:26833 — SortMergeJoinExecNode::serialize has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (AsOfJoinNode::serialize) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · NestedLoopJoinStream · ×2
  • NestedLoopJoinStream::poll_next (cyclomatic 18) datafusion/physical-plan/src/joins/nested_loop_join.rs:2103 — NestedLoopJoinStream::poll_next has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • NestedLoopJoinStream::process_left_range_join (cyclomatic 17) datafusion/physical-plan/src/joins/nested_loop_join.rs:3186 — NestedLoopJoinStream::process_left_range_join has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · datafusion_cli · ×2
  • datafusion_cli::main_inner (cyclomatic 16) datafusion-cli/src/main.rs:200 — datafusion_cli::main_inner has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • datafusion_cli::exec::exec_from_repl (cyclomatic 16) datafusion-cli/src/exec.rs:124 — datafusion_cli::exec::exec_from_repl has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D2 · Cognitive Complexity · DefaultPhysicalPlanner · ×2
  • DefaultPhysicalPlanner::map_logical_node_to_physical (cognitive 194) REDACTED:574 — DefaultPhysicalPlanner::map_logical_node_to_physical has cognitive complexity 194 (threshold 15). Drivers by points: if/else 60 (121 pts), match/switch 18 (47 pts), boolean chains 13, loops 5 (13 pts) (nesting depth added 98). Of this number, 190 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • DefaultPhysicalPlanner::handle_explain (cognitive 38) REDACTED:2860 — DefaultPhysicalPlanner::handle_explain has cognitive complexity 38 (threshold 15). Drivers by points: if/else 11 (31 pts), match/switch 3 (6 pts), boolean chains 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ParquetOptions · ×2
  • ParquetOptions::deserialize (cognitive 112) datafusion/proto-common/src/generated/pbjson.rs:6733 — ParquetOptions::deserialize has cognitive complexity 112 (threshold 15). Drivers by points: if/else 36 (108 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 73). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ParquetOptions::serialize (cognitive 98) datafusion/proto-common/src/generated/pbjson.rs:6425 — ParquetOptions::serialize has cognitive complexity 98 (threshold 15). Drivers by points: if/else 72, match/switch 13 (26 pts) (nesting depth added 13). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · LogicalPlanNode · ×2
  • LogicalPlanNode::deserialize (cognitive 106) datafusion/proto-models/src/generated/pbjson.rs:14451 — LogicalPlanNode::deserialize has cognitive complexity 106 (threshold 15). Drivers by points: if/else 34 (102 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 69). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LogicalPlanNode::try_into_logical_plan (cognitive 69) datafusion/proto/src/logical_plan/mod.rs:499 — LogicalPlanNode::try_into_logical_plan has cognitive complexity 69 (threshold 15). Drivers by points: if/else 25 (44 pts), match/switch 9 (17 pts), loops 4 (8 pts) (nesting depth added 31). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · GroupedHashAggregateStream · ×2
  • GroupedHashAggregateStream::poll_next (cognitive 67) datafusion/physical-plan/src/aggregates/grouped_hash_stream.rs:657 — GroupedHashAggregateStream::poll_next has cognitive complexity 67 (threshold 15). Drivers by points: if/else 16 (54 pts), match/switch 3 (8 pts), boolean chains 4, loops 1 (nesting depth added 43). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • GroupedHashAggregateStream::group_aggregate_batch (cognitive 16) datafusion/physical-plan/src/aggregates/grouped_hash_stream.rs:861 — GroupedHashAggregateStream::group_aggregate_batch has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · datafusion · ×2
  • datafusion::bin::print_functions_docs::print_docs (cognitive 57) datafusion/core/src/bin/print_functions_docs.rs:92 — datafusion::bin::print_functions_docs::print_docs has cognitive complexity 57 (threshold 15). Drivers by points: if/else 15 (33 pts), loops 8 (23 pts), boolean chains 1 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion::physical_planner::extract_update_assignments (cognitive 25) REDACTED:2580 — datafusion::physical_planner::extract_update_assignments has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (20 pts), loops 2 (5 pts) (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · datafusion_datasource · ×2
  • datafusion_datasource::write::demux::compute_partition_keys_by_row (cognitive 56) datafusion/datasource/src/write/demux.rs:407 — datafusion_datasource::write::demux::compute_partition_keys_by_row has cognitive complexity 56 (threshold 15). Drivers by points: loops 18 (52 pts), if/else 1 (2 pts), match/switch 1 (2 pts) (nesting depth added 36). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • datafusion_datasource::file_scan_config::sort_pushdown::any_file_has_nulls_in_sort_columns (cognitive 21) datafusion/datasource/src/file_scan_config/sort_pushdown.rs:402 — datafusion_datasource::file_scan_config::sort_pushdown::any_file_has_nulls_in_sort_columns has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 3 (6 pts), match/switch 1 (4 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CreateExternalTableNode · ×2
  • CreateExternalTableNode::deserialize (cognitive 49) datafusion/proto-models/src/generated/pbjson.rs:4378 — CreateExternalTableNode::deserialize has cognitive complexity 49 (threshold 15). Drivers by points: if/else 15 (45 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CreateExternalTableNode::serialize (cognitive 30) datafusion/proto-models/src/generated/pbjson.rs:4276 — CreateExternalTableNode::serialize has cognitive complexity 30 (threshold 15). Drivers by points: if/else 30. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · FileScanExecConf · ×2
  • FileScanExecConf::deserialize (cognitive 46) datafusion/proto-models/src/generated/pbjson.rs:7732 — FileScanExecConf::deserialize has cognitive complexity 46 (threshold 15). Drivers by points: if/else 14 (42 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (AggregateExecNode::deserialize) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • FileScanExecConf::serialize (cognitive 28) datafusion/proto-models/src/generated/pbjson.rs:7632 — FileScanExecConf::serialize has cognitive complexity 28 (threshold 15). Drivers by points: if/else 28. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (AggregateExecNode::serialize) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · AggregateExecNode · ×2
  • AggregateExecNode::deserialize (cognitive 46) datafusion/proto-models/src/generated/pbjson.rs:213 — AggregateExecNode::deserialize has cognitive complexity 46 (threshold 15). Drivers by points: if/else 14 (42 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (FileScanExecConf::deserialize) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • AggregateExecNode::serialize (cognitive 28) datafusion/proto-models/src/generated/pbjson.rs:115 — AggregateExecNode::serialize has cognitive complexity 28 (threshold 15). Drivers by points: if/else 28. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (FileScanExecConf::serialize) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · ListingTableScanNode · ×2
  • ListingTableScanNode::deserialize (cognitive 43) datafusion/proto-models/src/generated/pbjson.rs:13142 — ListingTableScanNode::deserialize has cognitive complexity 43 (threshold 15). Drivers by points: if/else 13 (39 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (PlanType::deserialize) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • ListingTableScanNode::serialize (cognitive 20) datafusion/proto-models/src/generated/pbjson.rs:13060 — ListingTableScanNode::serialize has cognitive complexity 20 (threshold 15). Drivers by points: if/else 18, match/switch 1 (2 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · datafusion_physical_expr · ×2
  • datafusion_physical_expr::planner::create_physical_expr (cognitive 42) datafusion/physical-expr/src/planner.rs:133 — datafusion_physical_expr::planner::create_physical_expr has cognitive complexity 42 (threshold 15). Drivers by points: if/else 15 (26 pts), match/switch 8 (16 pts) (nesting depth added 19). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • datafusion_physical_expr::expressions::binary::check_short_circuit (cognitive 42) datafusion/physical-expr/src/expressions/binary.rs:1260 — datafusion_physical_expr::expressions::binary::check_short_circuit has cognitive complexity 42 (threshold 15). Drivers by points: if/else 15 (37 pts), boolean chains 3, match/switch 2 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · datafusion_pruning · ×2
  • datafusion_pruning::pruning_predicate::build_predicate_expression (cognitive 38) datafusion/pruning/src/pruning_predicate.rs:1732 — datafusion_pruning::pruning_predicate::build_predicate_expression has cognitive complexity 38 (threshold 15). Drivers by points: if/else 20 (28 pts), boolean chains 5, match/switch 3 (5 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_pruning::pruning_predicate::build_compact_in_list_expr (cognitive 20) datafusion/pruning/src/pruning_predicate.rs:1538 — datafusion_pruning::pruning_predicate::build_compact_in_list_expr has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (12 pts), match/switch 3 (5 pts), boolean chains 2, loops 1 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · HashJoinExecNode · ×2
  • HashJoinExecNode::deserialize (cognitive 37) datafusion/proto-models/src/generated/pbjson.rs:9804 — HashJoinExecNode::deserialize has cognitive complexity 37 (threshold 15). Drivers by points: if/else 11 (33 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • HashJoinExecNode::serialize (cognitive 22) datafusion/proto-models/src/generated/pbjson.rs:9718 — HashJoinExecNode::serialize has cognitive complexity 22 (threshold 15). Drivers by points: if/else 22. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · BinaryExpr · ×2
  • BinaryExpr::propagate_constraints (cognitive 35) datafusion/physical-expr/src/expressions/binary.rs:728 — BinaryExpr::propagate_constraints has cognitive complexity 35 (threshold 15). Drivers by points: if/else 18 (25 pts), boolean chains 10 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • BinaryExpr::evaluate (cognitive 28) datafusion/physical-expr/src/expressions/binary.rs:559 — BinaryExpr::evaluate has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (23 pts), match/switch 3 (4 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WindowExprNode · ×2
  • WindowExprNode::deserialize (cognitive 34) datafusion/proto-models/src/generated/pbjson.rs:29874 — WindowExprNode::deserialize has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (30 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (PhysicalWindowExprNode::deserialize) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • WindowExprNode::serialize (cognitive 20) datafusion/proto-models/src/generated/pbjson.rs:29797 — WindowExprNode::serialize has cognitive complexity 20 (threshold 15). Drivers by points: if/else 18, match/switch 1 (2 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (PhysicalWindowExprNode::serialize) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · PhysicalWindowExprNode · ×2
  • PhysicalWindowExprNode::deserialize (cognitive 34) datafusion/proto-models/src/generated/pbjson.rs:23275 — PhysicalWindowExprNode::deserialize has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (30 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (WindowExprNode::deserialize) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • PhysicalWindowExprNode::serialize (cognitive 20) datafusion/proto-models/src/generated/pbjson.rs:23200 — PhysicalWindowExprNode::serialize has cognitive complexity 20 (threshold 15). Drivers by points: if/else 18, match/switch 1 (2 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (WindowExprNode::serialize) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · PartitionedTopKDenseRank · ×2
  • PartitionedTopKDenseRank::insert_batch (cognitive 33) datafusion/physical-plan/src/topk/mod.rs:2180 — PartitionedTopKDenseRank::insert_batch has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 5 (10 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PartitionedTopKDenseRank::emit (cognitive 16) datafusion/physical-plan/src/topk/mod.rs:2366 — PartitionedTopKDenseRank::emit has cognitive complexity 16 (threshold 15). Drivers by points: loops 4 (10 pts), if/else 2 (6 pts) (nesting depth added 10). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · JoinNode · ×2
  • JoinNode::deserialize (cognitive 31) datafusion/proto-models/src/generated/pbjson.rs:11601 — JoinNode::deserialize has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (27 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 4 other methods here (AnalyzeExecNode::deserialize, CsvScanExecNode::deserialize, FileSinkConfig::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • JoinNode::serialize (cognitive 18) datafusion/proto-models/src/generated/pbjson.rs:11529 — JoinNode::serialize has cognitive complexity 18 (threshold 15). Drivers by points: if/else 18. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: 3 other methods here (AnalyzeExecNode::serialize, FileSinkConfig::serialize, SymmetricHashJoinExecNode::serialize) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · FileSinkConfig · ×2
  • FileSinkConfig::deserialize (cognitive 31) datafusion/proto-models/src/generated/pbjson.rs:8032 — FileSinkConfig::deserialize has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (27 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 4 other methods here (AnalyzeExecNode::deserialize, CsvScanExecNode::deserialize, JoinNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • FileSinkConfig::serialize (cognitive 18) datafusion/proto-models/src/generated/pbjson.rs:7962 — FileSinkConfig::serialize has cognitive complexity 18 (threshold 15). Drivers by points: if/else 18. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: 3 other methods here (AnalyzeExecNode::serialize, JoinNode::serialize, SymmetricHashJoinExecNode::serialize) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · CsvScanExecNode · ×2
  • CsvScanExecNode::deserialize (cognitive 31) datafusion/proto-models/src/generated/pbjson.rs:5067 — CsvScanExecNode::deserialize has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (27 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 4 other methods here (AnalyzeExecNode::deserialize, FileSinkConfig::deserialize, JoinNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • CsvScanExecNode::serialize (cognitive 22) datafusion/proto-models/src/generated/pbjson.rs:4991 — CsvScanExecNode::serialize has cognitive complexity 22 (threshold 15). Drivers by points: if/else 18, match/switch 2 (4 pts) (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · SymmetricHashJoinExecNode · ×2
  • SymmetricHashJoinExecNode::deserialize (cognitive 31) datafusion/proto-models/src/generated/pbjson.rs:27780 — SymmetricHashJoinExecNode::deserialize has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (27 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 4 other methods here (AnalyzeExecNode::deserialize, CsvScanExecNode::deserialize, FileSinkConfig::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • SymmetricHashJoinExecNode::serialize (cognitive 18) datafusion/proto-models/src/generated/pbjson.rs:27708 — SymmetricHashJoinExecNode::serialize has cognitive complexity 18 (threshold 15). Drivers by points: if/else 18. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: 3 other methods here (AnalyzeExecNode::serialize, FileSinkConfig::serialize, JoinNode::serialize) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · AnalyzeExecNode · ×2
  • AnalyzeExecNode::deserialize (cognitive 31) datafusion/proto-models/src/generated/pbjson.rs:1067 — AnalyzeExecNode::deserialize has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (27 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 4 other methods here (CsvScanExecNode::deserialize, FileSinkConfig::deserialize, JoinNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • AnalyzeExecNode::serialize (cognitive 18) datafusion/proto-models/src/generated/pbjson.rs:995 — AnalyzeExecNode::serialize has cognitive complexity 18 (threshold 15). Drivers by points: if/else 18. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: 3 other methods here (FileSinkConfig::serialize, JoinNode::serialize, SymmetricHashJoinExecNode::serialize) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · AggregateExec · ×2
  • AggregateExec::fmt_as (cognitive 29) datafusion/physical-plan/src/aggregates/mod.rs:2002 — AggregateExec::fmt_as has cognitive complexity 29 (threshold 15). Drivers by points: if/else 17 (28 pts), match/switch 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • AggregateExec::estimate_num_rows (cognitive 19) datafusion/physical-plan/src/aggregates/mod.rs:1803 — AggregateExec::estimate_num_rows has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (17 pts), match/switch 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ParquetColumnOptions · ×2
  • ParquetColumnOptions::serialize (cognitive 28) datafusion/proto-common/src/generated/pbjson.rs:5997 — ParquetColumnOptions::serialize has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14, match/switch 7 (14 pts) (nesting depth added 7). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • ParquetColumnOptions::deserialize (cognitive 25) datafusion/proto-common/src/generated/pbjson.rs:6081 — ParquetColumnOptions::deserialize has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (21 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AsOfJoinNode · ×2
  • AsOfJoinNode::deserialize (cognitive 28) datafusion/proto-models/src/generated/pbjson.rs:1937 — AsOfJoinNode::deserialize has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (24 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 2 other methods here (PhysicalAggregateExprNode::deserialize, SortMergeJoinExecNode::deserialize) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • AsOfJoinNode::serialize (cognitive 16) datafusion/proto-models/src/generated/pbjson.rs:1873 — AsOfJoinNode::serialize has cognitive complexity 16 (threshold 15). Drivers by points: if/else 16. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (SortMergeJoinExecNode::serialize) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · PhysicalAggregateExprNode · ×2
  • PhysicalAggregateExprNode::deserialize (cognitive 28) datafusion/proto-models/src/generated/pbjson.rs:18391 — PhysicalAggregateExprNode::deserialize has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (24 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 2 other methods here (AsOfJoinNode::deserialize, SortMergeJoinExecNode::deserialize) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • PhysicalAggregateExprNode::serialize (cognitive 18) datafusion/proto-models/src/generated/pbjson.rs:18325 — PhysicalAggregateExprNode::serialize has cognitive complexity 18 (threshold 15). Drivers by points: if/else 16, match/switch 1 (2 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · SortMergeJoinExecNode · ×2
  • SortMergeJoinExecNode::deserialize (cognitive 28) datafusion/proto-models/src/generated/pbjson.rs:26897 — SortMergeJoinExecNode::deserialize has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (24 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 2 other methods here (AsOfJoinNode::deserialize, PhysicalAggregateExprNode::deserialize) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • SortMergeJoinExecNode::serialize (cognitive 16) datafusion/proto-models/src/generated/pbjson.rs:26833 — SortMergeJoinExecNode::serialize has cognitive complexity 16 (threshold 15). Drivers by points: if/else 16. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (AsOfJoinNode::serialize) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · datafusion_proto · ×2
  • datafusion_proto::logical_plan::from_proto::parse_expr (cognitive 26) datafusion/proto/src/logical_plan/from_proto.rs:170 — datafusion_proto::logical_plan::from_proto::parse_expr has cognitive complexity 26 (threshold 15). Drivers by points: match/switch 10 (18 pts), if/else 4 (8 pts) (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • datafusion_proto::logical_plan::to_proto::serialize_expr (cognitive 21) datafusion/proto/src/logical_plan/to_proto.rs:53 — datafusion_proto::logical_plan::to_proto::serialize_expr has cognitive complexity 21 (threshold 15). Drivers by points: match/switch 7 (12 pts), if/else 4 (7 pts), loops 1 (2 pts) (nesting depth added 9). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · datafusion_functions_aggregate_common · ×2
  • datafusion_functions_aggregate_common::aggregate::groups_accumulator::accumulate::accumulate_indices (cognitive 24) datafusion/functions-aggregate-common/src/aggregate/groups_accumulator/accumulate.rs:591 — datafusion_functions_aggregate_common::aggregate::groups_accumulator::accumulate::accumulate_indices has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 4 (8 pts), match/switch 1 (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • datafusion_functions_aggregate_common::merge_arrays::merge_ordered_arrays (cognitive 19) datafusion/functions-aggregate-common/src/merge_arrays.rs:112 — datafusion_functions_aggregate_common::merge_arrays::merge_ordered_arrays has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RepartitionExec · ×2
  • RepartitionExec::pull_from_input (cognitive 24) datafusion/physical-plan/src/repartition/mod.rs:2273 — RepartitionExec::pull_from_input has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 4 (8 pts), match/switch 2 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • RepartitionExec::try_swapping_with_projection (cognitive 16) datafusion/physical-plan/src/repartition/mod.rs:1942 — RepartitionExec::try_swapping_with_projection has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 2 (4 pts), boolean chains 1, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ArrayAggGroupsAccumulator · ×2
  • ArrayAggGroupsAccumulator::evaluate (cognitive 23) datafusion/functions-aggregate/src/array_agg.rs:655 — ArrayAggGroupsAccumulator::evaluate has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 5 (9 pts), match/switch 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ArrayAggGroupsAccumulator::compact_retained_state (cognitive 16) datafusion/functions-aggregate/src/array_agg.rs:524 — ArrayAggGroupsAccumulator::compact_retained_state has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3 (6 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Range · ×2
  • Range::gen_range_timestamp (cognitive 22) datafusion/functions-nested/src/range.rs:431 — Range::gen_range_timestamp has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 11, if/else 5 (9 pts), loops 1, match/switch 1 (nesting depth added 4). Of this number, 21 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
  • Range::gen_range_date (cognitive 18) datafusion/functions-nested/src/range.rs:367 — Range::gen_range_date has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 5, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TypeCoercionRewriter · ×2
  • TypeCoercionRewriter::f_up (cognitive 21) datafusion/optimizer/src/analyzer/type_coercion.rs:583 — TypeCoercionRewriter::f_up has cognitive complexity 21 (threshold 15). Drivers by points: match/switch 5 (9 pts), if/else 5 (8 pts), boolean chains 4 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • TypeCoercionRewriter::coerce_dml (cognitive 19) datafusion/optimizer/src/analyzer/type_coercion.rs:204 — TypeCoercionRewriter::coerce_dml has cognitive complexity 19 (threshold 15). Drivers by points: loops 4 (12 pts), if/else 3 (5 pts), match/switch 1 (2 pts) (nesting depth added 11). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · FilterExec · ×2
  • FilterExec::statistics_helper (cognitive 21) datafusion/physical-plan/src/filter.rs:366 — FilterExec::statistics_helper has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (5 pts), match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FilterExec::handle_child_pushdown_result (cognitive 18) datafusion/physical-plan/src/filter.rs:738 — FilterExec::handle_child_pushdown_result has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 4 (9 pts), if/else 7 (8 pts), boolean chains 1 (nesting depth added 6). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · datafusion_datasource_parquet · ×2
  • datafusion_datasource_parquet::projection_read_plan::build_read_plan_with_cast_clipping (cognitive 20) datafusion/datasource-parquet/src/projection_read_plan.rs:676 — datafusion_datasource_parquet::projection_read_plan::build_read_plan_with_cast_clipping has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 4, match/switch 2 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datafusion_datasource_parquet::page_filter::limit_pruned_plan (cognitive 17) datafusion/datasource-parquet/src/page_filter.rs:524 — datafusion_datasource_parquet::page_filter::limit_pruned_plan has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 1 (3 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FirstLastGroupsAccumulator · ×2
  • FirstLastGroupsAccumulator::get_filtered_extreme_of_each_group (cognitive 18) datafusion/functions-aggregate/src/first_last.rs:586 — FirstLastGroupsAccumulator::get_filtered_extreme_of_each_group has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 7, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FirstLastGroupsAccumulator::update_batch_pre_ordered (cognitive 16) datafusion/functions-aggregate/src/first_last.rs:696 — FirstLastGroupsAccumulator::update_batch_pre_ordered has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 4, loops 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · datafusion_physical_expr_common · ×2
  • datafusion_physical_expr_common::datum::compare_op_for_nested (cognitive 18) datafusion/physical-expr-common/src/datum.rs:158 — datafusion_physical_expr_common::datum::compare_op_for_nested has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 6 (11 pts), boolean chains 4, if/else 3 (nesting depth added 5). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • datafusion_physical_expr_common::utils::scatter_bits (cognitive 16) datafusion/physical-expr-common/src/utils.rs:174 — datafusion_physical_expr_common::utils::scatter_bits has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 3 (7 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Precision · ×2
  • Precision::from (cognitive 16) datafusion/proto-common/src/from_proto/mod.rs:805 — Precision::from has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Precision::from) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • Precision::from (cognitive 16) datafusion/proto-common/src/from_proto/mod.rs:844 — Precision::from has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Precision::from) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D3 · God Classes · TooManyFields · ×2
  • TooManyFields: PreparedParquetOpen datafusion/datasource-parquet/src/opener/mod.rs:427 — TooManyFields — 40 stored fields beside 2 methods. The bar is 30 stored fields; this is 10 over it, 1.33× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: BitwiseSortMergeJoinStream datafusion/physical-plan/src/joins/sort_merge_join/bitwise_stream.rs:207 — TooManyFields — 31 stored fields beside 30 methods. The bar is 30 stored fields; this is 1 over it, 1.03× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
D30 · Dependency Vulnerabilities · Medium CVE · ×2
  • REDACTED
  • REDACTED
D30 · Dependency Vulnerabilities · Medium advisory (unsound) · ×2
  • REDACTED
  • REDACTED
D31 · IaC & Container Security · Medium IaC · ×2
  • REDACTED
  • REDACTED
D4 · Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) · ×2
  • Members sharing a duplicated core (5 members, 50+ identical tokens) datafusion/datasource/src/memory.rs:710 — datafusion/datasource/src/memory.rs:710-779 | datafusion/physical-plan/src/joins/asof_join.rs:672-758 | datafusion/physical-plan/src/joins/hash_join/exec.rs:2241-2356 | datafusion/physical-plan/src/joins/nested_loop_join.rs:991-1034 | datafusion/physical-plan/src/joins/sort_merge_join/exec.rs:802-891 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) datafusion/spark/src/function/datetime/date_trunc.rs:76 — datafusion/spark/src/function/datetime/date_trunc.rs:76-84 | datafusion/spark/src/function/datetime/from_utc_timestamp.rs:88-96 | datafusion/spark/src/function/datetime/time_trunc.rs:70-78 | datafusion/spark/src/function/datetime/to_utc_timestamp.rs:90-98 | datafusion/spark/src/function/datetime/trunc.rs:77-85 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication · Duplicated block (32 lines × 2) · ×2
  • Duplicated block (32 lines × 2) datafusion/functions/src/unicode/lpad.rs:251 — datafusion/functions/src/unicode/lpad.rs:251-282 | datafusion/functions/src/unicode/rpad.rs:252-283 — before extracting anything, compare `datafusion/functions/src/unicode/lpad.rs` and `datafusion/functions/src/unicode/rpad.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 229 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (32 lines × 2) datafusion/functions-aggregate/src/min_max.rs:248 — datafusion/functions-aggregate/src/min_max.rs:248-279 | datafusion/functions-aggregate/src/min_max.rs:547-578 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (24 lines × 2) · ×2
  • Duplicated block (24 lines × 2) datafusion/functions-aggregate/src/array_agg.rs:922 — datafusion/functions-aggregate/src/array_agg.rs:922-945 | datafusion/functions-aggregate/src/array_agg.rs:1120-1143 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (24 lines × 2) datafusion/functions-nested/src/cosine_distance.rs:162 — datafusion/functions-nested/src/cosine_distance.rs:162-185 | datafusion/functions-nested/src/inner_product.rs:168-191 — before extracting anything, compare `datafusion/functions-nested/src/cosine_distance.rs` and `datafusion/functions-nested/src/inner_product.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 86 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (21 lines × 3) · ×2
  • Duplicated block (21 lines × 3) datafusion/physical-plan/src/topk/mod.rs:1335 — datafusion/physical-plan/src/topk/mod.rs:1335-1355 | datafusion/physical-plan/src/topk/mod.rs:1651-1671 | datafusion/physical-plan/src/topk/mod.rs:2146-2166 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (21 lines × 3) datafusion/physical-plan/src/topk/mod.rs:1376 — datafusion/physical-plan/src/topk/mod.rs:1376-1396 | datafusion/physical-plan/src/topk/mod.rs:1694-1714 | datafusion/physical-plan/src/topk/mod.rs:2198-2218 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (20–21 lines × 2) · ×2
  • Duplicated block (20–21 lines × 2) REDACTED:654 — REDACTED:654-674 | REDACTED:876-895 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (20–21 lines × 2) datafusion/physical-plan/src/joins/hash_join/exec.rs:1366 — datafusion/physical-plan/src/joins/hash_join/exec.rs:1366-1386 | datafusion/physical-plan/src/joins/nested_loop_join.rs:430-449 — before extracting anything, compare `datafusion/physical-plan/src/joins/hash_join/exec.rs` and `datafusion/physical-plan/src/joins/nested_loop_join.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 67 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (15–18 lines × 2) · ×2
  • Duplicated block (15–18 lines × 2) datafusion/functions/src/regex/regexpcount.rs:422 — datafusion/functions/src/regex/regexpcount.rs:422-436 | datafusion/functions/src/regex/regexpcount.rs:504-521 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15–18 lines × 2) datafusion/functions-aggregate/src/planner.rs:74 — datafusion/functions-aggregate/src/planner.rs:74-91 | datafusion/functions-window/src/planner.rs:82-96 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (16–17 lines × 2) · ×2
  • Duplicated block (16–17 lines × 2) datafusion/datasource-arrow/src/source.rs:362 — datafusion/datasource-arrow/src/source.rs:362-378 | datafusion/datasource/src/file.rs:182-197 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (16–17 lines × 2) datafusion/sql/src/statement.rs:611 — datafusion/sql/src/statement.rs:611-627 | datafusion/sql/src/statement.rs:635-650 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (14–16 lines × 2) · ×2
  • Duplicated block (14–16 lines × 2) datafusion/core/src/execution/context/mod.rs:1203 — datafusion/core/src/execution/context/mod.rs:1203-1218 | datafusion/core/src/execution/context/mod.rs:1234-1247 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14–16 lines × 2) datafusion/optimizer/src/decorrelate.rs:697 — datafusion/optimizer/src/decorrelate.rs:697-712 | datafusion/optimizer/src/decorrelate.rs:741-754 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (14–15 lines × 2) · ×2
  • Duplicated block (14–15 lines × 2) datafusion/catalog/src/async.rs:301 — datafusion/catalog/src/async.rs:301-314 | datafusion/catalog/src/async.rs:393-407 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14–15 lines × 2) datafusion/functions/src/datetime/date_part.rs:519 — datafusion/functions/src/datetime/date_part.rs:519-533 | datafusion/functions/src/datetime/date_part.rs:561-574 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (14 lines × 4) · ×2
  • Duplicated block (14 lines × 4) datafusion/functions/src/datetime/to_timestamp.rs:552 — datafusion/functions/src/datetime/to_timestamp.rs:552-565 | datafusion/functions/src/datetime/to_timestamp.rs:619-632 | datafusion/functions/src/datetime/to_timestamp.rs:688-701 | datafusion/functions/src/datetime/to_timestamp.rs:757-770 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (14 lines × 4) datafusion/functions-nested/src/array_avg.rs:98 — datafusion/functions-nested/src/array_avg.rs:98-111 | datafusion/functions-nested/src/array_normalize.rs:104-117 | datafusion/functions-nested/src/array_product.rs:102-115 | datafusion/functions-nested/src/array_sum.rs:98-111 — before extracting anything, compare `datafusion/functions-nested/src/array_avg.rs` and `datafusion/functions-nested/src/array_normalize.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (14 lines × 3) · ×2
  • Duplicated block (14 lines × 3) datafusion/datasource-arrow/src/file_format.rs:326 — datafusion/datasource-arrow/src/file_format.rs:326-339 | datafusion/datasource-avro/src/file_format.rs:291-304 | datafusion/datasource-parquet/src/sink.rs:388-401 — before extracting anything, compare `datafusion/datasource-arrow/src/file_format.rs` and `datafusion/datasource-avro/src/file_format.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 64 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (14 lines × 3) datafusion/physical-plan/src/joins/asof_join.rs:613 — datafusion/physical-plan/src/joins/asof_join.rs:613-626 | datafusion/physical-plan/src/joins/sort_merge_join/exec.rs:730-743 | datafusion/physical-plan/src/joins/symmetric_hash_join.rs:690-703 — before extracting anything, compare `datafusion/physical-plan/src/joins/asof_join.rs` and `datafusion/physical-plan/src/joins/sort_merge_join/exec.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 48 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (11–13 lines × 2) · ×2
  • Duplicated block (11–13 lines × 2) datafusion/functions/src/datetime/make_date.rs:132 — datafusion/functions/src/datetime/make_date.rs:132-142 | datafusion/functions/src/datetime/make_time.rs:135-147 — before extracting anything, compare `datafusion/functions/src/datetime/make_date.rs` and `datafusion/functions/src/datetime/make_time.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 30 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (11–13 lines × 2) datafusion/physical-plan/src/aggregates/ordered_final_stream.rs:426 — datafusion/physical-plan/src/aggregates/ordered_final_stream.rs:426-436 | datafusion/physical-plan/src/aggregates/ordered_partial_stream.rs:390-402 — before extracting anything, compare `datafusion/physical-plan/src/aggregates/ordered_final_stream.rs` and `datafusion/physical-plan/src/aggregates/ordered_partial_stream.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 50 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (11–12 lines × 2) · ×2
  • Duplicated block (11–12 lines × 2) datafusion/expr/src/logical_plan/display.rs:478 — datafusion/expr/src/logical_plan/display.rs:478-488 | datafusion/expr/src/logical_plan/plan.rs:2252-2263 — before extracting anything, compare `datafusion/expr/src/logical_plan/display.rs` and `datafusion/expr/src/logical_plan/plan.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 43 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (11–12 lines × 2) datafusion/physical-plan/src/coalesce_partitions.rs:88 — datafusion/physical-plan/src/coalesce_partitions.rs:88-99 | datafusion/physical-plan/src/sorts/sort_preserving_merge.rs:166-176 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (10–12 lines × 2) · ×2
  • Duplicated block (10–12 lines × 2) datafusion/physical-plan/src/aggregates/group_values/multi_group_by/mod.rs:369 — datafusion/physical-plan/src/aggregates/group_values/multi_group_by/mod.rs:369-380 | datafusion/physical-plan/src/aggregates/group_values/row.rs:140-149 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (10–12 lines × 2) datafusion/physical-plan/src/joins/proto.rs:37 — datafusion/physical-plan/src/joins/proto.rs:37-48 | datafusion/physical-plan/src/joins/symmetric_hash_join.rs:706-715 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (9–10 lines × 4) · ×2
  • Duplicated block (9–10 lines × 4) datafusion/core/src/execution/session_state.rs:2341 — datafusion/core/src/execution/session_state.rs:2341-2349 | datafusion/core/src/execution/session_state.rs:2355-2364 | datafusion/core/src/execution/session_state.rs:2370-2378 | datafusion/core/src/execution/session_state.rs:2384-2392 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (9–10 lines × 4) datafusion/functions/src/regex/regexpcount.rs:106 — datafusion/functions/src/regex/regexpcount.rs:106-114 | datafusion/functions/src/regex/regexpinstr.rs:124-132 | datafusion/functions/src/regex/regexpmatch.rs:124-132 | datafusion/functions/src/utils.rs:125-134 — before extracting anything, compare `datafusion/functions/src/regex/regexpcount.rs` and `datafusion/functions/src/regex/regexpinstr.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (10 lines × 3) · ×2
  • Duplicated block (10 lines × 3) datafusion/functions/src/math/round.rs:213 — datafusion/functions/src/math/round.rs:213-222 | datafusion/functions/src/math/trunc.rs:108-117 | datafusion/spark/src/function/math/round.rs:94-106 — before extracting anything, compare `datafusion/functions/src/math/round.rs` and `datafusion/functions/src/math/trunc.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 3) datafusion/spark/src/function/datetime/make_dt_interval.rs:149 — datafusion/spark/src/function/datetime/make_dt_interval.rs:149-158 | datafusion/spark/src/function/datetime/make_interval.rs:152-161 | datafusion/spark/src/function/datetime/make_interval.rs:168-177 — before extracting anything, compare `datafusion/spark/src/function/datetime/make_dt_interval.rs` and `datafusion/spark/src/function/datetime/make_interval.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (8–10 lines × 2) · ×2
  • Duplicated block (8–10 lines × 2) datafusion/expr/src/logical_plan/display.rs:360 — datafusion/expr/src/logical_plan/display.rs:360-367 | datafusion/expr/src/logical_plan/plan.rs:2128-2137 — before extracting anything, compare `datafusion/expr/src/logical_plan/display.rs` and `datafusion/expr/src/logical_plan/plan.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 43 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (8–10 lines × 2) datafusion/physical-plan/src/aggregates/mod.rs:2598 — datafusion/physical-plan/src/aggregates/mod.rs:2598-2607 | datafusion/proto/src/physical_plan/to_proto.rs:61-68 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (9 lines × 4) · ×2
  • Duplicated block (9 lines × 4) datafusion/physical-expr/src/aggregate.rs:744 — datafusion/physical-expr/src/aggregate.rs:744-752 | datafusion/physical-expr/src/aggregate.rs:842-850 | datafusion/physical-expr/src/aggregate.rs:912-920 | datafusion/physical-expr/src/aggregate.rs:932-940 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (9 lines × 4) datafusion/ffi/src/catalog_provider.rs:185 — datafusion/ffi/src/catalog_provider.rs:185-193 | datafusion/ffi/src/catalog_provider_list.rs:150-158 | datafusion/ffi/src/schema_provider.rs:193-201 | datafusion/ffi/src/table_provider.rs:498-506 — before extracting anything, compare `datafusion/ffi/src/catalog_provider.rs` and `datafusion/ffi/src/catalog_provider_list.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 45 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (7–9 lines × 2) · ×2
  • Duplicated block (7–9 lines × 2) datafusion/common/src/hash_utils.rs:470 — datafusion/common/src/hash_utils.rs:470-478 | datafusion/common/src/hash_utils/build_hasher.rs:350-356 — before extracting anything, compare `datafusion/common/src/hash_utils.rs` and `datafusion/common/src/hash_utils/build_hasher.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 45 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (7–9 lines × 2) datafusion/physical-plan/src/joins/sort_merge_join/metrics.rs:43 — datafusion/physical-plan/src/joins/sort_merge_join/metrics.rs:43-49 | datafusion/physical-plan/src/joins/utils.rs:1873-1881 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (6–9 lines × 2) · ×2
  • Duplicated block (6–9 lines × 2) datafusion/physical-plan/src/union.rs:196 — datafusion/physical-plan/src/union.rs:196-204 | datafusion/physical-plan/src/union.rs:690-695 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6–9 lines × 2) datafusion/physical-plan/src/windows/proto.rs:45 — datafusion/physical-plan/src/windows/proto.rs:45-50 | datafusion/proto/src/physical_plan/to_proto.rs:104-112 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (7–8 lines × 2) · ×2
  • Duplicated block (7–8 lines × 2) datafusion/datasource-csv/src/source.rs:519 — datafusion/datasource-csv/src/source.rs:519-525 | datafusion/datasource-json/src/source.rs:578-585 — before extracting anything, compare `datafusion/datasource-csv/src/source.rs` and `datafusion/datasource-json/src/source.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (7–8 lines × 2) datafusion/physical-plan/src/joins/hash_join/exec.rs:2315 — datafusion/physical-plan/src/joins/hash_join/exec.rs:2315-2322 | datafusion/physical-plan/src/joins/nested_loop_join.rs:1023-1029 — before extracting anything, compare `datafusion/physical-plan/src/joins/hash_join/exec.rs` and `datafusion/physical-plan/src/joins/nested_loop_join.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 67 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (6–7 lines × 2) · ×2
  • Duplicated block (6–7 lines × 2) datafusion/datasource/src/projection.rs:126 — datafusion/datasource/src/projection.rs:126-131 | datafusion/datasource/src/projection.rs:254-260 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6–7 lines × 2) datafusion/functions-nested/src/flatten.rs:133 — datafusion/functions-nested/src/flatten.rs:133-139 | datafusion/functions-nested/src/flatten.rs:169-174 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (5–7 lines × 2) · ×2
  • Duplicated block (5–7 lines × 2) datafusion/functions-aggregate/src/average.rs:1242 — datafusion/functions-aggregate/src/average.rs:1242-1246 | datafusion/spark/src/function/aggregate/avg.rs:364-370 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (5–7 lines × 2) datafusion/spark/src/function/datetime/make_dt_interval.rs:170 — datafusion/spark/src/function/datetime/make_dt_interval.rs:170-176 | datafusion/spark/src/function/datetime/make_interval.rs:190-194 — before extracting anything, compare `datafusion/spark/src/function/datetime/make_dt_interval.rs` and `datafusion/spark/src/function/datetime/make_interval.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (6 lines × 4) · ×2
  • Duplicated block (6 lines × 4) datafusion/functions-aggregate/src/covariance.rs:289 — datafusion/functions-aggregate/src/covariance.rs:289-294 | datafusion/functions-aggregate/src/covariance.rs:314-319 | datafusion/functions-aggregate/src/regr.rs:606-612 | datafusion/functions-aggregate/src/regr.rs:636-642 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (6 lines × 4) datafusion/functions-aggregate/src/array_agg.rs:113 — datafusion/functions-aggregate/src/array_agg.rs:113-118 | datafusion/spark/src/function/aggregate/collect.rs:78-83 | datafusion/spark/src/function/aggregate/collect.rs:139-144 | datafusion/spark/src/function/array/repeat.rs:61-66 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (5 lines × 5) · ×2
  • Duplicated block (5 lines × 5) datafusion/functions-nested/src/array_avg.rs:104 — datafusion/functions-nested/src/array_avg.rs:104-108 | datafusion/functions-nested/src/array_normalize.rs:110-114 | datafusion/functions-nested/src/array_product.rs:108-112 | datafusion/functions-nested/src/array_scale.rs:121-129 | datafusion/functions-nested/src/array_sum.rs:104-108 — before extracting anything, compare `datafusion/functions-nested/src/array_avg.rs` and `datafusion/functions-nested/src/array_normalize.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 5) datafusion/functions-nested/src/array_avg.rs:98 — datafusion/functions-nested/src/array_avg.rs:98-102 | datafusion/functions-nested/src/array_normalize.rs:104-108 | datafusion/functions-nested/src/array_product.rs:102-106 | datafusion/functions-nested/src/array_scale.rs:106-116 | datafusion/functions-nested/src/array_sum.rs:98-102 — before extracting anything, compare `datafusion/functions-nested/src/array_avg.rs` and `datafusion/functions-nested/src/array_normalize.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (5 lines × 4) · ×2
  • Duplicated block (5 lines × 4) datafusion/core/src/execution/session_state.rs:2297 — datafusion/core/src/execution/session_state.rs:2297-2301 | datafusion/core/src/execution/session_state.rs:2309-2313 | datafusion/core/src/execution/session_state.rs:2320-2324 | datafusion/core/src/execution/session_state.rs:2331-2335 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (5 lines × 4) datafusion/sqllogictest/src/test_context/range_partitioning.rs:80 — datafusion/sqllogictest/src/test_context/range_partitioning.rs:80-84 | datafusion/sqllogictest/src/test_context/range_partitioning.rs:118-124 | datafusion/sqllogictest/src/test_context/range_partitioning.rs:141-150 | datafusion/sqllogictest/src/test_context/range_partitioning.rs:166-172 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
P6 · Release Hygiene · Release pipeline publishes an empty version · ×2
  • Release pipeline publishes an empty version REDACTED:70 — `REDACTED:70` writes `CARGO_MACHETE_VERSION=$CARGO_MACHETE_VERSION` to `$GITHUB_ENV`, but `$CARGO_MACHETE_VERSION` is assigned nowhere in that `run:` block, and nowhere else in the workflow. POSIX shell expands an unset variable to the empty string, so `env.CARGO_MACHETE_VERSION` is empty on every run and whatever consumes it is handed no version at all.
  • Release pipeline publishes an empty version REDACTED:71 — `REDACTED:71` writes `LYCHEE_VERSION=$LYCHEE_VERSION` to `$GITHUB_ENV`, but `$LYCHEE_VERSION` is assigned nowhere in that `run:` block, and nowhere else in the workflow. POSIX shell expands an unset variable to the empty string, so `env.LYCHEE_VERSION` is empty on every run and whatever consumes it is handed no version at all.
D1 · Cyclomatic Complexity · Simplifier · ×1
  • Simplifier::f_up (cyclomatic 194) datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:835 — Simplifier::f_up has cyclomatic complexity 194 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · ArrowType · ×1
  • ArrowType::deserialize (cyclomatic 124) datafusion/proto-common/src/generated/pbjson.rs:295 — ArrowType::deserialize has cyclomatic complexity 124 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PhysicalPlanNode · ×1
  • PhysicalPlanNode::deserialize (cyclomatic 121) datafusion/proto-models/src/generated/pbjson.rs:21503 — PhysicalPlanNode::deserialize has cyclomatic complexity 121 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LogicalExprNode · ×1
  • LogicalExprNode::deserialize (cyclomatic 106) datafusion/proto-models/src/generated/pbjson.rs:13691 — LogicalExprNode::deserialize has cyclomatic complexity 106 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PhysicalExprNode · ×1
  • PhysicalExprNode::deserialize (cyclomatic 82) datafusion/proto-models/src/generated/pbjson.rs:19559 — PhysicalExprNode::deserialize has cyclomatic complexity 82 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · datafusion_expr_common · ×1
  • datafusion_expr_common::casts::try_cast_numeric_literal (cyclomatic 64) datafusion/expr-common/src/casts.rs:239 — datafusion_expr_common::casts::try_cast_numeric_literal has cyclomatic complexity 64 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · PushDownFilter · ×1
  • PushDownFilter::rewrite (cyclomatic 63) datafusion/optimizer/src/push_down_filter.rs:799 — PushDownFilter::rewrite has cyclomatic complexity 63 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SchemaDisplay · ×1
  • SchemaDisplay::fmt (cyclomatic 55) datafusion/expr/src/expr.rs:3006 — SchemaDisplay::fmt has cyclomatic complexity 55 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · PgJsonVisitor · ×1
  • PgJsonVisitor::to_json_value (cyclomatic 45) datafusion/expr/src/logical_plan/display.rs:303 — PgJsonVisitor::to_json_value has cyclomatic complexity 45 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · PlanType · ×1
  • PlanType::deserialize (cyclomatic 40) datafusion/proto-models/src/generated/pbjson.rs:23970 — PlanType::deserialize has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (ListingTableScanNode::deserialize) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · datafusion_datasource · ×1
  • datafusion_datasource::write::demux::compute_partition_keys_by_row (cyclomatic 38) datafusion/datasource/src/write/demux.rs:407 — datafusion_datasource::write::demux::compute_partition_keys_by_row has cyclomatic complexity 38 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D1 · Cyclomatic Complexity · TypeCoercionRewriter · ×1
  • TypeCoercionRewriter::f_up (cyclomatic 37) datafusion/optimizer/src/analyzer/type_coercion.rs:583 — TypeCoercionRewriter::f_up has cyclomatic complexity 37 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · PullUpCorrelatedExpr · ×1
  • PullUpCorrelatedExpr::f_up (cyclomatic 36) datafusion/optimizer/src/decorrelate.rs:188 — PullUpCorrelatedExpr::f_up has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · NativeType · ×1
  • NativeType::fmt (cyclomatic 35) datafusion/common/src/types/native.rs:198 — NativeType::fmt has cyclomatic complexity 35 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: NativeType::default_cast_for (cyclomatic 51) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SqlDisplay · ×1
  • SqlDisplay::fmt (cyclomatic 35) datafusion/expr/src/expr.rs:3303 — SqlDisplay::fmt has cyclomatic complexity 35 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: Expr::variant_name (cyclomatic 37) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · ConcatWsFunc · ×1
  • ConcatWsFunc::invoke_with_args (cyclomatic 35) datafusion/functions/src/string/concat_ws.rs:116 — ConcatWsFunc::invoke_with_args has cyclomatic complexity 35 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · PropagateEmptyRelation · ×1
  • PropagateEmptyRelation::rewrite (cyclomatic 32) datafusion/optimizer/src/propagate_empty_relation.rs:55 — PropagateEmptyRelation::rewrite has cyclomatic complexity 32 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · SessionStateBuilder · ×1
  • SessionStateBuilder::build (cyclomatic 29) datafusion/core/src/execution/session_state.rs:1682 — SessionStateBuilder::build has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DateTruncFunc · ×1
  • DateTruncFunc::invoke_with_args (cyclomatic 28) datafusion/functions/src/datetime/date_trunc.rs:238 — DateTruncFunc::invoke_with_args has cyclomatic complexity 28 (threshold 15). Of this number, 24 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · TreeRenderVisitor · ×1
  • TreeRenderVisitor::render_box_content (cyclomatic 28) datafusion/physical-plan/src/display.rs:1072 — TreeRenderVisitor::render_box_content has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GroupedHashAggregateStream · ×1
  • GroupedHashAggregateStream::poll_next (cyclomatic 27) datafusion/physical-plan/src/aggregates/grouped_hash_stream.rs:657 — GroupedHashAggregateStream::poll_next has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ConcatFunc · ×1
  • ConcatFunc::invoke_with_args (cyclomatic 25) datafusion/functions/src/string/concat.rs:108 — ConcatFunc::invoke_with_args has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · ListingTableFactory · ×1
  • ListingTableFactory::create_inner (cyclomatic 24) datafusion/core/src/datasource/listing_table_factory.rs:80 — ListingTableFactory::create_inner has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AlignedBoundaryStream · ×1
  • AlignedBoundaryStream::poll_next (cyclomatic 24) datafusion/datasource/src/boundary_stream.rs:227 — AlignedBoundaryStream::poll_next has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ScanState · ×1
  • ScanState::poll_scan (cyclomatic 24) datafusion/datasource/src/file_stream/scan_state.rs:125 — ScanState::poll_scan has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PagePruningAccessPlanFilter · ×1
  • PagePruningAccessPlanFilter::prune_plan_with_page_index_and_metrics (cyclomatic 24) datafusion/datasource-parquet/src/page_filter.rs:224 — PagePruningAccessPlanFilter::prune_plan_with_page_index_and_metrics has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PredicateBoundsEvaluator · ×1
  • PredicateBoundsEvaluator::evaluate_bounds (cyclomatic 23) datafusion/expr/src/predicate_bounds.rs:68 — PredicateBoundsEvaluator::evaluate_bounds has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · TypeSignature · ×1
  • TypeSignature::to_string_repr_with_names (cyclomatic 23) datafusion/expr-common/src/signature.rs:691 — TypeSignature::to_string_repr_with_names has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: datafusion_expr_common::signature::get_data_types (cyclomatic 30) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · RoundFunc · ×1
  • RoundFunc::invoke_with_args (cyclomatic 23) datafusion/functions/src/math/round.rs:291 — RoundFunc::invoke_with_args has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · datafusion · ×1
  • datafusion::bin::print_functions_docs::print_docs (cyclomatic 22) datafusion/core/src/bin/print_functions_docs.rs:92 — datafusion::bin::print_functions_docs::print_docs has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BinaryTypeCoercer · ×1
  • BinaryTypeCoercer::signature_inner (cyclomatic 22) datafusion/expr-common/src/type_coercion/binary.rs:188 — BinaryTypeCoercer::signature_inner has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · ColumnarValueRef · ×1
  • ColumnarValueRef::from_columnar_value (cyclomatic 22) datafusion/functions/src/strings.rs:1280 — ColumnarValueRef::from_columnar_value has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · JoinStatisticsProvider · ×1
  • JoinStatisticsProvider::compute_statistics (cyclomatic 22) datafusion/physical-plan/src/operator_statistics/mod.rs:847 — JoinStatisticsProvider::compute_statistics has cyclomatic complexity 22 (threshold 15). Of this number, 18 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · ParquetColumnOptions · ×1
  • ParquetColumnOptions::deserialize (cyclomatic 22) datafusion/proto-common/src/generated/pbjson.rs:6081 — ParquetColumnOptions::deserialize has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: ScalarValue::serialize (cyclomatic 47) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · UnnestNode · ×1
  • UnnestNode::deserialize (cyclomatic 22) datafusion/proto-models/src/generated/pbjson.rs:28812 — UnnestNode::deserialize has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 4 other methods here (AggregateUdfExprNode::deserialize, AsOfJoinExecNode::deserialize, PartitionedFile::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · AggregateUdfExprNode · ×1
  • AggregateUdfExprNode::deserialize (cyclomatic 22) datafusion/proto-models/src/generated/pbjson.rs:706 — AggregateUdfExprNode::deserialize has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 4 other methods here (AsOfJoinExecNode::deserialize, PartitionedFile::deserialize, PiecewiseMergeJoinExecNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · PartitionedFile · ×1
  • PartitionedFile::deserialize (cyclomatic 22) datafusion/proto-models/src/generated/pbjson.rs:18041 — PartitionedFile::deserialize has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 4 other methods here (AggregateUdfExprNode::deserialize, AsOfJoinExecNode::deserialize, PiecewiseMergeJoinExecNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · PiecewiseMergeJoinExecNode · ×1
  • PiecewiseMergeJoinExecNode::deserialize (cyclomatic 22) datafusion/proto-models/src/generated/pbjson.rs:23512 — PiecewiseMergeJoinExecNode::deserialize has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 4 other methods here (AggregateUdfExprNode::deserialize, AsOfJoinExecNode::deserialize, PartitionedFile::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · AsOfJoinExecNode · ×1
  • AsOfJoinExecNode::deserialize (cyclomatic 22) datafusion/proto-models/src/generated/pbjson.rs:1728 — AsOfJoinExecNode::deserialize has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 4 other methods here (AggregateUdfExprNode::deserialize, PartitionedFile::deserialize, PiecewiseMergeJoinExecNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · FormatStringFunc · ×1
  • FormatStringFunc::invoke_with_args (cyclomatic 22) datafusion/spark/src/function/string/format_string.rs:97 — FormatStringFunc::invoke_with_args has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: TimeFormat::try_from (cyclomatic 31) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · ParseUrl · ×1
  • ParseUrl::parse (cyclomatic 22) datafusion/spark/src/function/url/parse_url.rs:82 — ParseUrl::parse has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · datafusion_sqllogictest · ×1
  • datafusion_sqllogictest::bin::sqllogictests::run_tests (cyclomatic 22) datafusion/sqllogictest/bin/sqllogictests.rs:124 — datafusion_sqllogictest::bin::sqllogictests::run_tests has cyclomatic complexity 22 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · check_asf_yaml_status_checks.check_post_merge_conditions (cyclomatic 22) · ×1
  • check_asf_yaml_status_checks.check_post_merge_conditions (cyclomatic 22) ci/scripts/check_asf_yaml_status_checks.py:158 — check_asf_yaml_status_checks.check_post_merge_conditions has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BloomFilterStatistics · ×1
  • BloomFilterStatistics::check_scalar (cyclomatic 21) datafusion/datasource-parquet/src/bloom_filter.rs:92 — BloomFilterStatistics::check_scalar has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · DefaultPhysicalExprAdapterRewriter · ×1
  • DefaultPhysicalExprAdapterRewriter::try_narrow_struct_cast (cyclomatic 21) datafusion/physical-expr-adapter/src/schema_rewriter.rs:460 — DefaultPhysicalExprAdapterRewriter::try_narrow_struct_cast has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · datafusion_physical_expr_common · ×1
  • datafusion_physical_expr_common::datum::compare_op_for_nested (cyclomatic 21) datafusion/physical-expr-common/src/datum.rs:158 — datafusion_physical_expr_common::datum::compare_op_for_nested has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · DFParser · ×1
  • DFParser::parse_create_external_table (cyclomatic 21) datafusion/sql/src/parser.rs:1207 — DFParser::parse_create_external_table has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DFSchema · ×1
  • DFSchema::datatype_is_semantically_equal (cyclomatic 19) datafusion/common/src/dfschema.rs:750 — DFSchema::datatype_is_semantically_equal has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: datafusion_common::dfschema::format_simple_data_type (cyclomatic 31) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · TruncFunc · ×1
  • TruncFunc::invoke_with_args (cyclomatic 19) datafusion/functions/src/math/trunc.rs:147 — TruncFunc::invoke_with_args has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · BytesValueState · ×1
  • BytesValueState::take (cyclomatic 19) datafusion/functions-aggregate/src/first_last/state.rs:190 — BytesValueState::take has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · MinMaxBytesAccumulator · ×1
  • MinMaxBytesAccumulator::build_array (cyclomatic 19) datafusion/functions-aggregate/src/min_max/min_max_bytes.rs:66 — MinMaxBytesAccumulator::build_array has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · Range · ×1
  • Range::gen_range_timestamp (cyclomatic 19) datafusion/functions-nested/src/range.rs:431 — Range::gen_range_timestamp has cyclomatic complexity 19 (threshold 15). Of this number, 17 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · WindowShiftEvaluator · ×1
  • WindowShiftEvaluator::evaluate (cyclomatic 19) datafusion/functions-window/src/lead_lag.rs:607 — WindowShiftEvaluator::evaluate has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ColumnStats · ×1
  • ColumnStats::deserialize (cyclomatic 19) datafusion/proto-common/src/generated/pbjson.rs:1163 — ColumnStats::deserialize has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: ScalarValue::serialize (cyclomatic 47) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · PhysicalScalarUdfNode · ×1
  • PhysicalScalarUdfNode::deserialize (cyclomatic 19) datafusion/proto-models/src/generated/pbjson.rs:22539 — PhysicalScalarUdfNode::deserialize has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 6 other methods here (FilterExecNode::deserialize, GenerateSeriesArgsTimestamp::deserialize, GenerateSeriesNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 7 times rather than 7 independent problems. Splitting this body alone leaves the other 6 exactly as they are. Where these are variations on one operation, the change that clears all 7 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · FilterExecNode · ×1
  • FilterExecNode::deserialize (cyclomatic 19) datafusion/proto-models/src/generated/pbjson.rs:8250 — FilterExecNode::deserialize has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 6 other methods here (GenerateSeriesArgsTimestamp::deserialize, GenerateSeriesNode::deserialize, MemoryScanExecNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 7 times rather than 7 independent problems. Splitting this body alone leaves the other 6 exactly as they are. Where these are variations on one operation, the change that clears all 7 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · ParquetScanExecNode · ×1
  • ParquetScanExecNode::deserialize (cyclomatic 19) datafusion/proto-models/src/generated/pbjson.rs:16814 — ParquetScanExecNode::deserialize has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 6 other methods here (FilterExecNode::deserialize, GenerateSeriesArgsTimestamp::deserialize, GenerateSeriesNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 7 times rather than 7 independent problems. Splitting this body alone leaves the other 6 exactly as they are. Where these are variations on one operation, the change that clears all 7 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · MemoryScanExecNode · ×1
  • MemoryScanExecNode::deserialize (cyclomatic 19) datafusion/proto-models/src/generated/pbjson.rs:15103 — MemoryScanExecNode::deserialize has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 6 other methods here (FilterExecNode::deserialize, GenerateSeriesArgsTimestamp::deserialize, GenerateSeriesNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 7 times rather than 7 independent problems. Splitting this body alone leaves the other 6 exactly as they are. Where these are variations on one operation, the change that clears all 7 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · WindowAggExecNode · ×1
  • WindowAggExecNode::deserialize (cyclomatic 19) datafusion/proto-models/src/generated/pbjson.rs:29667 — WindowAggExecNode::deserialize has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 6 other methods here (FilterExecNode::deserialize, GenerateSeriesArgsTimestamp::deserialize, GenerateSeriesNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 7 times rather than 7 independent problems. Splitting this body alone leaves the other 6 exactly as they are. Where these are variations on one operation, the change that clears all 7 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · GenerateSeriesArgsTimestamp · ×1
  • GenerateSeriesArgsTimestamp::deserialize (cyclomatic 19) datafusion/proto-models/src/generated/pbjson.rs:9098 — GenerateSeriesArgsTimestamp::deserialize has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 6 other methods here (FilterExecNode::deserialize, GenerateSeriesNode::deserialize, MemoryScanExecNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 7 times rather than 7 independent problems. Splitting this body alone leaves the other 6 exactly as they are. Where these are variations on one operation, the change that clears all 7 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · GenerateSeriesNode · ×1
  • GenerateSeriesNode::deserialize (cyclomatic 19) datafusion/proto-models/src/generated/pbjson.rs:9345 — GenerateSeriesNode::deserialize has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 6 other methods here (FilterExecNode::deserialize, GenerateSeriesArgsTimestamp::deserialize, MemoryScanExecNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 7 times rather than 7 independent problems. Splitting this body alone leaves the other 6 exactly as they are. Where these are variations on one operation, the change that clears all 7 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · JsonArrayToNdjsonReader · ×1
  • JsonArrayToNdjsonReader::process_byte (cyclomatic 18) datafusion/datasource-json/src/utils.rs:209 — JsonArrayToNdjsonReader::process_byte has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PushDecoderStreamState · ×1
  • PushDecoderStreamState::transition (cyclomatic 18) datafusion/datasource-parquet/src/push_decoder.rs:438 — PushDecoderStreamState::transition has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · ScalarSubqueryToJoin · ×1
  • ScalarSubqueryToJoin::rewrite (cyclomatic 18) datafusion/optimizer/src/scalar_subquery_to_join.rs:91 — ScalarSubqueryToJoin::rewrite has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MultiLevelMergeBuilder · ×1
  • MultiLevelMergeBuilder::split_spill_file_in_half (cyclomatic 18) datafusion/physical-plan/src/sorts/multi_level_merge.rs:710 — MultiLevelMergeBuilder::split_spill_file_in_half has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SpillReaderStream · ×1
  • SpillReaderStream::poll_next (cyclomatic 18) datafusion/physical-plan/src/spill/mod.rs:358 — SpillReaderStream::poll_next has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · datafusion_sql · ×1
  • datafusion_sql::unparser::utils::date_part_to_sql (cyclomatic 18) datafusion/sql/src/unparser/utils.rs:450 — datafusion_sql::unparser::utils::date_part_to_sql has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · datafusion_macros · ×1
  • datafusion_macros::user_doc::user_doc (cyclomatic 18) datafusion/macros/src/user_doc.rs:106 — datafusion_macros::user_doc::user_doc has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ToTimestampFunc · ×1
  • ToTimestampFunc::invoke_with_args (cyclomatic 17) datafusion/functions/src/datetime/to_timestamp.rs:426 — ToTimestampFunc::invoke_with_args has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · FloorFunc · ×1
  • FloorFunc::preimage (cyclomatic 17) datafusion/functions/src/math/floor.rs:281 — FloorFunc::preimage has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · SplitPartFunc · ×1
  • SplitPartFunc::invoke_with_args (cyclomatic 17) datafusion/functions/src/string/split_part.rs:106 — SplitPartFunc::invoke_with_args has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · SparkSha2 · ×1
  • SparkSha2::invoke_with_args (cyclomatic 17) datafusion/spark/src/function/hash/sha2.rs:86 — SparkSha2::invoke_with_args has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · FunctionArgs · ×1
  • FunctionArgs::try_new (cyclomatic 17) datafusion/sql/src/expr/function.rs:101 — FunctionArgs::try_new has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · datafusion_common · ×1
  • datafusion_common::nested_struct::compact_list_view_values (cyclomatic 16) datafusion/common/src/nested_struct.rs:398 — datafusion_common::nested_struct::compact_list_view_values has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ParquetOpenState · ×1
  • ParquetOpenState::transition (cyclomatic 16) datafusion/datasource-parquet/src/opener/mod.rs:607 — ParquetOpenState::transition has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · PushdownChecker · ×1
  • PushdownChecker::f_down (cyclomatic 16) datafusion/datasource-parquet/src/projection_read_plan.rs:396 — PushdownChecker::f_down has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WindowFrameStateGroups · ×1
  • WindowFrameStateGroups::calculate_index_of_row (cyclomatic 16) datafusion/expr/src/window_state.rs:607 — WindowFrameStateGroups::calculate_index_of_row has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FindInSetFunc · ×1
  • FindInSetFunc::invoke_with_args (cyclomatic 16) datafusion/functions/src/unicode/find_in_set.rs:95 — FindInSetFunc::invoke_with_args has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · TDigest · ×1
  • TDigest::estimate_quantile (cyclomatic 16) datafusion/functions-aggregate-common/src/tdigest.rs:449 — TDigest::estimate_quantile has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · NthValueEvaluator · ×1
  • NthValueEvaluator::memoize (cyclomatic 16) datafusion/functions-window/src/nth_value.rs:388 — NthValueEvaluator::memoize has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · InListExpr · ×1
  • InListExpr::evaluate (cyclomatic 16) datafusion/physical-expr/src/expressions/in_list.rs:326 — InListExpr::evaluate has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ArrayMap · ×1
  • ArrayMap::lookup_and_get_indices (cyclomatic 16) datafusion/physical-plan/src/joins/array_map.rs:286 — ArrayMap::lookup_and_get_indices has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · HashJoinStream · ×1
  • HashJoinStream::process_probe_batch (cyclomatic 16) datafusion/physical-plan/src/joins/hash_join/stream.rs:822 — HashJoinStream::process_probe_batch has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PartitionedTopKRank · ×1
  • PartitionedTopKRank::insert_batch (cyclomatic 16) datafusion/physical-plan/src/topk/mod.rs:1683 — PartitionedTopKRank::insert_batch has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Field · ×1
  • Field::deserialize (cyclomatic 16) datafusion/proto-common/src/generated/pbjson.rs:4273 — Field::deserialize has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (ScalarTimestampValue::deserialize) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: ScalarValue::serialize (cyclomatic 47) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · ScalarTimestampValue · ×1
  • ScalarTimestampValue::deserialize (cyclomatic 16) datafusion/proto-common/src/generated/pbjson.rs:8516 — ScalarTimestampValue::deserialize has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (Field::deserialize) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: ScalarValue::serialize (cyclomatic 47) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · ViewTableScanNode · ×1
  • ViewTableScanNode::deserialize (cyclomatic 16) datafusion/proto-models/src/generated/pbjson.rs:29302 — ViewTableScanNode::deserialize has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 11 other methods here (AnalyzeNode::deserialize, CreateViewNode::deserialize, CustomTableScanNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 12 times rather than 12 independent problems. Splitting this body alone leaves the other 11 exactly as they are. Where these are variations on one operation, the change that clears all 12 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · CustomTableScanNode · ×1
  • CustomTableScanNode::deserialize (cyclomatic 16) datafusion/proto-models/src/generated/pbjson.rs:5730 — CustomTableScanNode::deserialize has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 11 other methods here (AnalyzeNode::deserialize, CreateViewNode::deserialize, DmlNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 12 times rather than 12 independent problems. Splitting this body alone leaves the other 11 exactly as they are. Where these are variations on one operation, the change that clears all 12 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · CreateViewNode · ×1
  • CreateViewNode::deserialize (cyclomatic 16) datafusion/proto-models/src/generated/pbjson.rs:4657 — CreateViewNode::deserialize has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 11 other methods here (AnalyzeNode::deserialize, CustomTableScanNode::deserialize, DmlNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 12 times rather than 12 independent problems. Splitting this body alone leaves the other 11 exactly as they are. Where these are variations on one operation, the change that clears all 12 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · AnalyzeNode · ×1
  • AnalyzeNode::deserialize (cyclomatic 16) datafusion/proto-models/src/generated/pbjson.rs:1279 — AnalyzeNode::deserialize has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 11 other methods here (CreateViewNode::deserialize, CustomTableScanNode::deserialize, DmlNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 12 times rather than 12 independent problems. Splitting this body alone leaves the other 11 exactly as they are. Where these are variations on one operation, the change that clears all 12 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · DmlNode · ×1
  • DmlNode::deserialize (cyclomatic 16) datafusion/proto-models/src/generated/pbjson.rs:6202 — DmlNode::deserialize has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 11 other methods here (AnalyzeNode::deserialize, CreateViewNode::deserialize, CustomTableScanNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 12 times rather than 12 independent problems. Splitting this body alone leaves the other 11 exactly as they are. Where these are variations on one operation, the change that clears all 12 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · UnnestExecNode · ×1
  • UnnestExecNode::deserialize (cyclomatic 16) datafusion/proto-models/src/generated/pbjson.rs:28636 — UnnestExecNode::deserialize has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 11 other methods here (AnalyzeNode::deserialize, CreateViewNode::deserialize, CustomTableScanNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 12 times rather than 12 independent problems. Splitting this body alone leaves the other 11 exactly as they are. Where these are variations on one operation, the change that clears all 12 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · PhysicalDynamicFilterNode · ×1
  • PhysicalDynamicFilterNode::deserialize (cyclomatic 16) datafusion/proto-models/src/generated/pbjson.rs:19332 — PhysicalDynamicFilterNode::deserialize has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 11 other methods here (AnalyzeNode::deserialize, CreateViewNode::deserialize, CustomTableScanNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 12 times rather than 12 independent problems. Splitting this body alone leaves the other 11 exactly as they are. Where these are variations on one operation, the change that clears all 12 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · PhysicalBinaryExprNode · ×1
  • PhysicalBinaryExprNode::deserialize (cyclomatic 16) datafusion/proto-models/src/generated/pbjson.rs:18699 — PhysicalBinaryExprNode::deserialize has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 11 other methods here (AnalyzeNode::deserialize, CreateViewNode::deserialize, CustomTableScanNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 12 times rather than 12 independent problems. Splitting this body alone leaves the other 11 exactly as they are. Where these are variations on one operation, the change that clears all 12 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SortExecNode · ×1
  • SortExecNode::deserialize (cyclomatic 16) datafusion/proto-models/src/generated/pbjson.rs:26494 — SortExecNode::deserialize has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 11 other methods here (AnalyzeNode::deserialize, CreateViewNode::deserialize, CustomTableScanNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 12 times rather than 12 independent problems. Splitting this body alone leaves the other 11 exactly as they are. Where these are variations on one operation, the change that clears all 12 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · NestedLoopJoinExecNode · ×1
  • NestedLoopJoinExecNode::deserialize (cyclomatic 16) datafusion/proto-models/src/generated/pbjson.rs:16297 — NestedLoopJoinExecNode::deserialize has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 11 other methods here (AnalyzeNode::deserialize, CreateViewNode::deserialize, CustomTableScanNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 12 times rather than 12 independent problems. Splitting this body alone leaves the other 11 exactly as they are. Where these are variations on one operation, the change that clears all 12 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · GenerateSeriesArgsInt64 · ×1
  • GenerateSeriesArgsInt64::deserialize (cyclomatic 16) datafusion/proto-models/src/generated/pbjson.rs:8920 — GenerateSeriesArgsInt64::deserialize has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 11 other methods here (AnalyzeNode::deserialize, CreateViewNode::deserialize, CustomTableScanNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 12 times rather than 12 independent problems. Splitting this body alone leaves the other 11 exactly as they are. Where these are variations on one operation, the change that clears all 12 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · GenerateSeriesArgsDate · ×1
  • GenerateSeriesArgsDate::deserialize (cyclomatic 16) datafusion/proto-models/src/generated/pbjson.rs:8748 — GenerateSeriesArgsDate::deserialize has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 11 other methods here (AnalyzeNode::deserialize, CreateViewNode::deserialize, CustomTableScanNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 12 times rather than 12 independent problems. Splitting this body alone leaves the other 11 exactly as they are. Where these are variations on one operation, the change that clears all 12 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: PhysicalPlanNode::serialize (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · generate-changelog.generate_changelog (cyclomatic 16) · ×1
  • generate-changelog.generate_changelog (cyclomatic 16) REDACTED:36 — generate-changelog.generate_changelog has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D17 · Explicit Debt · TodoComment repeated across 11 files · ×1
  • TodoComment repeated across 11 files datafusion/catalog-listing/src/helpers.rs:127 — The identical TodoComment appears in 11 files (13 occurrences) — almost certainly one boilerplate line from a single migration or decision, not 13 independent debts. Fix the systemic cause once rather than file-by-file. Text: "// TODO: remove the next line after `Expr::Wildcard` is removed". Source code is not a task system: track the cleanup where tasks live. (Every occurrence still counts toward the score and metrics.)
D17 · Explicit Debt · TodoComment repeated across 19 files · ×1
  • TodoComment repeated across 19 files REDACTED:5198 — The identical TodoComment appears in 19 files (25 occurrences) — almost certainly one boilerplate line from a single migration or decision, not 25 independent debts. Fix the systemic cause once rather than file-by-file. Text: "// TODO: collect info". Source code is not a task system: track the cleanup where tasks live. (Every occurrence still counts toward the score and metrics.)
D17 · Explicit Debt · TodoComment repeated across 10 files · ×1
  • TodoComment repeated across 10 files datafusion/expr/src/udwf.rs:489 — The identical TodoComment appears in 10 files (35 occurrences) — almost certainly one boilerplate line from a single migration or decision, not 35 independent debts. Fix the systemic cause once rather than file-by-file. Text: "// TODO (https://github.com/apache/datafusion/issues/17477) avoid recomparing all fields". Source code is not a task system: track the cleanup where tasks live. (Every occurrence still counts toward the score and metrics.)
D2 · Cognitive Complexity · Simplifier · ×1
  • Simplifier::f_up (cognitive 172) datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:835 — Simplifier::f_up has cognitive complexity 172 (threshold 15). Drivers by points: if/else 42 (79 pts), boolean chains 50, match/switch 19 (37 pts), loops 3 (6 pts) (nesting depth added 58). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ArrowType · ×1
  • ArrowType::deserialize (cognitive 127) datafusion/proto-common/src/generated/pbjson.rs:295 — ArrowType::deserialize has cognitive complexity 127 (threshold 15). Drivers by points: if/else 41 (123 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 83). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PhysicalPlanNode · ×1
  • PhysicalPlanNode::deserialize (cognitive 124) datafusion/proto-models/src/generated/pbjson.rs:21503 — PhysicalPlanNode::deserialize has cognitive complexity 124 (threshold 15). Drivers by points: if/else 40 (120 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 81). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PushDownFilter · ×1
  • PushDownFilter::rewrite (cognitive 110) datafusion/optimizer/src/push_down_filter.rs:799 — PushDownFilter::rewrite has cognitive complexity 110 (threshold 15). Drivers by points: if/else 37 (71 pts), loops 12 (28 pts), boolean chains 6, match/switch 3 (5 pts) (nesting depth added 52). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LogicalExprNode · ×1
  • LogicalExprNode::deserialize (cognitive 109) datafusion/proto-models/src/generated/pbjson.rs:13691 — LogicalExprNode::deserialize has cognitive complexity 109 (threshold 15). Drivers by points: if/else 35 (105 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 71). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PhysicalExprNode · ×1
  • PhysicalExprNode::deserialize (cognitive 85) datafusion/proto-models/src/generated/pbjson.rs:19559 — PhysicalExprNode::deserialize has cognitive complexity 85 (threshold 15). Drivers by points: if/else 27 (81 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 55). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PullUpCorrelatedExpr · ×1
  • PullUpCorrelatedExpr::f_up (cognitive 67) datafusion/optimizer/src/decorrelate.rs:188 — PullUpCorrelatedExpr::f_up has cognitive complexity 67 (threshold 15). Drivers by points: if/else 25 (50 pts), match/switch 4 (8 pts), boolean chains 5, loops 2 (4 pts) (nesting depth added 31). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · AlignedBoundaryStream · ×1
  • AlignedBoundaryStream::poll_next (cognitive 53) datafusion/datasource/src/boundary_stream.rs:227 — AlignedBoundaryStream::poll_next has cognitive complexity 53 (threshold 15). Drivers by points: if/else 12 (40 pts), match/switch 4 (12 pts), loops 1 (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStateBuilder · ×1
  • SessionStateBuilder::build (cognitive 51) datafusion/core/src/execution/session_state.rs:1682 — SessionStateBuilder::build has cognitive complexity 51 (threshold 15). Drivers by points: if/else 15 (25 pts), loops 8 (16 pts), match/switch 3 (10 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ScalarSubqueryToJoin · ×1
  • ScalarSubqueryToJoin::rewrite (cognitive 49) datafusion/optimizer/src/scalar_subquery_to_join.rs:91 — ScalarSubqueryToJoin::rewrite has cognitive complexity 49 (threshold 15). Drivers by points: if/else 14 (36 pts), loops 5 (11 pts), boolean chains 1, match/switch 1 (nesting depth added 28). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · PagePruningAccessPlanFilter · ×1
  • PagePruningAccessPlanFilter::prune_plan_with_page_index_and_metrics (cognitive 48) datafusion/datasource-parquet/src/page_filter.rs:224 — PagePruningAccessPlanFilter::prune_plan_with_page_index_and_metrics has cognitive complexity 48 (threshold 15). Drivers by points: if/else 17 (34 pts), loops 3 (6 pts), boolean chains 4, match/switch 1 (4 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConcatWsFunc · ×1
  • ConcatWsFunc::invoke_with_args (cognitive 47) datafusion/functions/src/string/concat_ws.rs:116 — ConcatWsFunc::invoke_with_args has cognitive complexity 47 (threshold 15). Drivers by points: match/switch 8 (22 pts), if/else 9 (18 pts), loops 3 (7 pts) (nesting depth added 27). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ListingTableFactory · ×1
  • ListingTableFactory::create_inner (cognitive 46) datafusion/core/src/datasource/listing_table_factory.rs:80 — ListingTableFactory::create_inner has cognitive complexity 46 (threshold 15). Drivers by points: if/else 14 (22 pts), match/switch 5 (15 pts), loops 4 (7 pts), boolean chains 2 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PlanType · ×1
  • PlanType::deserialize (cognitive 43) datafusion/proto-models/src/generated/pbjson.rs:23970 — PlanType::deserialize has cognitive complexity 43 (threshold 15). Drivers by points: if/else 13 (39 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (ListingTableScanNode::deserialize) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · SchemaDisplay · ×1
  • SchemaDisplay::fmt (cognitive 41) datafusion/expr/src/expr.rs:3006 — SchemaDisplay::fmt has cognitive complexity 41 (threshold 15). Drivers by points: if/else 15 (26 pts), match/switch 6 (11 pts), loops 2 (4 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SpillReaderStream · ×1
  • SpillReaderStream::poll_next (cognitive 41) datafusion/physical-plan/src/spill/mod.rs:358 — SpillReaderStream::poll_next has cognitive complexity 41 (threshold 15). Drivers by points: if/else 10 (32 pts), match/switch 3 (8 pts), loops 1 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ScanState · ×1
  • ScanState::poll_scan (cognitive 38) datafusion/datasource/src/file_stream/scan_state.rs:125 — ScanState::poll_scan has cognitive complexity 38 (threshold 15). Drivers by points: if/else 12 (22 pts), match/switch 9 (16 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · JsonOpener · ×1
  • JsonOpener::open (cognitive 37) datafusion/datasource-json/src/source.rs:346 — JsonOpener::open has cognitive complexity 37 (threshold 15). Drivers by points: if/else 9 (21 pts), match/switch 3 (8 pts), loops 2 (7 pts), boolean chains 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PgJsonVisitor · ×1
  • PgJsonVisitor::to_json_value (cognitive 37) datafusion/expr/src/logical_plan/display.rs:303 — PgJsonVisitor::to_json_value has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14 (28 pts), match/switch 4 (9 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ColumnarValueRef · ×1
  • ColumnarValueRef::from_columnar_value (cognitive 35) datafusion/functions/src/strings.rs:1280 — ColumnarValueRef::from_columnar_value has cognitive complexity 35 (threshold 15). Drivers by points: if/else 16 (30 pts), match/switch 3 (5 pts) (nesting depth added 16). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · WindowShiftEvaluator · ×1
  • WindowShiftEvaluator::evaluate (cognitive 35) datafusion/functions-window/src/lead_lag.rs:607 — WindowShiftEvaluator::evaluate has cognitive complexity 35 (threshold 15). Drivers by points: if/else 17 (29 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InListExpr · ×1
  • InListExpr::evaluate (cognitive 35) datafusion/physical-expr/src/expressions/in_list.rs:326 — InListExpr::evaluate has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (26 pts), match/switch 3 (5 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 15). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ArrayMap · ×1
  • ArrayMap::lookup_and_get_indices (cognitive 34) datafusion/physical-plan/src/joins/array_map.rs:286 — ArrayMap::lookup_and_get_indices has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (26 pts), loops 2 (4 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RoundFunc · ×1
  • RoundFunc::invoke_with_args (cognitive 33) datafusion/functions/src/math/round.rs:291 — RoundFunc::invoke_with_args has cognitive complexity 33 (threshold 15). Drivers by points: if/else 16 (26 pts), boolean chains 5, match/switch 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PartialSortStream · ×1
  • PartialSortStream::poll_next_inner (cognitive 33) datafusion/physical-plan/src/sorts/partial_sort.rs:697 — PartialSortStream::poll_next_inner has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (29 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PartitionedTopKRank · ×1
  • PartitionedTopKRank::insert_batch (cognitive 33) datafusion/physical-plan/src/topk/mod.rs:1683 — PartitionedTopKRank::insert_batch has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (25 pts), loops 3 (4 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DFParser · ×1
  • DFParser::parse_create_external_table (cognitive 33) datafusion/sql/src/parser.rs:1207 — DFParser::parse_create_external_table has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (26 pts), boolean chains 3, match/switch 1 (3 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TypeSignature · ×1
  • TypeSignature::to_string_repr_with_names (cognitive 31) datafusion/expr-common/src/signature.rs:691 — TypeSignature::to_string_repr_with_names has cognitive complexity 31 (threshold 15). Drivers by points: if/else 18 (27 pts), match/switch 2 (4 pts) (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · datafusion_functions_window · ×1
  • datafusion_functions_window::lead_lag::evaluate_all_with_ignore_null (cognitive 31) datafusion/functions-window/src/lead_lag.rs:481 — datafusion_functions_window::lead_lag::evaluate_all_with_ignore_null has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 4 (10 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StandardWindowExpr · ×1
  • StandardWindowExpr::evaluate_stateful (cognitive 31) datafusion/physical-expr/src/window/standard.rs:156 — StandardWindowExpr::evaluate_stateful has cognitive complexity 31 (threshold 15). Drivers by points: if/else 15 (26 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CsvFormat · ×1
  • CsvFormat::infer_schema_from_stream (cognitive 30) datafusion/datasource-csv/src/file_format.rs:531 — CsvFormat::infer_schema_from_stream has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · PushdownChecker · ×1
  • PushdownChecker::f_down (cognitive 30) datafusion/datasource-parquet/src/projection_read_plan.rs:396 — PushdownChecker::f_down has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (21 pts), boolean chains 5, match/switch 1 (4 pts) (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · NthValueEvaluator · ×1
  • NthValueEvaluator::memoize (cognitive 30) datafusion/functions-window/src/nth_value.rs:388 — NthValueEvaluator::memoize has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (22 pts), match/switch 3 (5 pts), boolean chains 3 (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · AsOfJoinStream · ×1
  • AsOfJoinStream::poll_next_impl (cognitive 30) datafusion/physical-plan/src/joins/asof_join.rs:1277 — AsOfJoinStream::poll_next_impl has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (23 pts), loops 2 (3 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · check_asf_yaml_status_checks.check_post_merge_conditions (cognitive 30) · ×1
  • check_asf_yaml_status_checks.check_post_merge_conditions (cognitive 30) ci/scripts/check_asf_yaml_status_checks.py:158 — check_asf_yaml_status_checks.check_post_merge_conditions has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 7, loops 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GroupsAccumulatorAdapter · ×1
  • GroupsAccumulatorAdapter::invoke_per_accumulator_with_scratch (cognitive 29) datafusion/functions-aggregate-common/src/aggregate/groups_accumulator.rs:314 — GroupsAccumulatorAdapter::invoke_per_accumulator_with_scratch has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 7 (11 pts), match/switch 1 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DataFrame · ×1
  • DataFrame::describe (cognitive 28) datafusion/core/src/dataframe/mod.rs:1018 — DataFrame::describe has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (17 pts), match/switch 2 (7 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · JsonArrayToNdjsonReader · ×1
  • JsonArrayToNdjsonReader::process_byte (cognitive 28) datafusion/datasource-json/src/utils.rs:209 — JsonArrayToNdjsonReader::process_byte has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (20 pts), match/switch 3 (7 pts), boolean chains 1 (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · PushDecoderStreamState · ×1
  • PushDecoderStreamState::transition (cognitive 28) datafusion/datasource-parquet/src/push_decoder.rs:438 — PushDecoderStreamState::transition has cognitive complexity 28 (threshold 15). Drivers by points: if/else 5 (13 pts), match/switch 4 (11 pts), boolean chains 3, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LogicalPlanBuilder · ×1
  • LogicalPlanBuilder::infer_data (cognitive 28) datafusion/expr/src/logical_plan/builder.rs:300 — LogicalPlanBuilder::infer_data has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (22 pts), loops 2 (3 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WindowFrameStateRange · ×1
  • WindowFrameStateRange::calculate_index_of_row (cognitive 28) datafusion/expr/src/window_state.rs:435 — WindowFrameStateRange::calculate_index_of_row has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (17 pts), match/switch 2 (8 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Formatter · ×1
  • Formatter::parse (cognitive 27) datafusion/spark/src/function/string/format_string.rs:285 — Formatter::parse has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (22 pts), match/switch 1 (3 pts), boolean chains 1, loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CommonSubexprEliminate · ×1
  • CommonSubexprEliminate::try_optimize_aggregate (cognitive 26) datafusion/optimizer/src/common_subexpr_eliminate.rs:236 — CommonSubexprEliminate::try_optimize_aggregate has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 2 (4 pts), match/switch 2 (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · SingleDistinctToGroupBy · ×1
  • SingleDistinctToGroupBy::rewrite (cognitive 26) datafusion/optimizer/src/single_distinct_to_groupby.rs:231 — SingleDistinctToGroupBy::rewrite has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (16 pts), match/switch 4 (9 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ArrowBytesMap · ×1
  • ArrowBytesMap::insert_if_new_inner (cognitive 26) datafusion/physical-expr-common/src/binary_map.rs:426 — ArrowBytesMap::insert_if_new_inner has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (23 pts), boolean chains 2, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MemorySourceConfig · ×1
  • MemorySourceConfig::repartition_preserving_order (cognitive 25) datafusion/datasource/src/memory.rs:569 — MemorySourceConfig::repartition_preserving_order has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 4 (12 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WindowFrameStateGroups · ×1
  • WindowFrameStateGroups::calculate_index_of_row (cognitive 25) datafusion/expr/src/window_state.rs:607 — WindowFrameStateGroups::calculate_index_of_row has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (19 pts), loops 3, boolean chains 2, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GraphvizVisitor · ×1
  • GraphvizVisitor::pre_visit (cognitive 25) datafusion/physical-plan/src/display.rs:670 — GraphvizVisitor::pre_visit has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (23 pts), boolean chains 1, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PrimitiveValuesRouter · ×1
  • PrimitiveValuesRouter::route_with (cognitive 25) datafusion/physical-plan/src/repartition/range.rs:404 — PrimitiveValuesRouter::route_with has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 3 (8 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (FloatValuesRouter::route_with) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · FloatValuesRouter · ×1
  • FloatValuesRouter::route_with (cognitive 25) datafusion/physical-plan/src/repartition/range.rs:464 — FloatValuesRouter::route_with has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 3 (8 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (PrimitiveValuesRouter::route_with) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · UnnestNode · ×1
  • UnnestNode::deserialize (cognitive 25) datafusion/proto-models/src/generated/pbjson.rs:28812 — UnnestNode::deserialize has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (21 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 4 other methods here (AggregateUdfExprNode::deserialize, AsOfJoinExecNode::deserialize, PartitionedFile::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · AggregateUdfExprNode · ×1
  • AggregateUdfExprNode::deserialize (cognitive 25) datafusion/proto-models/src/generated/pbjson.rs:706 — AggregateUdfExprNode::deserialize has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (21 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 4 other methods here (AsOfJoinExecNode::deserialize, PartitionedFile::deserialize, PiecewiseMergeJoinExecNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · PartitionedFile · ×1
  • PartitionedFile::deserialize (cognitive 25) datafusion/proto-models/src/generated/pbjson.rs:18041 — PartitionedFile::deserialize has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (21 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 4 other methods here (AggregateUdfExprNode::deserialize, AsOfJoinExecNode::deserialize, PiecewiseMergeJoinExecNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · PiecewiseMergeJoinExecNode · ×1
  • PiecewiseMergeJoinExecNode::deserialize (cognitive 25) datafusion/proto-models/src/generated/pbjson.rs:23512 — PiecewiseMergeJoinExecNode::deserialize has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (21 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 4 other methods here (AggregateUdfExprNode::deserialize, AsOfJoinExecNode::deserialize, PartitionedFile::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · AsOfJoinExecNode · ×1
  • AsOfJoinExecNode::deserialize (cognitive 25) datafusion/proto-models/src/generated/pbjson.rs:1728 — AsOfJoinExecNode::deserialize has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (21 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 4 other methods here (AggregateUdfExprNode::deserialize, PartitionedFile::deserialize, PiecewiseMergeJoinExecNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · ParseUrl · ×1
  • ParseUrl::parse (cognitive 25) datafusion/spark/src/function/url/parse_url.rs:82 — ParseUrl::parse has cognitive complexity 25 (threshold 15). Drivers by points: match/switch 8 (19 pts), if/else 4 (6 pts) (nesting depth added 13). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · FileScanConfig · ×1
  • FileScanConfig::fmt_as (cognitive 24) datafusion/datasource/src/file_scan_config/mod.rs:760 — FileScanConfig::fmt_as has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (23 pts), match/switch 1 (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · PreparedAccessPlan · ×1
  • PreparedAccessPlan::reorder_by_statistics (cognitive 24) datafusion/datasource-parquet/src/access_plan.rs:685 — PreparedAccessPlan::reorder_by_statistics has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (16 pts), match/switch 4 (7 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConcatFunc · ×1
  • ConcatFunc::invoke_with_args (cognitive 24) datafusion/functions/src/string/concat.rs:108 — ConcatFunc::invoke_with_args has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 4 (8 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OrderingEquivalenceClass · ×1
  • OrderingEquivalenceClass::remove_redundant_entries (cognitive 24) datafusion/physical-expr/src/equivalence/ordering.rs:99 — OrderingEquivalenceClass::remove_redundant_entries has cognitive complexity 24 (threshold 15). Drivers by points: if/else 4 (18 pts), loops 3 (6 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SparkNextDay · ×1
  • SparkNextDay::invoke_with_args (cognitive 24) datafusion/spark/src/function/datetime/next_day.rs:71 — SparkNextDay::invoke_with_args has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 5 (10 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Documentation · ×1
  • Documentation::to_doc_attribute (cognitive 23) datafusion/doc/src/lib.rs:87 — Documentation::to_doc_attribute has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 4 (8 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SignumFunc · ×1
  • SignumFunc::invoke_with_args (cognitive 23) datafusion/functions/src/math/signum.rs:99 — SignumFunc::invoke_with_args has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (18 pts), match/switch 3 (5 pts) (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · PropagateEmptyRelation · ×1
  • PropagateEmptyRelation::rewrite (cognitive 23) datafusion/optimizer/src/propagate_empty_relation.rs:55 — PropagateEmptyRelation::rewrite has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 5, match/switch 3 (5 pts) (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · EquivalenceProperties · ×1
  • EquivalenceProperties::discover_new_orderings (cognitive 23) datafusion/physical-expr/src/equivalence/properties/mod.rs:479 — EquivalenceProperties::discover_new_orderings has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CaseBody · ×1
  • CaseBody::case_when_with_expr (cognitive 23) datafusion/physical-expr/src/expressions/case.rs:779 — CaseBody::case_when_with_expr has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (16 pts), match/switch 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HigherOrderFunctionExpr · ×1
  • HigherOrderFunctionExpr::evaluate (cognitive 23) datafusion/physical-expr/src/higher_order_function.rs:296 — HigherOrderFunctionExpr::evaluate has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 3, match/switch 2 (3 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ArrowBytesViewMap · ×1
  • ArrowBytesViewMap::insert_if_new_inner (cognitive 23) datafusion/physical-expr-common/src/binary_view_map.rs:289 — ArrowBytesViewMap::insert_if_new_inner has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (22 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SortExec · ×1
  • SortExec::fmt_as (cognitive 23) datafusion/physical-plan/src/sorts/sort.rs:1281 — SortExec::fmt_as has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (13 pts), match/switch 3 (5 pts), loops 1 (4 pts), boolean chains 1 (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · datafusion_macros · ×1
  • datafusion_macros::user_doc::user_doc (cognitive 23) datafusion/macros/src/user_doc.rs:106 — datafusion_macros::user_doc::user_doc has cognitive complexity 23 (threshold 15). Drivers by points: if/else 18 (22 pts), match/switch 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · DistinctArrayAggAccumulator · ×1
  • DistinctArrayAggAccumulator::retract_batch (cognitive 22) datafusion/functions-aggregate/src/array_agg.rs:1113 — DistinctArrayAggAccumulator::retract_batch has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (18 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OrderedSingleAggregateStream · ×1
  • OrderedSingleAggregateStream::handle_reading_input (cognitive 22) datafusion/physical-plan/src/aggregates/ordered_single_stream.rs:244 — OrderedSingleAggregateStream::handle_reading_input has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (15 pts), match/switch 4 (7 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MessageFramer · ×1
  • MessageFramer::push (cognitive 22) datafusion/physical-plan/src/spill/mod.rs:194 — MessageFramer::push has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (18 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ColumnStats · ×1
  • ColumnStats::deserialize (cognitive 22) datafusion/proto-common/src/generated/pbjson.rs:1163 — ColumnStats::deserialize has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (18 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PhysicalScalarUdfNode · ×1
  • PhysicalScalarUdfNode::deserialize (cognitive 22) datafusion/proto-models/src/generated/pbjson.rs:22539 — PhysicalScalarUdfNode::deserialize has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (18 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 6 other methods here (FilterExecNode::deserialize, GenerateSeriesArgsTimestamp::deserialize, GenerateSeriesNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 7 times rather than 7 independent problems. Splitting this body alone leaves the other 6 exactly as they are. Where these are variations on one operation, the change that clears all 7 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · FilterExecNode · ×1
  • FilterExecNode::deserialize (cognitive 22) datafusion/proto-models/src/generated/pbjson.rs:8250 — FilterExecNode::deserialize has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (18 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 6 other methods here (GenerateSeriesArgsTimestamp::deserialize, GenerateSeriesNode::deserialize, MemoryScanExecNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 7 times rather than 7 independent problems. Splitting this body alone leaves the other 6 exactly as they are. Where these are variations on one operation, the change that clears all 7 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · ParquetScanExecNode · ×1
  • ParquetScanExecNode::deserialize (cognitive 22) datafusion/proto-models/src/generated/pbjson.rs:16814 — ParquetScanExecNode::deserialize has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (18 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 6 other methods here (FilterExecNode::deserialize, GenerateSeriesArgsTimestamp::deserialize, GenerateSeriesNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 7 times rather than 7 independent problems. Splitting this body alone leaves the other 6 exactly as they are. Where these are variations on one operation, the change that clears all 7 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · MemoryScanExecNode · ×1
  • MemoryScanExecNode::deserialize (cognitive 22) datafusion/proto-models/src/generated/pbjson.rs:15103 — MemoryScanExecNode::deserialize has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (18 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 6 other methods here (FilterExecNode::deserialize, GenerateSeriesArgsTimestamp::deserialize, GenerateSeriesNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 7 times rather than 7 independent problems. Splitting this body alone leaves the other 6 exactly as they are. Where these are variations on one operation, the change that clears all 7 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · WindowAggExecNode · ×1
  • WindowAggExecNode::deserialize (cognitive 22) datafusion/proto-models/src/generated/pbjson.rs:29667 — WindowAggExecNode::deserialize has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (18 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 6 other methods here (FilterExecNode::deserialize, GenerateSeriesArgsTimestamp::deserialize, GenerateSeriesNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 7 times rather than 7 independent problems. Splitting this body alone leaves the other 6 exactly as they are. Where these are variations on one operation, the change that clears all 7 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · GenerateSeriesArgsTimestamp · ×1
  • GenerateSeriesArgsTimestamp::deserialize (cognitive 22) datafusion/proto-models/src/generated/pbjson.rs:9098 — GenerateSeriesArgsTimestamp::deserialize has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (18 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 6 other methods here (FilterExecNode::deserialize, GenerateSeriesNode::deserialize, MemoryScanExecNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 7 times rather than 7 independent problems. Splitting this body alone leaves the other 6 exactly as they are. Where these are variations on one operation, the change that clears all 7 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · GenerateSeriesNode · ×1
  • GenerateSeriesNode::deserialize (cognitive 22) datafusion/proto-models/src/generated/pbjson.rs:9345 — GenerateSeriesNode::deserialize has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (18 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 6 other methods here (FilterExecNode::deserialize, GenerateSeriesArgsTimestamp::deserialize, MemoryScanExecNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 7 times rather than 7 independent problems. Splitting this body alone leaves the other 6 exactly as they are. Where these are variations on one operation, the change that clears all 7 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · JsonFormat · ×1
  • JsonFormat::infer_schema (cognitive 21) datafusion/datasource-json/src/file_format.rs:255 — JsonFormat::infer_schema has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (18 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SqlDisplay · ×1
  • SqlDisplay::fmt (cognitive 21) datafusion/expr/src/expr.rs:3303 — SqlDisplay::fmt has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 2 (4 pts), match/switch 2 (3 pts) (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · BytesValueState · ×1
  • BytesValueState::take (cognitive 21) datafusion/functions-aggregate/src/first_last/state.rs:190 — BytesValueState::take has cognitive complexity 21 (threshold 15). Drivers by points: loops 6 (12 pts), match/switch 7 (9 pts) (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · MinMaxBytesAccumulator · ×1
  • MinMaxBytesAccumulator::build_array (cognitive 21) datafusion/functions-aggregate/src/min_max/min_max_bytes.rs:66 — MinMaxBytesAccumulator::build_array has cognitive complexity 21 (threshold 15). Drivers by points: loops 6 (12 pts), match/switch 7 (9 pts) (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · DecorrelatePredicateSubquery · ×1
  • DecorrelatePredicateSubquery::rewrite (cognitive 21) datafusion/optimizer/src/decorrelate_predicate_subquery.rs:61 — DecorrelatePredicateSubquery::rewrite has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 2 (5 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Optimizer · ×1
  • Optimizer::optimize (cognitive 21) datafusion/optimizer/src/optimizer.rs:601 — Optimizer::optimize has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (12 pts), match/switch 2 (6 pts), loops 2 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DefaultPhysicalExprAdapterRewriter · ×1
  • DefaultPhysicalExprAdapterRewriter::try_narrow_struct_cast (cognitive 21) datafusion/physical-expr-adapter/src/schema_rewriter.rs:460 — DefaultPhysicalExprAdapterRewriter::try_narrow_struct_cast has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 5, loops 1, match/switch 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · IndentVisitor · ×1
  • IndentVisitor::pre_visit (cognitive 21) datafusion/physical-plan/src/display.rs:574 — IndentVisitor::pre_visit has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (20 pts), match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HashJoinStream · ×1
  • HashJoinStream::process_probe_batch (cognitive 21) datafusion/physical-plan/src/joins/hash_join/stream.rs:822 — HashJoinStream::process_probe_batch has cognitive complexity 21 (threshold 15). Drivers by points: if/else 16 (18 pts), match/switch 2, boolean chains 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · PrintOptions · ×1
  • PrintOptions::write_output (cognitive 21) datafusion-cli/src/print_options.rs:185 — PrintOptions::write_output has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 2 (9 pts) (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · NativeType · ×1
  • NativeType::fmt (cognitive 20) datafusion/common/src/types/native.rs:198 — NativeType::fmt has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (4 pts), match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · LiteralGuarantee · ×1
  • LiteralGuarantee::analyze (cognitive 20) datafusion/physical-expr/src/utils/guarantee.rs:121 — LiteralGuarantee::analyze has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RepartitionExecState · ×1
  • RepartitionExecState::consume_input_streams (cognitive 20) datafusion/physical-plan/src/repartition/mod.rs:439 — RepartitionExecState::consume_input_streams has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (12 pts), loops 3 (5 pts), match/switch 2, boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PerPartitionStream · ×1
  • PerPartitionStream::poll_next_inner (cognitive 20) datafusion/physical-plan/src/repartition/mod.rs:2525 — PerPartitionStream::poll_next_inner has cognitive complexity 20 (threshold 15). Drivers by points: match/switch 5 (15 pts), if/else 1 (4 pts), loops 1 (nesting depth added 13). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · download-python-wheels.main (cognitive 20) · ×1
  • download-python-wheels.main (cognitive 20) dev/release/download-python-wheels.py:35 — download-python-wheels.main has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 4 (6 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · datafusion_catalog · ×1
  • datafusion_catalog::memory::table::update_rows (cognitive 19) REDACTED:868 — datafusion_catalog::memory::table::update_rows has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 2 (7 pts), if/else 2 (6 pts), loops 3 (6 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PercentileContAccumulator · ×1
  • PercentileContAccumulator::retract_batch (cognitive 19) datafusion/functions-aggregate/src/percentile_cont.rs:528 — PercentileContAccumulator::retract_batch has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PushdownSort · ×1
  • PushdownSort::optimize (cognitive 19) datafusion/physical-optimizer/src/pushdown_sort.rs:84 — PushdownSort::optimize has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 3, match/switch 2 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GroupedTopKAggregateStream · ×1
  • GroupedTopKAggregateStream::poll_next (cognitive 19) datafusion/physical-plan/src/aggregates/grouped_topk_stream.rs:227 — GroupedTopKAggregateStream::poll_next has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RecvFuture · ×1
  • RecvFuture::poll (cognitive 19) datafusion/physical-plan/src/repartition/distributor_channels.rs:295 — RecvFuture::poll has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 1 (3 pts), boolean chains 1, match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Field · ×1
  • Field::deserialize (cognitive 19) datafusion/proto-common/src/generated/pbjson.rs:4273 — Field::deserialize has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (15 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (ScalarTimestampValue::deserialize) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · ScalarTimestampValue · ×1
  • ScalarTimestampValue::deserialize (cognitive 19) datafusion/proto-common/src/generated/pbjson.rs:8516 — ScalarTimestampValue::deserialize has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (15 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Field::deserialize) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · ViewTableScanNode · ×1
  • ViewTableScanNode::deserialize (cognitive 19) datafusion/proto-models/src/generated/pbjson.rs:29302 — ViewTableScanNode::deserialize has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (15 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 11 other methods here (AnalyzeNode::deserialize, CreateViewNode::deserialize, CustomTableScanNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 12 times rather than 12 independent problems. Splitting this body alone leaves the other 11 exactly as they are. Where these are variations on one operation, the change that clears all 12 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · CustomTableScanNode · ×1
  • CustomTableScanNode::deserialize (cognitive 19) datafusion/proto-models/src/generated/pbjson.rs:5730 — CustomTableScanNode::deserialize has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (15 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 11 other methods here (AnalyzeNode::deserialize, CreateViewNode::deserialize, DmlNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 12 times rather than 12 independent problems. Splitting this body alone leaves the other 11 exactly as they are. Where these are variations on one operation, the change that clears all 12 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · CreateViewNode · ×1
  • CreateViewNode::deserialize (cognitive 19) datafusion/proto-models/src/generated/pbjson.rs:4657 — CreateViewNode::deserialize has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (15 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 11 other methods here (AnalyzeNode::deserialize, CustomTableScanNode::deserialize, DmlNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 12 times rather than 12 independent problems. Splitting this body alone leaves the other 11 exactly as they are. Where these are variations on one operation, the change that clears all 12 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · AnalyzeNode · ×1
  • AnalyzeNode::deserialize (cognitive 19) datafusion/proto-models/src/generated/pbjson.rs:1279 — AnalyzeNode::deserialize has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (15 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 11 other methods here (CreateViewNode::deserialize, CustomTableScanNode::deserialize, DmlNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 12 times rather than 12 independent problems. Splitting this body alone leaves the other 11 exactly as they are. Where these are variations on one operation, the change that clears all 12 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · DmlNode · ×1
  • DmlNode::deserialize (cognitive 19) datafusion/proto-models/src/generated/pbjson.rs:6202 — DmlNode::deserialize has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (15 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 11 other methods here (AnalyzeNode::deserialize, CreateViewNode::deserialize, CustomTableScanNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 12 times rather than 12 independent problems. Splitting this body alone leaves the other 11 exactly as they are. Where these are variations on one operation, the change that clears all 12 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · UnnestExecNode · ×1
  • UnnestExecNode::deserialize (cognitive 19) datafusion/proto-models/src/generated/pbjson.rs:28636 — UnnestExecNode::deserialize has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (15 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 11 other methods here (AnalyzeNode::deserialize, CreateViewNode::deserialize, CustomTableScanNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 12 times rather than 12 independent problems. Splitting this body alone leaves the other 11 exactly as they are. Where these are variations on one operation, the change that clears all 12 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · PhysicalDynamicFilterNode · ×1
  • PhysicalDynamicFilterNode::deserialize (cognitive 19) datafusion/proto-models/src/generated/pbjson.rs:19332 — PhysicalDynamicFilterNode::deserialize has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (15 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 11 other methods here (AnalyzeNode::deserialize, CreateViewNode::deserialize, CustomTableScanNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 12 times rather than 12 independent problems. Splitting this body alone leaves the other 11 exactly as they are. Where these are variations on one operation, the change that clears all 12 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · PhysicalBinaryExprNode · ×1
  • PhysicalBinaryExprNode::deserialize (cognitive 19) datafusion/proto-models/src/generated/pbjson.rs:18699 — PhysicalBinaryExprNode::deserialize has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (15 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 11 other methods here (AnalyzeNode::deserialize, CreateViewNode::deserialize, CustomTableScanNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 12 times rather than 12 independent problems. Splitting this body alone leaves the other 11 exactly as they are. Where these are variations on one operation, the change that clears all 12 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · SortExecNode · ×1
  • SortExecNode::deserialize (cognitive 19) datafusion/proto-models/src/generated/pbjson.rs:26494 — SortExecNode::deserialize has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (15 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 11 other methods here (AnalyzeNode::deserialize, CreateViewNode::deserialize, CustomTableScanNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 12 times rather than 12 independent problems. Splitting this body alone leaves the other 11 exactly as they are. Where these are variations on one operation, the change that clears all 12 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · NestedLoopJoinExecNode · ×1
  • NestedLoopJoinExecNode::deserialize (cognitive 19) datafusion/proto-models/src/generated/pbjson.rs:16297 — NestedLoopJoinExecNode::deserialize has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (15 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 11 other methods here (AnalyzeNode::deserialize, CreateViewNode::deserialize, CustomTableScanNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 12 times rather than 12 independent problems. Splitting this body alone leaves the other 11 exactly as they are. Where these are variations on one operation, the change that clears all 12 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · GenerateSeriesArgsInt64 · ×1
  • GenerateSeriesArgsInt64::deserialize (cognitive 19) datafusion/proto-models/src/generated/pbjson.rs:8920 — GenerateSeriesArgsInt64::deserialize has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (15 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 11 other methods here (AnalyzeNode::deserialize, CreateViewNode::deserialize, CustomTableScanNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 12 times rather than 12 independent problems. Splitting this body alone leaves the other 11 exactly as they are. Where these are variations on one operation, the change that clears all 12 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · GenerateSeriesArgsDate · ×1
  • GenerateSeriesArgsDate::deserialize (cognitive 19) datafusion/proto-models/src/generated/pbjson.rs:8748 — GenerateSeriesArgsDate::deserialize has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (15 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 11 other methods here (AnalyzeNode::deserialize, CreateViewNode::deserialize, CustomTableScanNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 12 times rather than 12 independent problems. Splitting this body alone leaves the other 11 exactly as they are. Where these are variations on one operation, the change that clears all 12 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · Statistics · ×1
  • Statistics::with_fetch (cognitive 18) datafusion/common/src/stats.rs:555 — Statistics::with_fetch has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (10 pts), match/switch 5 (6 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AvroFileSink · ×1
  • AvroFileSink::spawn_writer_tasks_and_join (cognitive 18) datafusion/datasource-avro/src/file_format.rs:215 — AvroFileSink::spawn_writer_tasks_and_join has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), match/switch 2 (5 pts), loops 3 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RowGroupsPrunedParquetOpen · ×1
  • RowGroupsPrunedParquetOpen::build_stream (cognitive 18) datafusion/datasource-parquet/src/opener/mod.rs:1593 — RowGroupsPrunedParquetOpen::build_stream has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (14 pts), match/switch 3, boolean chains 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PredicateBoundsEvaluator · ×1
  • PredicateBoundsEvaluator::evaluate_bounds (cognitive 18) datafusion/expr/src/predicate_bounds.rs:68 — PredicateBoundsEvaluator::evaluate_bounds has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 6 (12 pts), if/else 4 (6 pts) (nesting depth added 8). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ProjectionExprs · ×1
  • ProjectionExprs::project_statistics_impl (cognitive 18) datafusion/physical-expr/src/projection.rs:731 — ProjectionExprs::project_statistics_impl has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 1 (4 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ProjectionMapping · ×1
  • ProjectionMapping::try_new (cognitive 18) datafusion/physical-expr/src/projection.rs:1292 — ProjectionMapping::try_new has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (10 pts), loops 2 (5 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HashJoinExec · ×1
  • HashJoinExec::fmt_as (cognitive 18) datafusion/physical-plan/src/joins/hash_join/exec.rs:1454 — HashJoinExec::fmt_as has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (17 pts), match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SpillPoolReader · ×1
  • SpillPoolReader::poll_next (cognitive 18) datafusion/physical-plan/src/spill/spill_pool.rs:737 — SpillPoolReader::poll_next has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 3 (5 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BoundedWindowAggStream · ×1
  • BoundedWindowAggStream::prune_partition_batches (cognitive 18) datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs:1413 — BoundedWindowAggStream::prune_partition_batches has cognitive complexity 18 (threshold 15). Drivers by points: loops 7 (11 pts), if/else 3 (7 pts) (nesting depth added 8). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · check_asf_yaml_status_checks.main (cognitive 18) · ×1
  • check_asf_yaml_status_checks.main (cognitive 18) ci/scripts/check_asf_yaml_status_checks.py:227 — check_asf_yaml_status_checks.main has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ListingTable · ×1
  • ListingTable::scan_with_args_inner (cognitive 17) datafusion/catalog-listing/src/table.rs:615 — ListingTable::scan_with_args_inner has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (12 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · OrderSensitiveArrayAggAccumulator · ×1
  • OrderSensitiveArrayAggAccumulator::store_batch (cognitive 17) datafusion/functions-aggregate/src/array_agg.rs:1486 — OrderSensitiveArrayAggAccumulator::store_batch has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 4, match/switch 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · MinMaxBytesState · ×1
  • MinMaxBytesState::update_batch (cognitive 17) datafusion/functions-aggregate/src/min_max/min_max_bytes.rs:460 — MinMaxBytesState::update_batch has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 2, match/switch 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EliminateCrossJoin · ×1
  • EliminateCrossJoin::rewrite (cognitive 17) datafusion/optimizer/src/eliminate_cross_join.rs:83 — EliminateCrossJoin::rewrite has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (12 pts), match/switch 2 (4 pts), loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · FilterNullJoinKeys · ×1
  • FilterNullJoinKeys::rewrite (cognitive 17) datafusion/optimizer/src/filter_null_join_keys.rs:44 — FilterNullJoinKeys::rewrite has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 3, loops 1 (2 pts), match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AggregateFunctionExpr · ×1
  • AggregateFunctionExpr::reverse_expr_inner (cognitive 17) datafusion/physical-expr/src/aggregate.rs:979 — AggregateFunctionExpr::reverse_expr_inner has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 2, match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ExprStatisticsGraph · ×1
  • ExprStatisticsGraph::propagate_statistics (cognitive 17) datafusion/physical-expr/src/statistics/stats_solver.rs:162 — ExprStatisticsGraph::propagate_statistics has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 2 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BitwiseSortMergeJoinStream · ×1
  • BitwiseSortMergeJoinStream::process_key_match_with_filter (cognitive 17) datafusion/physical-plan/src/joins/sort_merge_join/bitwise_stream.rs:715 — BitwiseSortMergeJoinStream::process_key_match_with_filter has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 2 (4 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UnnestStream · ×1
  • UnnestStream::poll_next_impl (cognitive 17) datafusion/physical-plan/src/unnest.rs:625 — UnnestStream::poll_next_impl has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (14 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FormatStringFunc · ×1
  • FormatStringFunc::invoke_with_args (cognitive 17) datafusion/spark/src/function/string/format_string.rs:97 — FormatStringFunc::invoke_with_args has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 6 (10 pts), loops 2 (4 pts), if/else 2 (3 pts) (nesting depth added 7). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · DerivedRelationBuilder · ×1
  • DerivedRelationBuilder::build (cognitive 17) datafusion/sql/src/unparser/ast.rs:700 — DerivedRelationBuilder::build has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (8 pts), match/switch 3 (6 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · generate-changelog.generate_changelog (cognitive 17) · ×1
  • generate-changelog.generate_changelog (cognitive 17) REDACTED:36 — generate-changelog.generate_changelog has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 5, loops 3 (4 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BloomFilterStatistics · ×1
  • BloomFilterStatistics::check_scalar (cognitive 16) datafusion/datasource-parquet/src/bloom_filter.rs:92 — BloomFilterStatistics::check_scalar has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · BinaryTypeCoercer · ×1
  • BinaryTypeCoercer::signature_inner (cognitive 16) datafusion/expr-common/src/type_coercion/binary.rs:188 — BinaryTypeCoercer::signature_inner has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 4). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · GetFieldFunc · ×1
  • GetFieldFunc::return_field_from_args (cognitive 16) datafusion/functions/src/core/getfield.rs:314 — GetFieldFunc::return_field_from_args has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), match/switch 2 (5 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · datafusion_functions_aggregate · ×1
  • datafusion_functions_aggregate::percentile_cont::create_percentile_accumulator (cognitive 16) datafusion/functions-aggregate/src/percentile_cont.rs:294 — datafusion_functions_aggregate::percentile_cont::create_percentile_accumulator has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (15 pts), match/switch 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TopKAggregation · ×1
  • TopKAggregation::transform_sort (cognitive 16) datafusion/physical-optimizer/src/topk_aggregation.rs:116 — TopKAggregation::transform_sort has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), match/switch 2 (4 pts), loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TopKRepartition · ×1
  • TopKRepartition::optimize (cognitive 16) datafusion/physical-optimizer/src/topk_repartition.rs:76 — TopKRepartition::optimize has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13 (15 pts), loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · FilterExecStream · ×1
  • FilterExecStream::poll_next (cognitive 16) datafusion/physical-plan/src/filter.rs:1425 — FilterExecStream::poll_next has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 4 (11 pts), if/else 2 (4 pts), loops 1 (nesting depth added 9). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · SharedBuildAccumulator · ×1
  • SharedBuildAccumulator::build_partitioned_filter (cognitive 16) datafusion/physical-plan/src/joins/hash_join/shared_bounds.rs:660 — SharedBuildAccumulator::build_partitioned_filter has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 3, match/switch 1 (2 pts), loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AggregateStatisticsProvider · ×1
  • AggregateStatisticsProvider::compute_statistics (cognitive 16) datafusion/physical-plan/src/operator_statistics/mod.rs:752 — AggregateStatisticsProvider::compute_statistics has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), match/switch 2 (3 pts), boolean chains 1, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · JoinStatisticsProvider · ×1
  • JoinStatisticsProvider::compute_statistics (cognitive 16) datafusion/physical-plan/src/operator_statistics/mod.rs:847 — JoinStatisticsProvider::compute_statistics has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9, boolean chains 3, match/switch 2 (3 pts), loops 1 (nesting depth added 1). Of this number, 11 points are the body's own statements and 5 belong to one function item inside it that branches. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ScalarNestedValue · ×1
  • ScalarNestedValue::deserialize (cognitive 16) datafusion/proto-common/src/generated/pbjson.rs:7892 — ScalarNestedValue::deserialize has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 3 other methods here (JsonOptions::deserialize, ParquetCdcOptions::deserialize, UnionValue::deserialize) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · UnionValue · ×1
  • UnionValue::deserialize (cognitive 16) datafusion/proto-common/src/generated/pbjson.rs:10340 — UnionValue::deserialize has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 3 other methods here (JsonOptions::deserialize, ParquetCdcOptions::deserialize, ScalarNestedValue::deserialize) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · JsonOptions · ×1
  • JsonOptions::deserialize (cognitive 16) datafusion/proto-common/src/generated/pbjson.rs:5104 — JsonOptions::deserialize has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 3 other methods here (ParquetCdcOptions::deserialize, ScalarNestedValue::deserialize, UnionValue::deserialize) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · ParquetCdcOptions · ×1
  • ParquetCdcOptions::deserialize (cognitive 16) datafusion/proto-common/src/generated/pbjson.rs:5882 — ParquetCdcOptions::deserialize has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 3 other methods here (JsonOptions::deserialize, ScalarNestedValue::deserialize, UnionValue::deserialize) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · RepartitionNode · ×1
  • RepartitionNode::deserialize (cognitive 16) datafusion/proto-models/src/generated/pbjson.rs:25489 — RepartitionNode::deserialize has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 23 other methods here (AliasNode::deserialize, BetweenNode::deserialize, CastNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 24 times rather than 24 independent problems. Splitting this body alone leaves the other 23 exactly as they are. Where these are variations on one operation, the change that clears all 24 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · PrepareNode · ×1
  • PrepareNode::deserialize (cognitive 16) datafusion/proto-models/src/generated/pbjson.rs:24200 — PrepareNode::deserialize has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 23 other methods here (AliasNode::deserialize, BetweenNode::deserialize, CastNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 24 times rather than 24 independent problems. Splitting this body alone leaves the other 23 exactly as they are. Where these are variations on one operation, the change that clears all 24 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · ExplainNode · ×1
  • ExplainNode::deserialize (cognitive 16) datafusion/proto-models/src/generated/pbjson.rs:7046 — ExplainNode::deserialize has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 23 other methods here (AliasNode::deserialize, BetweenNode::deserialize, CastNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 24 times rather than 24 independent problems. Splitting this body alone leaves the other 23 exactly as they are. Where these are variations on one operation, the change that clears all 24 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · DistinctOnNode · ×1
  • DistinctOnNode::deserialize (cognitive 16) datafusion/proto-models/src/generated/pbjson.rs:6049 — DistinctOnNode::deserialize has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 23 other methods here (AliasNode::deserialize, BetweenNode::deserialize, CastNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 24 times rather than 24 independent problems. Splitting this body alone leaves the other 23 exactly as they are. Where these are variations on one operation, the change that clears all 24 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · CopyToNode · ×1
  • CopyToNode::deserialize (cognitive 16) datafusion/proto-models/src/generated/pbjson.rs:3911 — CopyToNode::deserialize has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 23 other methods here (AliasNode::deserialize, BetweenNode::deserialize, CastNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 24 times rather than 24 independent problems. Splitting this body alone leaves the other 23 exactly as they are. Where these are variations on one operation, the change that clears all 24 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · PlaceholderNode · ×1
  • PlaceholderNode::deserialize (cognitive 16) datafusion/proto-models/src/generated/pbjson.rs:23693 — PlaceholderNode::deserialize has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 23 other methods here (AliasNode::deserialize, BetweenNode::deserialize, CastNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 24 times rather than 24 independent problems. Splitting this body alone leaves the other 23 exactly as they are. Where these are variations on one operation, the change that clears all 24 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · AliasNode · ×1
  • AliasNode::deserialize (cognitive 16) datafusion/proto-models/src/generated/pbjson.rs:887 — AliasNode::deserialize has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 23 other methods here (BetweenNode::deserialize, CastNode::deserialize, CopyToNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 24 times rather than 24 independent problems. Splitting this body alone leaves the other 23 exactly as they are. Where these are variations on one operation, the change that clears all 24 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · BetweenNode · ×1
  • BetweenNode::deserialize (cognitive 16) datafusion/proto-models/src/generated/pbjson.rs:2519 — BetweenNode::deserialize has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 23 other methods here (AliasNode::deserialize, CastNode::deserialize, CopyToNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 24 times rather than 24 independent problems. Splitting this body alone leaves the other 23 exactly as they are. Where these are variations on one operation, the change that clears all 24 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · LikeNode · ×1
  • LikeNode::deserialize (cognitive 16) datafusion/proto-models/src/generated/pbjson.rs:12491 — LikeNode::deserialize has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 23 other methods here (AliasNode::deserialize, BetweenNode::deserialize, CastNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 24 times rather than 24 independent problems. Splitting this body alone leaves the other 23 exactly as they are. Where these are variations on one operation, the change that clears all 24 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · ILikeNode · ×1
  • ILikeNode::deserialize (cognitive 16) datafusion/proto-models/src/generated/pbjson.rs:10278 — ILikeNode::deserialize has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 23 other methods here (AliasNode::deserialize, BetweenNode::deserialize, CastNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 24 times rather than 24 independent problems. Splitting this body alone leaves the other 23 exactly as they are. Where these are variations on one operation, the change that clears all 24 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · SimilarToNode · ×1
  • SimilarToNode::deserialize (cognitive 16) datafusion/proto-models/src/generated/pbjson.rs:26343 — SimilarToNode::deserialize has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 23 other methods here (AliasNode::deserialize, BetweenNode::deserialize, CastNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 24 times rather than 24 independent problems. Splitting this body alone leaves the other 23 exactly as they are. Where these are variations on one operation, the change that clears all 24 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · CastNode · ×1
  • CastNode::deserialize (cognitive 16) datafusion/proto-models/src/generated/pbjson.rs:3008 — CastNode::deserialize has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 23 other methods here (AliasNode::deserialize, BetweenNode::deserialize, CopyToNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 24 times rather than 24 independent problems. Splitting this body alone leaves the other 23 exactly as they are. Where these are variations on one operation, the change that clears all 24 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · TryCastNode · ×1
  • TryCastNode::deserialize (cognitive 16) datafusion/proto-models/src/generated/pbjson.rs:28104 — TryCastNode::deserialize has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 23 other methods here (AliasNode::deserialize, BetweenNode::deserialize, CastNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 24 times rather than 24 independent problems. Splitting this body alone leaves the other 23 exactly as they are. Where these are variations on one operation, the change that clears all 24 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · JsonSinkExecNode · ×1
  • JsonSinkExecNode::deserialize (cognitive 16) datafusion/proto-models/src/generated/pbjson.rs:12131 — JsonSinkExecNode::deserialize has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 23 other methods here (AliasNode::deserialize, BetweenNode::deserialize, CastNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 24 times rather than 24 independent problems. Splitting this body alone leaves the other 23 exactly as they are. Where these are variations on one operation, the change that clears all 24 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · CsvSinkExecNode · ×1
  • CsvSinkExecNode::deserialize (cognitive 16) datafusion/proto-models/src/generated/pbjson.rs:5379 — CsvSinkExecNode::deserialize has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 23 other methods here (AliasNode::deserialize, BetweenNode::deserialize, CastNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 24 times rather than 24 independent problems. Splitting this body alone leaves the other 23 exactly as they are. Where these are variations on one operation, the change that clears all 24 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · ParquetSinkExecNode · ×1
  • ParquetSinkExecNode::deserialize (cognitive 16) datafusion/proto-models/src/generated/pbjson.rs:17112 — ParquetSinkExecNode::deserialize has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 23 other methods here (AliasNode::deserialize, BetweenNode::deserialize, CastNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 24 times rather than 24 independent problems. Splitting this body alone leaves the other 23 exactly as they are. Where these are variations on one operation, the change that clears all 24 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · PhysicalLikeExprNode · ×1
  • PhysicalLikeExprNode::deserialize (cognitive 16) datafusion/proto-models/src/generated/pbjson.rs:21075 — PhysicalLikeExprNode::deserialize has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 23 other methods here (AliasNode::deserialize, BetweenNode::deserialize, CastNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 24 times rather than 24 independent problems. Splitting this body alone leaves the other 23 exactly as they are. Where these are variations on one operation, the change that clears all 24 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · GlobalLimitExecNode · ×1
  • GlobalLimitExecNode::deserialize (cognitive 16) datafusion/proto-models/src/generated/pbjson.rs:9516 — GlobalLimitExecNode::deserialize has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 23 other methods here (AliasNode::deserialize, BetweenNode::deserialize, CastNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 24 times rather than 24 independent problems. Splitting this body alone leaves the other 23 exactly as they are. Where these are variations on one operation, the change that clears all 24 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · PhysicalRangePartitioning · ×1
  • PhysicalRangePartitioning::deserialize (cognitive 16) datafusion/proto-models/src/generated/pbjson.rs:22139 — PhysicalRangePartitioning::deserialize has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 23 other methods here (AliasNode::deserialize, BetweenNode::deserialize, CastNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 24 times rather than 24 independent problems. Splitting this body alone leaves the other 23 exactly as they are. Where these are variations on one operation, the change that clears all 24 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · Partitioning · ×1
  • Partitioning::deserialize (cognitive 16) datafusion/proto-models/src/generated/pbjson.rs:18222 — Partitioning::deserialize has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 23 other methods here (AliasNode::deserialize, BetweenNode::deserialize, CastNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 24 times rather than 24 independent problems. Splitting this body alone leaves the other 23 exactly as they are. Where these are variations on one operation, the change that clears all 24 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · PartitionStats · ×1
  • PartitionStats::deserialize (cognitive 16) datafusion/proto-models/src/generated/pbjson.rs:17867 — PartitionStats::deserialize has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 23 other methods here (AliasNode::deserialize, BetweenNode::deserialize, CastNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 24 times rather than 24 independent problems. Splitting this body alone leaves the other 23 exactly as they are. Where these are variations on one operation, the change that clears all 24 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · RecursiveQueryNode · ×1
  • RecursiveQueryNode::deserialize (cognitive 16) datafusion/proto-models/src/generated/pbjson.rs:25218 — RecursiveQueryNode::deserialize has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 23 other methods here (AliasNode::deserialize, BetweenNode::deserialize, CastNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 24 times rather than 24 independent problems. Splitting this body alone leaves the other 23 exactly as they are. Where these are variations on one operation, the change that clears all 24 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · EmptyTableScanNode · ×1
  • EmptyTableScanNode::deserialize (cognitive 16) datafusion/proto-models/src/generated/pbjson.rs:6775 — EmptyTableScanNode::deserialize has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 23 other methods here (AliasNode::deserialize, BetweenNode::deserialize, CastNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 24 times rather than 24 independent problems. Splitting this body alone leaves the other 23 exactly as they are. Where these are variations on one operation, the change that clears all 24 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · PhysicalScalarSubqueryExprNode · ×1
  • PhysicalScalarSubqueryExprNode::deserialize (cognitive 16) datafusion/proto-models/src/generated/pbjson.rs:22378 — PhysicalScalarSubqueryExprNode::deserialize has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 23 other methods here (AliasNode::deserialize, BetweenNode::deserialize, CastNode::deserialize, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 24 times rather than 24 independent problems. Splitting this body alone leaves the other 23 exactly as they are. Where these are variations on one operation, the change that clears all 24 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · FunctionArgs · ×1
  • FunctionArgs::try_new (cognitive 16) datafusion/sql/src/expr/function.rs:101 — FunctionArgs::try_new has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · check_asf_yaml_status_checks.get_workflow_jobs (cognitive 16) · ×1
  • check_asf_yaml_status_checks.get_workflow_jobs (cognitive 16) ci/scripts/check_asf_yaml_status_checks.py:109 — check_asf_yaml_status_checks.get_workflow_jobs has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (8 pts), boolean chains 3, loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D22 · Internal API Consistency · Inconsistent parameter naming and type for partition data. MemTable uses `partitions · ×1
  • Inconsistent parameter naming and type for partition data. MemTable uses `partitions: RecordBatch` (singular type, likely implying a single batch or a specific wrapper), while StreamingTable uses `partitions: Arc` (generic Arc, likely wrapping a Vec or similar). This creates confusion about whether the API expects a single batch, a vector of batches, or an Arc-wrapped collection. — Standardize the partition parameter type. If both expect a collection of batches, use `Vec<RecordBatch>` or `Arc<Vec<RecordBatch>>` consistently. If MemTable's `RecordBatch` is a typo for a vector, fix it. Ensure the semantic meaning (single batch vs. multiple partitions) is clear and consistent. (signatures: MemTable.try_new(schema: SchemaRef, partitions: RecordBatch): Result | StreamingTable.try_new(schema: SchemaRef, partitions: Arc): Result)
D22 · Internal API Consistency · Inconsistent naming convention for constructors. `new` is used for a single path, while `new_with_multi_paths` is used for multiple paths. This breaks the common Rust pattern where `new` is the primary constructor and additional constructors are named `new_<feature>` or similar, but here the distinction is between singular and plural paths. More importantly, the parameter name `table_paths` in the second method is plural, while `table_path` in the first is singular, which is good, but the method name `new_with_multi_paths` is verbose compared to potential alternatives like `new_from_paths`. · ×1
  • Inconsistent naming convention for constructors. `new` is used for a single path, while `new_with_multi_paths` is used for multiple paths. This breaks the common Rust pattern where `new` is the primary constructor and additional constructors are named `new_<feature>` or similar, but here the distinction is between singular and plural paths. More importantly, the parameter name `table_paths` in the second method is plural, while `table_path` in the first is singular, which is good, but the method name `new_with_multi_paths` is verbose compared to potential alternatives like `new_from_paths`. — Consider renaming `new_with_multi_paths` to `new_from_paths` or `new_with_paths` for brevity and consistency with other 'new_with_' patterns if they exist. Alternatively, if `new` is intended to be the only public constructor for simple cases, ensure the distinction is clear. The current naming is acceptable but slightly verbose. (signatures: ListingTableConfig.new(table_path: ListingTableUrl): Self | ListingTableConfig.new_with_multi_paths(table_paths: ListingTableUrl): Self)
D22 · Internal API Consistency · Inconsistent parameter type handling. `with_file_extension` takes `impl Into<String>`, while `with_file_extension_opt` takes a generic `S` (likely `Option<S>` or similar, though the signature is truncated, the name suggests an optional variant). If `S` is `Option<String>`, the inconsistency is in the type system usage (converting to String vs. handling Option). If `S` is a different type, it's a clear inconsistency. · ×1
  • Inconsistent parameter type handling. `with_file_extension` takes `impl Into<String>`, while `with_file_extension_opt` takes a generic `S` (likely `Option<S>` or similar, though the signature is truncated, the name suggests an optional variant). If `S` is `Option<String>`, the inconsistency is in the type system usage (converting to String vs. handling Option). If `S` is a different type, it's a clear inconsistency. — Ensure both methods handle the input type consistently. If one accepts `impl Into<String>` and the other accepts `Option<String>`, consider if the optional variant should also accept `impl Into<String>` and wrap it in `Some`, or if the non-optional variant should accept `Option<String>` and panic/return error if None. Standardize on one approach for optional vs. required parameters. (signatures: ListingOptions.with_file_extension(file_extension: impl Into<String>): Self | ListingOptions.with_file_extension_opt(file_extension: S): Self)
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D35 · Change Coupling · Change coupling clique · ×1
  • Change coupling clique: btrim.rs, ltrim.rs, rtrim.rs datafusion/functions/src/string/btrim.rs — 3 files — `datafusion/functions/src/string/btrim.rs`, `datafusion/functions/src/string/ltrim.rs`, `datafusion/functions/src/string/rtrim.rs` — all change together with no explicit dependency: a fully-connected co-change clique, not 3 separate couplings. They share one concern (thin parallel siblings over a common abstraction), so extract the shared part into ONE unit and the whole clique's coupling clears at once — you do not need to break each pair individually.
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D4 · Code Duplication · Near-duplicate member family (5 members, 10 shared lines) · ×1
  • Near-duplicate member family (5 members, 10 shared lines) datafusion/functions-nested/src/array_avg.rs:96 — datafusion/functions-nested/src/array_avg.rs:96-111 | datafusion/functions-nested/src/array_normalize.rs:102-117 | datafusion/functions-nested/src/array_product.rs:100-115 | datafusion/functions-nested/src/array_scale.rs:104-132 | datafusion/functions-nested/src/array_sum.rs:96-111 — These 5 members are variants of one another: a block of 10 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication · Near-duplicate member family (4 members, 26 shared lines) · ×1
  • Near-duplicate member family (4 members, 26 shared lines) datafusion-cli/src/object_storage.rs:398 — datafusion-cli/src/object_storage.rs:398-433 | datafusion-cli/src/object_storage.rs:483-520 | datafusion/common/src/config.rs:2318-2349 | datafusion/common/src/config.rs:3079-3110 — These 4 members are variants of one another: a block of 26 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Near-duplicate member pair (88 shared lines) · ×1
  • Near-duplicate member pair (88 shared lines) datafusion/functions/src/unicode/lpad.rs:375 — datafusion/functions/src/unicode/lpad.rs:375-513 | datafusion/functions/src/unicode/rpad.rs:374-516 — These two members are variants of one another: 88 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (53 shared lines) · ×1
  • Near-duplicate member pair (53 shared lines) datafusion/functions/src/string/ends_with.rs:93 — datafusion/functions/src/string/ends_with.rs:93-160 | datafusion/functions/src/string/starts_with.rs:89-156 — These two members are variants of one another: 53 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (46 shared lines) · ×1
  • Near-duplicate member pair (46 shared lines) datafusion/functions/src/unicode/lpad.rs:110 — datafusion/functions/src/unicode/lpad.rs:110-173 | datafusion/functions/src/unicode/rpad.rs:110-173 — These two members are variants of one another: 46 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (40 shared lines) · ×1
  • Near-duplicate member pair (40 shared lines) datafusion/physical-expr/src/expressions/case.rs:783 — datafusion/physical-expr/src/expressions/case.rs:783-922 | datafusion/physical-expr/src/expressions/case.rs:929-1008 — These two members are variants of one another: 40 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (38 shared lines) · ×1
  • Near-duplicate member pair (38 shared lines) datafusion/datasource-csv/src/source.rs:504 — datafusion/datasource-csv/src/source.rs:504-557 | datafusion/datasource-json/src/source.rs:563-612 — These two members are variants of one another: 38 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (35 shared lines) · ×1
  • Near-duplicate member pair (35 shared lines) datafusion/spark/src/function/datetime/make_dt_interval.rs:139 — datafusion/spark/src/function/datetime/make_dt_interval.rs:139-197 | datafusion/spark/src/function/datetime/make_interval.rs:130-223 — These two members are variants of one another: 35 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (31 shared lines) · ×1
  • Near-duplicate member pair (31 shared lines) datafusion/physical-plan/src/display.rs:282 — datafusion/physical-plan/src/display.rs:282-327 | datafusion/physical-plan/src/display.rs:484-525 — These two members are variants of one another: 31 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (22 shared lines) · ×1
  • Near-duplicate member pair (22 shared lines) datafusion/common/src/dfschema.rs:678 — datafusion/common/src/dfschema.rs:678-743 | datafusion/common/src/dfschema.rs:750-829 — These two members are variants of one another: 22 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Edited copy of a member (19 corresponding lines) · ×1
  • Edited copy of a member (19 corresponding lines) datafusion/functions/src/unicode/find_in_set.rs:277 — datafusion/functions/src/unicode/find_in_set.rs:277-298 | datafusion/functions/src/unicode/find_in_set.rs:305-325 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (26 corresponding lines) · ×1
  • Edited copy of a member (26 corresponding lines) datafusion/physical-expr/src/simplifier/const_evaluator.rs:50 — datafusion/physical-expr/src/simplifier/const_evaluator.rs:50-81 | datafusion/physical-expr/src/simplifier/const_evaluator.rs:96-155 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (33 corresponding lines) · ×1
  • Edited copy of a member (33 corresponding lines) datafusion/spark/src/function/datetime/from_utc_timestamp.rs:103 — datafusion/spark/src/function/datetime/from_utc_timestamp.rs:103-139 | datafusion/spark/src/function/datetime/to_utc_timestamp.rs:105-141 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (13 corresponding lines) · ×1
  • Edited copy of a member (13 corresponding lines) datafusion/common/src/stats.rs:100 — datafusion/common/src/stats.rs:100-112 | datafusion/common/src/stats.rs:117-129 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (18 corresponding lines) · ×1
  • Edited copy of a member (18 corresponding lines) datafusion/common/src/config.rs:2253 — datafusion/common/src/config.rs:2253-2285 | datafusion/common/src/config.rs:2291-2315 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Members sharing a duplicated core (11 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (11 members, 50+ identical tokens) datafusion/physical-plan/src/aggregates/mod.rs:2210 — datafusion/physical-plan/src/aggregates/mod.rs:2210-2233 | datafusion/physical-plan/src/async_func.rs:178-191 | datafusion/physical-plan/src/buffer.rs:176-188 | datafusion/physical-plan/src/coalesce_batches.rs:188-201 | datafusion/physical-plan/src/coalesce_partitions.rs:165-179 | datafusion/physical-plan/src/filter.rs:599-615 | datafusion/physical-plan/src/limit.rs:184-199 | datafusion/physical-plan/src/limit.rs:465-480 | datafusion/physical-plan/src/sorts/sort_preserving_merge.rs:301-314 | datafusion/physical-plan/src/unnest.rs:244-260 | datafusion/physical-plan/src/windows/window_agg_exec.rs:269-283 — These 11 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 11 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 11 times.
D4 · Code Duplication · Duplicated block (41–48 lines × 2) · ×1
  • Duplicated block (41–48 lines × 2) datafusion/expr/src/type_coercion/functions.rs:175 — datafusion/expr/src/type_coercion/functions.rs:175-222 | datafusion/expr/src/type_coercion/functions.rs:266-306 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (37 lines × 2) · ×1
  • Duplicated block (37 lines × 2) datafusion/datasource/src/memory.rs:95 — datafusion/datasource/src/memory.rs:95-131 | datafusion/physical-plan/src/test.rs:87-123 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (36 lines × 2) · ×1
  • Duplicated block (36 lines × 2) datafusion/spark/src/function/math/width_bucket.rs:339 — datafusion/spark/src/function/math/width_bucket.rs:339-374 | datafusion/spark/src/function/math/width_bucket.rs:390-425 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (33 lines × 2) · ×1
  • Duplicated block (33 lines × 2) datafusion/physical-plan/src/aggregates/group_values/single_group_by/bytes.rs:93 — datafusion/physical-plan/src/aggregates/group_values/single_group_by/bytes.rs:93-125 | datafusion/physical-plan/src/aggregates/group_values/single_group_by/bytes_view.rs:95-127 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (29–31 lines × 2) · ×1
  • Duplicated block (29–31 lines × 2) datafusion/common/src/scalar/mod.rs:4800 — datafusion/common/src/scalar/mod.rs:4800-4828 | datafusion/common/src/scalar/mod.rs:4934-4964 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (31 lines × 2) · ×1
  • Duplicated block (31 lines × 2) datafusion/core/src/dataframe/mod.rs:2181 — datafusion/core/src/dataframe/mod.rs:2181-2211 | datafusion/core/src/dataframe/mod.rs:2251-2281 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (26–28 lines × 2) · ×1
  • Duplicated block (26–28 lines × 2) datafusion/physical-plan/src/joins/piecewise_merge_join/classic_join.rs:489 — datafusion/physical-plan/src/joins/piecewise_merge_join/classic_join.rs:489-516 | datafusion/physical-plan/src/joins/piecewise_merge_join/classic_join.rs:519-544 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (26–27 lines × 3) · ×1
  • Duplicated block (26–27 lines × 3) datafusion/functions-aggregate/src/first_last.rs:211 — datafusion/functions-aggregate/src/first_last.rs:211-236 | datafusion/functions-aggregate/src/min_max.rs:249-275 | datafusion/functions-aggregate/src/min_max.rs:548-574 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (17–27 lines × 2) · ×1
  • Duplicated block (17–27 lines × 2) datafusion/datasource/src/file_scan_config/mod.rs:1442 — datafusion/datasource/src/file_scan_config/mod.rs:1442-1458 | datafusion/datasource/src/file_scan_config/mod.rs:1515-1541 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (27 lines × 2) · ×1
  • Duplicated block (27 lines × 2) datafusion/functions-aggregate-common/src/aggregate/groups_accumulator/accumulate.rs:612 — datafusion/functions-aggregate-common/src/aggregate/groups_accumulator/accumulate.rs:612-638 | datafusion/functions-aggregate-common/src/aggregate/groups_accumulator/accumulate.rs:647-673 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (26 lines × 4) · ×1
  • Duplicated block (26 lines × 4) datafusion-cli/src/object_storage.rs:399 — datafusion-cli/src/object_storage.rs:399-424 | datafusion-cli/src/object_storage.rs:484-509 | datafusion/common/src/config.rs:2319-2344 | datafusion/common/src/config.rs:3080-3105 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (24–26 lines × 2) · ×1
  • Duplicated block (24–26 lines × 2) datafusion/common/src/hash_utils.rs:413 — datafusion/common/src/hash_utils.rs:413-438 | datafusion/common/src/hash_utils/build_hasher.rs:304-327 — before extracting anything, compare `datafusion/common/src/hash_utils.rs` and `datafusion/common/src/hash_utils/build_hasher.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 45 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (26 lines × 2) · ×1
  • Duplicated block (26 lines × 2) datafusion/functions/src/unicode/lpad.rs:394 — datafusion/functions/src/unicode/lpad.rs:394-419 | datafusion/functions/src/unicode/rpad.rs:393-418 — before extracting anything, compare `datafusion/functions/src/unicode/lpad.rs` and `datafusion/functions/src/unicode/rpad.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 229 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (9–25 lines × 4) · ×1
  • Duplicated block (9–25 lines × 4) datafusion-cli/src/functions.rs:362 — datafusion-cli/src/functions.rs:362-370 | datafusion-cli/src/functions.rs:516-537 | datafusion-cli/src/functions.rs:633-657 | datafusion-cli/src/functions.rs:797-821 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (24 lines × 3) · ×1
  • Duplicated block (24 lines × 3) datafusion/functions/src/datetime/to_timestamp.rs:610 — datafusion/functions/src/datetime/to_timestamp.rs:610-633 | datafusion/functions/src/datetime/to_timestamp.rs:679-702 | datafusion/functions/src/datetime/to_timestamp.rs:748-771 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (17–23 lines × 3) · ×1
  • Duplicated block (17–23 lines × 3) datafusion/functions/src/math/round.rs:192 — datafusion/functions/src/math/round.rs:192-208 | datafusion/functions/src/math/trunc.rs:86-108 | datafusion/spark/src/function/math/round.rs:67-87 — before extracting anything, compare `datafusion/functions/src/math/round.rs` and `datafusion/functions/src/math/trunc.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (20–23 lines × 3) · ×1
  • Duplicated block (20–23 lines × 3) datafusion/physical-plan/src/topk/mod.rs:1398 — datafusion/physical-plan/src/topk/mod.rs:1398-1417 | datafusion/physical-plan/src/topk/mod.rs:1716-1735 | datafusion/physical-plan/src/topk/mod.rs:2220-2242 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (17–22 lines × 2) · ×1
  • Duplicated block (17–22 lines × 2) datafusion/common/src/config.rs:2254 — datafusion/common/src/config.rs:2254-2275 | datafusion/common/src/config.rs:2292-2308 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (22 lines × 2) · ×1
  • Duplicated block (22 lines × 2) datafusion/ffi/src/physical_expr/mod.rs:431 — datafusion/ffi/src/physical_expr/mod.rs:431-452 | datafusion/ffi/src/physical_expr/mod.rs:475-496 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (18–22 lines × 2) · ×1
  • Duplicated block (18–22 lines × 2) datafusion/physical-expr/src/window/aggregate.rs:276 — datafusion/physical-expr/src/window/aggregate.rs:276-297 | datafusion/physical-expr/src/window/sliding_aggregate.rs:208-225 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (12–20 lines × 2) · ×1
  • Duplicated block (12–20 lines × 2) datafusion/functions/src/datetime/to_timestamp.rs:432 — datafusion/functions/src/datetime/to_timestamp.rs:432-443 | datafusion/functions/src/datetime/to_timestamp.rs:541-560 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (15–19 lines × 3) · ×1
  • Duplicated block (15–19 lines × 3) datafusion/functions-nested/src/array_avg.rs:139 — datafusion/functions-nested/src/array_avg.rs:139-157 | datafusion/functions-nested/src/array_product.rs:143-157 | datafusion/functions-nested/src/array_sum.rs:139-157 — before extracting anything, compare `datafusion/functions-nested/src/array_avg.rs` and `datafusion/functions-nested/src/array_product.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 53 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (17–19 lines × 2) · ×1
  • Duplicated block (17–19 lines × 2) datafusion/functions-nested/src/array_has.rs:679 — datafusion/functions-nested/src/array_has.rs:679-697 | datafusion/functions-nested/src/array_has.rs:731-747 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (18–19 lines × 2) · ×1
  • Duplicated block (18–19 lines × 2) datafusion/physical-plan/src/windows/proto.rs:151 — datafusion/physical-plan/src/windows/proto.rs:151-168 | datafusion/proto/src/physical_plan/from_proto.rs:171-189 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (18 lines × 3) · ×1
  • Duplicated block (18 lines × 3) datafusion/datasource-csv/src/source.rs:540 — datafusion/datasource-csv/src/source.rs:540-557 | datafusion/datasource-json/src/source.rs:595-612 | datafusion/datasource-parquet/src/writer.rs:71-88 — before extracting anything, compare `datafusion/datasource-csv/src/source.rs` and `datafusion/datasource-json/src/source.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (14–18 lines × 2) · ×1
  • Duplicated block (14–18 lines × 2) datafusion/common/src/scalar/mod.rs:5151 — datafusion/common/src/scalar/mod.rs:5151-5164 | datafusion/common/src/scalar/mod.rs:5240-5257 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (13–18 lines × 2) · ×1
  • Duplicated block (13–18 lines × 2) datafusion/physical-plan/src/aggregates/ordered_single_stream.rs:263 — datafusion/physical-plan/src/aggregates/ordered_single_stream.rs:263-275 | datafusion/physical-plan/src/aggregates/single_stream.rs:293-310 — before extracting anything, compare `datafusion/physical-plan/src/aggregates/ordered_single_stream.rs` and `datafusion/physical-plan/src/aggregates/single_stream.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 101 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (16 lines × 3) · ×1
  • Duplicated block (16 lines × 3) datafusion/physical-plan/src/sorts/partitioned_topk.rs:513 — datafusion/physical-plan/src/sorts/partitioned_topk.rs:513-528 | datafusion/physical-plan/src/sorts/partitioned_topk.rs:531-546 | datafusion/physical-plan/src/sorts/partitioned_topk.rs:549-564 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (15–16 lines × 2) · ×1
  • Duplicated block (15–16 lines × 2) datafusion/functions/src/core/arrow_cast.rs:161 — datafusion/functions/src/core/arrow_cast.rs:161-175 | datafusion/functions/src/core/arrow_try_cast.rs:133-148 — before extracting anything, compare `datafusion/functions/src/core/arrow_cast.rs` and `datafusion/functions/src/core/arrow_try_cast.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (9–15 lines × 4) · ×1
  • Duplicated block (9–15 lines × 4) datafusion/sql/src/unparser/expr.rs:1626 — datafusion/sql/src/unparser/expr.rs:1626-1640 | datafusion/sql/src/unparser/expr.rs:1642-1656 | datafusion/sql/src/unparser/expr.rs:1658-1672 | datafusion/sql/src/unparser/expr.rs:1673-1681 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (11–15 lines × 2) · ×1
  • Duplicated block (11–15 lines × 2) datafusion/physical-plan/src/spill/in_progress_spill_file.rs:73 — datafusion/physical-plan/src/spill/in_progress_spill_file.rs:73-87 | datafusion/physical-plan/src/spill/in_progress_spill_file.rs:116-126 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (12–14 lines × 3) · ×1
  • Duplicated block (12–14 lines × 3) datafusion/catalog/src/information_schema.rs:396 — datafusion/catalog/src/information_schema.rs:396-409 | datafusion/catalog/src/information_schema.rs:411-424 | datafusion/catalog/src/information_schema.rs:425-436 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (13–14 lines × 2) · ×1
  • Duplicated block (13–14 lines × 2) datafusion/functions-aggregate/src/array_agg.rs:963 — datafusion/functions-aggregate/src/array_agg.rs:963-976 | datafusion/functions-aggregate/src/array_agg.rs:1156-1168 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (11–13 lines × 3) · ×1
  • Duplicated block (11–13 lines × 3) datafusion/physical-plan/src/aggregates/ordered_single_stream.rs:674 — datafusion/physical-plan/src/aggregates/ordered_single_stream.rs:674-686 | datafusion/physical-plan/src/aggregates/partial_reduce_stream.rs:515-527 | datafusion/physical-plan/src/aggregates/single_stream.rs:701-711 — before extracting anything, compare `datafusion/physical-plan/src/aggregates/ordered_single_stream.rs` and `datafusion/physical-plan/src/aggregates/single_stream.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 101 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (9–11 lines × 3) · ×1
  • Duplicated block (9–11 lines × 3) datafusion/catalog/src/information_schema.rs:117 — datafusion/catalog/src/information_schema.rs:117-127 | datafusion/catalog/src/information_schema.rs:173-181 | datafusion/catalog/src/information_schema.rs:203-211 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (10–11 lines × 3) · ×1
  • Duplicated block (10–11 lines × 3) datafusion/functions-nested/src/utils.rs:141 — datafusion/functions-nested/src/utils.rs:141-151 | datafusion/functions/src/utils.rs:147-156 | datafusion/spark/src/function/functions_nested_utils.rs:43-53 — before extracting anything, compare `datafusion/functions-nested/src/utils.rs` and `datafusion/spark/src/function/functions_nested_utils.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (5–11 lines × 3) · ×1
  • Duplicated block (5–11 lines × 3) datafusion/spark/src/function/string/format_string.rs:1105 — datafusion/spark/src/function/string/format_string.rs:1105-1115 | datafusion/spark/src/function/string/format_string.rs:1122-1132 | datafusion/spark/src/function/string/format_string.rs:1138-1142 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (6–10 lines × 2) · ×1
  • Duplicated block (6–10 lines × 2) datafusion/datasource/src/memory.rs:744 — datafusion/datasource/src/memory.rs:744-749 | datafusion/physical-plan/src/joins/hash_join/exec.rs:2318-2327 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (5–10 lines × 3) · ×1
  • Duplicated block (5–10 lines × 3) datafusion/spark/src/function/string/format_string.rs:1199 — datafusion/spark/src/function/string/format_string.rs:1199-1207 | datafusion/spark/src/function/string/format_string.rs:1216-1225 | datafusion/spark/src/function/string/format_string.rs:1235-1239 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (9 lines × 5) · ×1
  • Duplicated block (9 lines × 5) datafusion/ffi/src/catalog_provider.rs:238 — datafusion/ffi/src/catalog_provider.rs:238-246 | datafusion/ffi/src/catalog_provider_list.rs:202-210 | datafusion/ffi/src/schema_provider.rs:248-256 | datafusion/ffi/src/table_provider_factory.rs:106-114 | datafusion/ffi/src/udtf.rs:206-215 — before extracting anything, compare `datafusion/ffi/src/catalog_provider.rs` and `datafusion/ffi/src/catalog_provider_list.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 45 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (7–9 lines × 3) · ×1
  • Duplicated block (7–9 lines × 3) datafusion/functions/src/regex/regexpinstr.rs:227 — datafusion/functions/src/regex/regexpinstr.rs:227-233 | datafusion/functions/src/regex/regexpinstr.rs:245-253 | datafusion/functions/src/regex/regexpinstr.rs:265-273 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (8 lines × 7) · ×1
  • Duplicated block (8 lines × 7) datafusion/functions-nested/src/utils.rs:130 — datafusion/functions-nested/src/utils.rs:130-137 | datafusion/functions/src/regex/regexpcount.rs:104-111 | datafusion/functions/src/regex/regexpinstr.rs:122-129 | datafusion/functions/src/regex/regexpmatch.rs:122-129 | datafusion/functions/src/regex/regexpreplace.rs:150-157 | datafusion/functions/src/utils.rs:123-130 | datafusion/spark/src/function/functions_nested_utils.rs:32-39 — before extracting anything, compare `datafusion/functions-nested/src/utils.rs` and `datafusion/spark/src/function/functions_nested_utils.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (7–8 lines × 5) · ×1
  • Duplicated block (7–8 lines × 5) datafusion/physical-plan/src/async_func.rs:179 — datafusion/physical-plan/src/async_func.rs:179-185 | datafusion/physical-plan/src/coalesce_batches.rs:189-196 | datafusion/physical-plan/src/sorts/sort_preserving_merge.rs:302-309 | datafusion/physical-plan/src/unnest.rs:245-251 | datafusion/physical-plan/src/windows/window_agg_exec.rs:270-276 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 5 times.
D4 · Code Duplication · Duplicated block (8 lines × 5) · ×1
  • Duplicated block (8 lines × 5) datafusion/spark/src/function/datetime/date_trunc.rs:77 — datafusion/spark/src/function/datetime/date_trunc.rs:77-84 | datafusion/spark/src/function/datetime/from_utc_timestamp.rs:89-96 | datafusion/spark/src/function/datetime/time_trunc.rs:71-78 | datafusion/spark/src/function/datetime/to_utc_timestamp.rs:91-98 | datafusion/spark/src/function/datetime/trunc.rs:78-85 — before extracting anything, compare `datafusion/spark/src/function/datetime/from_utc_timestamp.rs` and `datafusion/spark/src/function/datetime/to_utc_timestamp.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 70 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (6–8 lines × 2) · ×1
  • Duplicated block (6–8 lines × 2) datafusion/common/src/scalar/mod.rs:3338 — datafusion/common/src/scalar/mod.rs:3338-3345 | datafusion/common/src/scalar/mod.rs:3445-3450 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (7 lines × 11) · ×1
  • Duplicated block (7 lines × 11) datafusion/physical-plan/src/aggregates/mod.rs:2211 — datafusion/physical-plan/src/aggregates/mod.rs:2211-2217 | datafusion/physical-plan/src/async_func.rs:179-185 | datafusion/physical-plan/src/buffer.rs:177-183 | datafusion/physical-plan/src/coalesce_batches.rs:189-195 | datafusion/physical-plan/src/coalesce_partitions.rs:166-172 | datafusion/physical-plan/src/filter.rs:600-606 | datafusion/physical-plan/src/limit.rs:185-191 | datafusion/physical-plan/src/limit.rs:466-472 | datafusion/physical-plan/src/sorts/sort_preserving_merge.rs:302-308 | datafusion/physical-plan/src/unnest.rs:245-251 | datafusion/physical-plan/src/windows/window_agg_exec.rs:270-276 — there are 11 copies across 10 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 11 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (7 lines × 5) · ×1
  • Duplicated block (7 lines × 5) datafusion/spark/src/function/string/format_string.rs:1203 — datafusion/spark/src/function/string/format_string.rs:1203-1209 | datafusion/spark/src/function/string/format_string.rs:1221-1227 | datafusion/spark/src/function/string/format_string.rs:1240-1246 | datafusion/spark/src/function/string/format_string.rs:1258-1264 | datafusion/spark/src/function/string/format_string.rs:1370-1376 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (6 lines × 6) · ×1
  • Duplicated block (6 lines × 6) datafusion/functions/src/math/abs.rs:177 — datafusion/functions/src/math/abs.rs:177-182 | datafusion/functions/src/math/monotonicity.rs:345-351 | datafusion/functions/src/math/monotonicity.rs:448-454 | datafusion/functions/src/math/monotonicity.rs:486-492 | datafusion/functions/src/math/monotonicity.rs:524-530 | datafusion/functions/src/math/monotonicity.rs:651-657 — there are 6 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 6 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (4–5 lines × 4) · ×1
  • Duplicated block (4–5 lines × 4) datafusion/functions/src/datetime/date_trunc.rs:760 — datafusion/functions/src/datetime/date_trunc.rs:760-764 | datafusion/functions/src/datetime/date_trunc.rs:765-769 | datafusion/functions/src/datetime/date_trunc.rs:771-775 | datafusion/functions/src/datetime/date_trunc.rs:776-779 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (11 lines × 5) · ×1
  • Duplicated block (11 lines × 5) datafusion/functions/src/string/ascii.rs:66 — datafusion/functions/src/string/ascii.rs:66-76 | datafusion/functions/src/string/bit_length.rs:59-69 | datafusion/functions/src/string/lower.rs:57-67 | datafusion/functions/src/string/upper.rs:56-66 | datafusion/functions/src/unicode/initcap.rs:64-74 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 5 times.
D4 · Code Duplication · Duplicated block (11 lines × 4) · ×1
  • Duplicated block (11 lines × 4) datafusion/functions/src/string/contains.rs:59 — datafusion/functions/src/string/contains.rs:59-69 | datafusion/functions/src/string/ends_with.rs:67-77 | datafusion/functions/src/string/levenshtein.rs:71-81 | datafusion/functions/src/string/starts_with.rs:63-73 — before extracting anything, compare `datafusion/functions/src/string/ends_with.rs` and `datafusion/functions/src/string/starts_with.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 64 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (9 lines × 10) · ×1
  • Duplicated block (9 lines × 10) datafusion/spark/src/function/string/format_string.rs:1205 — datafusion/spark/src/function/string/format_string.rs:1205-1213 | datafusion/spark/src/function/string/format_string.rs:1223-1232 | datafusion/spark/src/function/string/format_string.rs:1242-1251 | datafusion/spark/src/function/string/format_string.rs:1260-1268 | datafusion/spark/src/function/string/format_string.rs:1278-1287 | datafusion/spark/src/function/string/format_string.rs:1297-1307 | datafusion/spark/src/function/string/format_string.rs:1317-1326 | datafusion/spark/src/function/string/format_string.rs:1337-1346 | datafusion/spark/src/function/string/format_string.rs:1355-1363 | datafusion/spark/src/function/string/format_string.rs:1372-1380 — all 10 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D5 · Coupling · Unstable project datafusion · ×1
  • Unstable project datafusion — datafusion has instability 0.84 with 5 dependents.
D5 · Coupling · Unstable project datafusion-catalog-listing · ×1
  • Unstable project datafusion-catalog-listing — datafusion-catalog-listing has instability 0.82 with 2 dependents.
D5 · Coupling · Unstable project datafusion-datasource-arrow · ×1
  • Unstable project datafusion-datasource-arrow — datafusion-datasource-arrow has instability 0.82 with 2 dependents.
D5 · Coupling · Unstable project datafusion-datasource-avro · ×1
  • Unstable project datafusion-datasource-avro — datafusion-datasource-avro has instability 0.83 with 2 dependents.
D5 · Coupling · Unstable project datafusion-datasource-csv · ×1
  • Unstable project datafusion-datasource-csv — datafusion-datasource-csv has instability 0.82 with 2 dependents.
D5 · Coupling · Unstable project datafusion-datasource-json · ×1
  • Unstable project datafusion-datasource-json — datafusion-datasource-json has instability 0.82 with 2 dependents.
D5 · Coupling · Unstable project datafusion-datasource-parquet · ×1
  • Unstable project datafusion-datasource-parquet — datafusion-datasource-parquet has instability 0.88 with 2 dependents.
D5 · Coupling · Unstable project datafusion-physical-optimizer · ×1
  • Unstable project datafusion-physical-optimizer — datafusion-physical-optimizer has instability 0.82 with 2 dependents.
D5 · Coupling · Unstable project datafusion-proto · ×1
  • Unstable project datafusion-proto — datafusion-proto has instability 0.94 with 1 dependents.
D5 · Coupling · Unstable project datafusion-spark · ×1
  • Unstable project datafusion-spark — datafusion-spark has instability 0.82 with 2 dependents.
P12 · CI test-gate honesty · Coverage collected but not gated · ×1
  • Coverage collected but not gated — CI collects a coverage report but no step enforces a minimum — coverage could halve and CI stays green. Add a step that fails the build when coverage drops below a floor (your coverage tool's minimum-threshold flag, or a coverage-gate action) so the number guards something. What was searched, so you can tell an absence from a miss: this repository's CI files AND its coverage configuration — the well-known coverage and test-runner config files, read at the repository root and inside workspace package directories two levels down, so a floor declared beside the tests rather than in the pipeline is credited — matched against the threshold settings this check knows by name. A floor set in your coverage service's web UI rather than in a committed file, or under a setting whose name is not one of those, is not seen here.
Minor — 21 finding(s)
D16 · Bus Factor · Off-boarding risk · ×4
  • Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 6 significant file(s) lose their only recent owner: datafusion/datasource/src/morsel/mocks.rs, datafusion/datasource/src/morsel/mod.rs, datafusion/datasource/src/file_stream/metrics.rs, datafusion/sqllogictest/src/test_file.rs, datafusion/common-runtime/src/join_set.rs, datafusion/datasource/src/file_stream/builder.rs. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 4 significant file(s) lose their only recent owner: datafusion/physical-expr/src/expressions/in_list/branchless_filter.rs, datafusion/physical-expr/src/expressions/in_list/dictionary_filter.rs, datafusion/physical-expr/src/expressions/in_list/array_static_filter.rs, datafusion/physical-expr/src/expressions/in_list/result.rs. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #3 — If anonymized user #3 becomes unavailable, 4 significant file(s) lose their only recent owner: datafusion/physical-plan/src/proto_test_util.rs, datafusion/datasource/src/proto.rs, datafusion/datasource-parquet/src/opener/early_stop.rs, datafusion/datasource-parquet/src/test_util.rs. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #4 — If anonymized user #4 becomes unavailable, 3 significant file(s) lose their only recent owner: datafusion-examples/src/utils/example_metadata/model.rs, datafusion-examples/src/utils/example_metadata/parser.rs, datafusion-examples/src/utils/example_metadata/discover.rs. Pair on, review, or document these before any departure.
D29 · Static Analysis (SAST) · REDACTED · ×3
  • REDACTED
  • REDACTED
  • REDACTED
D31 · IaC & Container Security · Low IaC · ×3
  • REDACTED
  • REDACTED
  • REDACTED
D19 · Documentation Quality · Documentation · ×2
  • Documentation: no installation or build instructions datafusion/ffi/README.md — The README states licensing, purpose, and limitations but provides no install/build or setup instructions. Add an Install section covering Cargo.toml configuration, linking to the FFI crate, and a minimal build/run example.
  • Documentation: no usage examples datafusion/ffi/README.md — The document begins with an overview but does not yet show how to run or use the crate. Add a short Usage section showing one or two concrete examples, such as calling a DataFusion function from this FFI crate.
D16 · Bus Factor · Further sole-owners (lower concentration) · ×1
  • Further sole-owners (lower concentration) — 20 other contributor(s) are each the sole owner of a small amount of code below the off-boarding threshold — folded into the bus-factor score and metrics (43 single-owned of 1096 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated and example/demo trees and test files identified by path convention, largest first; 1096 of the 1246 production source files in this repository met that bar). They are anonymized user #5 (2 file(s)), anonymized user #6 (2 file(s)), anonymized user #7 (2 file(s)), anonymized user #8 (2 file(s)), anonymized user #9 (2 file(s)), anonymized user #10 (2 file(s)) (+14 more) — spread or document their files in the same way, at lower priority than the named off-boarding risks above.
D20 · ADR Quality · No ADRs found · ×1
  • No ADRs found — No ADRs found. No recognised ADR directory (`docs/adr/`, `docs/decisions/`, `adr/`, `docs/rfcs/`, an `ADR0001/` folder, or their siblings) exists anywhere in this tree. What was searched, so you can tell an empty log from a search that missed one: every directory under the tree (build output, dependencies and VCS metadata excepted), for a document that is either any non-index page inside a recognised ADR directory, whatever its name and however deeply nested (`docs/adr/use-postgres.md`, `docs/adr/2024/0001-x.md`); or a file anywhere whose name is ADR-shaped (`0001-use-postgres.md`, `adr-012-caching.md`); or, when neither turned anything up, a document carrying the decision-record signature (an "Architecture Decision Record" heading, or Status / Context / Decision / Consequences as section headings). A decision log that clears none of these — unnumbered files outside any recognised directory, without those headings — is not seen by this check and this row is then wrong. If that is your case, say so rather than renaming anything; otherwise, consider recording architectural decisions in `docs/adr/`.
D26 · Project Cohesion · Projects may be oversized for their cohesion · ×1
  • Projects may be oversized for their cohesion — 8 of 46 project(s) overshoot their size bounds, lowering Project Cohesion to 6.5/10. The most over is `datafusion/physical-plan` (150676 LoC, 281 public types across 20 directories). Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
D28 · Secrets (history) · Rotate the exposed credentials · ×1
  • REDACTED
D34 · Knowledge Freshness · Orphaned files with no living knowledge · ×1
  • Orphaned files with no living knowledge — 34 of 1096 analysed file(s) have no living knowledge left — their last meaningful change has decayed away, so if one breaks, no one currently understands it (counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated and example/demo trees and test files identified by path convention, largest first; 1096 of the 1246 production source files in this repository met that bar). None is large enough to earn a read-through of its own, so this row stands in for the per-file rows rather than raising one each — most significant first: dev/create_license.py, datafusion/common/src/rounding.rs, benchmarks/src/imdb/mod.rs, datafusion/spark/src/function/datetime/to_utc_timestamp.rs, datafusion/common/src/spans.rs, datafusion/spark/src/function/string/space.rs, datafusion/physical-plan/src/render_tree.rs, datafusion/spark/src/function/datetime/from_utc_timestamp.rs (and 26 more). Attach the read to the next change that touches one of them: have a second person review that change, and leave behind a short comment or test recording what the file is for, so the knowledge comes back at the cost of a change you were making anyway.
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
M2 · Architecture documentation · No ADRs · ×1
  • No ADRs — No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
P2 · Observability · Logging is not universal · ×1
  • Logging is not universal — Only 21/27 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `datafusion-examples`, `datafusion/proto-common/gen`, `datafusion/proto-models/gen`, `dev`, `dev/depcheck` and 1 more.
Minor — 2 finding(s)
D12 · Dependency Hygiene · Outdated · ×2
  • Outdated: thiserror — `thiserror` is locked at 2.0.20 but 2.0.21 is the current stable release on crates.io, and it already satisfies the `"2.0.18"` requirement declared in datafusion/sqllogictest/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p thiserror` and commit the updated REDACTED.
  • Outdated: wasm-bindgen — `wasm-bindgen` is locked at 0.2.118 but 0.2.129 is the current stable release on crates.io, and it already satisfies the `"0.2.99"` requirement declared in datafusion/wasmtest/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p wasm-bindgen` and commit the updated REDACTED.

Appendix B — Reproduction & audit trail

Every external tool invocation behind a deep-scan dimension — the tool, its captured version, the exact command, how many findings it yielded, and a link to the retained raw output. To reproduce any finding: check out the same commit and run the command shown (repo-relative — never an absolute scratch path). The complete raw scanner output is retained verbatim under artifacts/raw/ (indexed in artifacts/raw/index.json); per-invocation exit codes and wall-clock durations are in sidecar.json — kept out of this table so the rendered report stays byte-identical across runs of the same commit.

DimensionToolVersionCommandFindingsRaw output
D28 · Secrets (history)gitleaks—gitleaks detect --no-banner --config /opt/gitleaks-rules/watchdog-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-b5758e7a38ad4704911308f9b814d968/history.json --exit-code 0 --source .1artifacts/raw/gitleaks-history.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-git --no-banner --config /opt/gitleaks-rules/watchdog-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-b5758e7a38ad4704911308f9b814d968/tree.json --exit-code 0 --source .0artifacts/raw/gitleaks-tree.json
D29 · Static Analysis (SAST)semgrep—semgrep --config /opt/semgrep-rules/security-audit.yml --config /opt/semgrep-rules/owasp-top-ten.yml --config /opt/semgrep-rules/watchdog-sast.yml --json --quiet --timeout 10 --timeout-threshold 3 --metrics off .57artifacts/raw/semgrep.json
D30 · Dependency Vulnerabilitiestrivy—trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** . --skip-db-update7artifacts/raw/trivy-fs.json
D31 · IaC & Container Securitytrivy—trivy config --format json --quiet .6artifacts/raw/trivy-config.json
D32 · Data Compliance (PII/GDPR)semgrep—semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that.0—
D37 · Vulnerability-disclosure Policydisclosure—disclosure: not applicable — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.0—
D40 · Network Egress Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.0—
D41 · Kernel & Syscall Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.0—
D42 · Runtime Threat Enforcementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.0—
D43 · Malicious Dependenciestrivy—trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** . --skip-db-update0artifacts/raw/trivy-fs.json

Run 01a0eb90-f54e-762f-8bbb-300f24e70c28 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.

Downloadable artifacts

Machine-readable and reproducible from this commit + frozen rubric — drop them straight into a contract appendix, a CRA dossier, or a downstream SCA / VEX tool.

⬇ Findings, MITRE CWE-tagged .sarif⬇ Health changelog .md