Public report of apache/datafusion, published 14 November 2026. It has the same score, grades and number of findings as the full report. The details of security findings (where they are in the code, which known vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive report Measured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.11.4). Assert signed this survey and filed it in the standard's public register, where anyone can look it up by its survey ID. Check this survey → Signed and filed in the standard's public register, 14 November 2026, 16:46 UTC · Survey ID cd_bd75257e555c41a28501bc98e0317ae6

apache/datafusion

Measured 14 November 2026, 16:43 UTC, at code version 73e0b03

CAI score 61out of 100 Adequate
CriticalWeakAdequateStrongExemplary
Down 13 since the last survey

The score is built from these lenses. Each lens grades one area of the code, such as how easy it is to change or how well it is protected. The weakest lens counts most, so one weak area pulls the score down instead of being averaged away.

A very large codebase: 769,237 lines of product code in 47 projects, tests not counted · Estimated rebuild effort: about 7.3 person-years · Weakest lens: Code Health, 51

Findings by how serious they are

49 critical 2437 serious 83 minor

15 dimensions are left out of the score. For each one, we either couldn't measure it in this code, or found no evidence of the safeguard we look for, such as a tested backup restore. They count neither for nor against the score, and Limitations lists each one with its reason.

This survey was produced by

Assert small markCanine Code Analyzer
Producer
Canine Development
Analyzer
Canine Code Analyzer engine 1.0.0
Measured
14 November 2026, 16:43 UTC

A measurement, not a certificate. The Code Assurance Index records a number together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee the code. The standard was written by Canine Development, which also builds the Canine Code Analyzer. It is open to any tool that implements it, and today the Canine Code Analyzer is the only one that does.

The score is deterministic, which means the same code always gets the same score. We work it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸

58of 58 dimensions measured by tools.
2531of 2569 findings point to an exact file and line, so you can open each one in the code. The other 38 concern the repository as a whole, such as missing documentation.
58dimensions across 6 lenses, read from 769,237 lines of product code in 47 projects.
Chapters

Executive summary

apache/datafusion falls short of our standard for production, held back most by its Code Health lens, the quality of the code itself. It scores 61 out of 100 and is rated Adequate, and 46 of its 49 critical findings are security problems.

Code Health, at 51, is the weakest lens and counts most in the score. The best first step is adding type checking, worth about 8 points. Recording design decisions comes next, worth about 2 points. Raising Code Health to 70 would lift the score to about 69.

Twenty-one pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with. Nine pipeline steps run downloads nobody checks, and nine weaknesses in the code could be used by an attacker. Pinning each tool to an exact version, checking each download against a checksum and fixing the weaknesses the scanner points to would close these risks. Setting a waiting period for automatic updates would fix the automatic dependency update that takes a new release at once, and updating the vulnerable packages would deal with the package with a known security hole. The three parts of the code nobody has worked on for a long time need someone to learn and document them before anyone changes them.

The product code is 769,237 lines, about €1,100,000 to rebuild.

A lens is capped at Adequate while one of its dimensions scores below 4 out of 10, however well the rest of the lens does. That way a serious problem in one place always shows in the lens's rating.

How the score is built: what each lens counts for The lenses don't count equally. The weakest lens counts most, the next weakest a little less, and so on, so a weak area pulls the score down instead of being averaged away. In the bar below, each part's width shows how much that lens counts and its colour shows its rating. Improving the widest part moves the score most, and as that lens improves, it counts for less, because another lens becomes the weakest.
Code Health 51 · counts for 46%Production Readiness 65 · counts for 25%Maturity 68 · counts for 14%Security and Compliance 70 · counts for 8%Performance 94 · counts for 4%Architecture 95 · counts for 2%

If Code Health rose from 51 to 70, the lowest score rated Strong, the score would rise from 61 to about 69.

Code composition: what the lines of code are
Product code 79%Tests 21%
New since the last survey: 718 findings

These 718 critical or serious findings weren't in the previous survey, on 27 October 2026. The first 100 are listed here, and the findings file in the download package lists them all.

  • Cyclomatic Complexity · cancel_merge_queue_runs.run (cyclomatic 25) ci/scripts/cancel_merge_queue_runs.cjs
  • Cyclomatic Complexity · InformationSchemaColumnsBuilder::add_column (cyclomatic 21) datafusion/expr/src/logical_plan/information_schema.rs
  • Cyclomatic Complexity · MultiLevelMergeBuilder::get_sorted_spill_files_to_merge (cyclomatic 19) datafusion/physical-plan/src/sorts/multi_level_merge.rs
  • Cyclomatic Complexity · RowGroupsPrunedParquetOpen::should_load_page_index (cyclomatic 17) datafusion/datasource-parquet/src/opener/mod.rs
  • Cyclomatic Complexity · PushdownSort::optimize (cyclomatic 17) datafusion/physical-optimizer/src/pushdown_sort.rs
  • Cyclomatic Complexity · datafusion_physical_plan::joins::hash_join::not_in::mark_null_candidates_for_probe_batch (cyclomatic 17) datafusion/physical-plan/src/joins/hash_join/not_in.rs
  • Cyclomatic Complexity · datafusion_optimizer::single_distinct_to_groupby::is_single_distinct_agg (cyclomatic 16) datafusion/optimizer/src/single_distinct_to_groupby.rs
  • Cognitive Complexity · cancel_merge_queue_runs.run (cognitive 44) ci/scripts/cancel_merge_queue_runs.cjs
  • Cognitive Complexity · datafusion_common::functional_dependencies::aggregate_functional_dependencies_with_computed_inputs (cognitive 28) datafusion/common/src/functional_dependencies.rs
  • Cognitive Complexity · KeyRangeBitmap::union (cognitive 28) datafusion/physical-plan/src/joins/key_range_bitmap.rs
  • Cognitive Complexity · CsvOpener::open (cognitive 23) datafusion/datasource-csv/src/source.rs
  • Cognitive Complexity · InformationSchemaConfig::add_columns (cognitive 21) datafusion/catalog/src/information_schema.rs
  • Cognitive Complexity · datafusion_physical_optimizer::ensure_requirements::enforce_sorting::sort_pushdown::is_custom_sort_pushdown_valid (cognitive 21) datafusion/physical-optimizer/src/ensure_requirements/enforce_sorting/sort_pushdown.rs
  • Cognitive Complexity · FileScanConfig::rebuild_with_source (cognitive 20) datafusion/datasource/src/file_scan_config/sort_pushdown.rs
  • Cognitive Complexity · SortKeyWalk::pin_key (cognitive 20) datafusion/physical-expr/src/equivalence/properties/walk.rs
  • Cognitive Complexity · RowGroupsPrunedParquetOpen::should_load_page_index (cognitive 19) datafusion/datasource-parquet/src/opener/mod.rs
  • Cognitive Complexity · CoalesceFunc::invoke_with_args (cognitive 19) datafusion/functions/src/core/coalesce.rs
  • Cognitive Complexity · UnmarkedPairs::scope_matches (cognitive 19) datafusion/physical-plan/src/joins/hash_join/not_in.rs
  • Cognitive Complexity · InformationSchemaConfig::add_tables (cognitive 18) datafusion/catalog/src/information_schema.rs
  • Cognitive Complexity · datafusion_physical_optimizer::join_selection::hash_join_convert_symmetric_subrule (cognitive 18) datafusion/physical-optimizer/src/join_selection.rs
  • Cognitive Complexity · datafusion_common::metadata::coerced_fields_metadata (cognitive 17) datafusion/common/src/metadata.rs
  • Cognitive Complexity · IncrementalSortIterator::next (cognitive 17) datafusion/physical-plan/src/sorts/stream.rs
  • Cognitive Complexity · InformationSchemaColumnsBuilder::add_column (cognitive 16) datafusion/expr/src/logical_plan/information_schema.rs
  • Cognitive Complexity · ReplaceFilterTop1::rewrite (cognitive 16) datafusion/optimizer/src/replace_filter_top1.rs
  • Cognitive Complexity · datafusion_optimizer::eliminate_cross_join::find_inner_join (cognitive 16) datafusion/optimizer/src/eliminate_cross_join.rs
  • Cognitive Complexity · BitwiseSortMergeJoinStream::join (cognitive 16) datafusion/physical-plan/src/joins/sort_merge_join/bitwise_stream.rs
  • God Classes · MethodTooLong: ScalarValue.try_from datafusion/proto-common/src/from_proto/mod.rs
  • God Classes · MethodTooLong: ScalarValue.try_from datafusion/proto-common/src/to_proto/mod.rs
  • God Classes · MethodTooLong: ParquetOptions.try_from datafusion/proto-models/src/from_proto.rs
  • God Classes · FileTooLong: src/source.rs datafusion/datasource-csv/src/source.rs
  • God Classes · FileTooLong: hash_join/shared_bounds.rs datafusion/physical-plan/src/joins/hash_join/shared_bounds.rs
  • God Classes · FileTooLong: logical_plan/information_schema.rs datafusion/expr/src/logical_plan/information_schema.rs
  • God Classes · FunctionTooLong: datafusion_substrait::logical_plan::consumer::expr::subquery::from_subquery datafusion/substrait/src/logical_plan/consumer/expr/subquery.rs
  • God Classes · MethodTooLong: CsvOpener.open datafusion/datasource-csv/src/source.rs
  • God Classes · MethodTooLong: ParquetOptions.try_from datafusion/proto-common/src/from_proto/mod.rs
  • God Classes · FileTooLong: piecewise_merge_join/classic_join.rs datafusion/physical-plan/src/joins/piecewise_merge_join/classic_join.rs
  • God Classes · TooManyMethods: ListingTable datafusion/catalog-listing/src/table.rs
  • God Classes · TooManyMethods: ExternalSorter datafusion/physical-plan/src/sorts/sort.rs
  • God Classes · FileTooLong: logical_plan/display.rs datafusion/expr/src/logical_plan/display.rs
  • God Classes · TooManyFields: ParquetMorselizer datafusion/datasource-parquet/src/opener/mod.rs
  • God Classes · FileTooLong: src/materialized_cte.rs datafusion/physical-plan/src/materialized_cte.rs
  • God Classes · FileTooLong: sorts/multi_level_merge.rs datafusion/physical-plan/src/sorts/multi_level_merge.rs
  • God Classes · ClassTooLong: DictionaryGroupValuesColumn datafusion/physical-plan/src/aggregates/group_values/multi_group_by/dictionary.rs
  • God Classes · ClassTooLong: PushDownFilter datafusion/optimizer/src/push_down_filter.rs
  • God Classes · FileTooLong: equivalence/class.rs datafusion/physical-expr/src/equivalence/class.rs
  • Code Duplication · Near-duplicate member pair (45 shared lines) datafusion/common/src/scalar/mod.rs
  • Code Duplication · Near-duplicate member pair (36 shared lines) datafusion/datasource-csv/src/source.rs
  • Code Duplication · Edited copy of a member (24 corresponding lines) datafusion/physical-expr/src/expressions/case.rs
  • Code Duplication · Edited copy of a member (19 corresponding lines) datafusion/functions/src/unicode/find_in_set.rs
  • Code Duplication · Edited copy of a member (26 corresponding lines) datafusion/physical-expr/src/simplifier/const_evaluator.rs
  • Code Duplication · Edited copy of a member (18 corresponding lines) datafusion/common/src/config.rs
  • Code Duplication · Edited copy of a member (23 corresponding lines) datafusion/physical-plan/src/topk/mod.rs
  • Code Duplication · Members sharing a duplicated core (12 members, 50+ identical tokens) datafusion/physical-plan/src/aggregates/mod.rs
  • Code Duplication · Members sharing a duplicated core (7 members, 50+ identical tokens) datafusion/ffi/src/query_planner.rs
  • Code Duplication · Members sharing a duplicated core (7 members, 50+ identical tokens) datafusion/functions-nested/src/utils.rs
  • Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) datafusion/ffi/src/catalog_provider.rs
  • Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) datafusion/functions-nested/src/string.rs
  • Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) datafusion/functions/src/math/abs.rs
  • Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) datafusion/datasource/src/memory.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) datafusion/catalog-listing/src/helpers.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) datafusion/common/src/scalar/mod.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) datafusion/ffi/src/udaf/accumulator.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) datafusion/functions-aggregate/src/covariance.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) datafusion/physical-expr/src/aggregate.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) datafusion/physical-plan/src/filter.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) datafusion/physical-plan/src/joins/asof_join.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) datafusion/physical-plan/src/joins/asof_join.rs
  • Code Duplication · Edited copy of a member (131 corresponding lines) datafusion/common/src/scalar/mod.rs
  • Code Duplication · Edited copy of a member (74 corresponding lines) datafusion/common/src/scalar/mod.rs
  • Code Duplication · Edited copy of a member (66 corresponding lines) datafusion/common/src/hash_utils.rs
  • Code Duplication · Edited copy of a member (116 corresponding lines) datafusion/functions/src/math/ceil.rs
  • Code Duplication · Edited copy of a member (56 corresponding lines) datafusion/functions/src/datetime/make_date.rs
  • Code Duplication · Edited copy of a member (68 corresponding lines) datafusion/physical-plan/src/aggregates/aggregate_hash_table/common.rs
  • Code Duplication · Edited copy of a member (82 corresponding lines) datafusion/functions-nested/src/extract.rs
  • Code Duplication · Edited copy of a member (67 corresponding lines) datafusion/physical-plan/src/windows/proto.rs
  • Code Duplication · Edited copy of a member (34 corresponding lines) datafusion/expr/src/logical_plan/plan.rs
  • Code Duplication · Edited copy of a member (54 corresponding lines) datafusion/expr-common/src/signature.rs
  • Code Duplication · Edited copy of a member (65 corresponding lines) datafusion/physical-plan/src/aggregates/clustered_single_stream.rs
  • Code Duplication · Edited copy of a member (38 corresponding lines) datafusion/physical-expr/src/equivalence/properties/mod.rs
  • Code Duplication · Edited copy of a member (46 corresponding lines) datafusion/functions-nested/src/array_has.rs
  • Code Duplication · Edited copy of a member (47 corresponding lines) datafusion/functions-nested/src/reverse.rs
  • Code Duplication · Edited copy of a member (53 corresponding lines) datafusion/common/src/hash_utils.rs
  • Code Duplication · Edited copy of a member (65 corresponding lines) datafusion/functions/src/string/split_part.rs
  • Code Duplication · Edited copy of a member (60 corresponding lines) datafusion/physical-expr/src/expressions/case/literal_lookup_table/bytes_like_lookup_table.rs
  • Code Duplication · Edited copy of a member (32 corresponding lines) datafusion/core/src/execution/session_state.rs
  • Code Duplication · Edited copy of a member (68 corresponding lines) datafusion/datasource/src/file_scan_config/mod.rs
  • Code Duplication · Edited copy of a member (49 corresponding lines) datafusion/physical-plan/src/aggregates/aggregate_hash_table/common.rs
  • Code Duplication · Edited copy of a member (39 corresponding lines) datafusion/physical-plan/src/aggregates/clustered_final_stream.rs
  • Code Duplication · Edited copy of a member (39 corresponding lines) datafusion/functions-aggregate/src/first_last.rs
  • Code Duplication · Edited copy of a member (47 corresponding lines) datafusion/catalog/src/async.rs
  • Code Duplication · Edited copy of a member (80 corresponding lines) datafusion/functions-aggregate/src/planner.rs
  • Code Duplication · Edited copy of a member (35 corresponding lines) datafusion/physical-plan/src/repartition/range.rs
  • Code Duplication · Edited copy of a member (47 corresponding lines) datafusion/physical-plan/src/aggregates/group_values/multi_group_by/boolean.rs
  • Code Duplication · Edited copy of a member (43 corresponding lines) datafusion/functions/src/math/cot.rs
  • Code Duplication · Edited copy of a member (42 corresponding lines) datafusion/functions-nested/src/position.rs
  • Code Duplication · Edited copy of a member (39 corresponding lines) datafusion/common/src/hash_utils.rs
  • Code Duplication · Edited copy of a member (33 corresponding lines) datafusion/expr-common/src/interval_arithmetic.rs
  • Code Duplication · Edited copy of a member (34 corresponding lines) datafusion/sql/src/unparser/dialect.rs
  • Code Duplication · Edited copy of a member (52 corresponding lines) datafusion/functions-aggregate-common/src/min_max.rs

We compare every finding with the previous survey's. A finding that has only moved to another line in the same file counts as the same finding, so only new findings appear here. Advisory notes from the AI model are left out, because the model words them afresh in every survey.

Fixed since the last survey: 463 findings

These 463 critical or serious findings were in the previous survey, on 27 October 2026, and are gone from this one. The first 100 are listed here.

  • Cyclomatic Complexity · ArrowType::deserialize (cyclomatic 124) datafusion/proto-common/src/generated/pbjson.rs
  • Cyclomatic Complexity · PhysicalPlanNode::deserialize (cyclomatic 121) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · LogicalExprNode::deserialize (cyclomatic 106) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · LogicalPlanNode::deserialize (cyclomatic 103) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · PhysicalExprNode::deserialize (cyclomatic 85) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · ConversionSpecifier::format (cyclomatic 83) datafusion/spark/src/function/string/format_string.rs
  • Cyclomatic Complexity · LogicalPlanNode::try_into_logical_plan (cyclomatic 76) datafusion/proto/src/logical_plan/mod.rs
  • Cyclomatic Complexity · ListingTableScanNode::deserialize (cyclomatic 46) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · CreateExternalTableNode::deserialize (cyclomatic 46) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · datafusion_spark::function::math::round::spark_round (cyclomatic 45) datafusion/spark/src/function/math/round.rs
  • Cyclomatic Complexity · FileScanExecConf::deserialize (cyclomatic 43) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · AggregateExecNode::deserialize (cyclomatic 43) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · ConversionSpecifier::format_hex_float (cyclomatic 38) datafusion/spark/src/function/string/format_string.rs
  • Cyclomatic Complexity · HashJoinExecNode::deserialize (cyclomatic 37) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · datafusion_spark::function::math::negative::spark_negative (cyclomatic 37) datafusion/spark/src/function/math/negative.rs
  • Cyclomatic Complexity · datafusion_spark::function::string::format_string::take_conversion_specifier (cyclomatic 36) datafusion/spark/src/function/string/format_string.rs
  • Cyclomatic Complexity · ConversionSpecifier::format_time_component (cyclomatic 34) datafusion/spark/src/function/string/format_string.rs
  • Cyclomatic Complexity · CreateExternalTableNode::serialize (cyclomatic 31) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · JoinNode::deserialize (cyclomatic 31) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · WindowExprNode::deserialize (cyclomatic 31) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · PhysicalWindowExprNode::deserialize (cyclomatic 31) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · PhysicalFormatOptions::deserialize (cyclomatic 31) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · FileScanExecConf::serialize (cyclomatic 29) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · AggregateExecNode::serialize (cyclomatic 29) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · CsvScanExecNode::deserialize (cyclomatic 28) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · SymmetricHashJoinExecNode::deserialize (cyclomatic 28) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · AnalyzeExecNode::deserialize (cyclomatic 28) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · datafusion_spark::function::math::abs::spark_abs (cyclomatic 28) datafusion/spark/src/function/math/abs.rs
  • Cyclomatic Complexity · ListingTableScanNode::serialize (cyclomatic 27) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · Expr::get_type (cyclomatic 26) datafusion/expr/src/expr_schema.rs
  • Cyclomatic Complexity · AsOfJoinNode::deserialize (cyclomatic 25) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · PhysicalAggregateExprNode::deserialize (cyclomatic 25) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · HashJoinExecNode::serialize (cyclomatic 25) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · SortMergeJoinExecNode::deserialize (cyclomatic 25) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · ConversionSpecifier::format_float (cyclomatic 25) datafusion/spark/src/function/string/format_string.rs
  • Cyclomatic Complexity · FormatStringFunc::invoke_with_args (cyclomatic 24) datafusion/spark/src/function/string/format_string.rs
  • Cyclomatic Complexity · ViewTableScanNode::deserialize (cyclomatic 22) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · CustomTableScanNode::deserialize (cyclomatic 22) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · UnnestNode::deserialize (cyclomatic 22) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · AggregateUdfExprNode::deserialize (cyclomatic 22) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · PiecewiseMergeJoinExecNode::deserialize (cyclomatic 22) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · AsOfJoinExecNode::deserialize (cyclomatic 22) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · ParseUrl::parse (cyclomatic 22) datafusion/spark/src/function/url/parse_url.rs
  • Cyclomatic Complexity · JoinNode::serialize (cyclomatic 21) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · PhysicalFormatOptions::serialize (cyclomatic 21) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · datafusion_spark::function::url::url_decode::spark_handled_url_decode (cyclomatic 21) datafusion/spark/src/function/url/url_decode.rs
  • Cyclomatic Complexity · WindowExprNode::serialize (cyclomatic 20) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · PhysicalWindowExprNode::serialize (cyclomatic 20) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · ColumnStats::deserialize (cyclomatic 19) datafusion/proto-common/src/generated/pbjson.rs
  • Cyclomatic Complexity · PhysicalScalarUdfNode::deserialize (cyclomatic 19) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · FilterExecNode::deserialize (cyclomatic 19) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · ParquetScanExecNode::deserialize (cyclomatic 19) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · CsvScanExecNode::serialize (cyclomatic 19) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · MemoryScanExecNode::deserialize (cyclomatic 19) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · SymmetricHashJoinExecNode::serialize (cyclomatic 19) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · AnalyzeExecNode::serialize (cyclomatic 19) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · WindowAggExecNode::deserialize (cyclomatic 19) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · GenerateSeriesArgsTimestamp::deserialize (cyclomatic 19) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · GenerateSeriesNode::deserialize (cyclomatic 19) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · datafusion_spark::function::math::hex::compute_hex (cyclomatic 19) datafusion/spark/src/function/math/hex.rs
  • Cyclomatic Complexity · datafusion_physical_optimizer::limit_pushdown::pushdown_limit_helper_with_stats (cyclomatic 18) datafusion/physical-optimizer/src/limit_pushdown.rs
  • Cyclomatic Complexity · AsOfJoinNode::serialize (cyclomatic 17) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · PhysicalAggregateExprNode::serialize (cyclomatic 17) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · SortMergeJoinExecNode::serialize (cyclomatic 17) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · SparkSha2::invoke_with_args (cyclomatic 17) datafusion/spark/src/function/hash/sha2.rs
  • Cyclomatic Complexity · datafusion_expr::logical_plan::builder::project_with_validation (cyclomatic 16) datafusion/expr/src/logical_plan/builder.rs
  • Cyclomatic Complexity · Field::deserialize (cyclomatic 16) datafusion/proto-common/src/generated/pbjson.rs
  • Cyclomatic Complexity · ScalarTimestampValue::deserialize (cyclomatic 16) datafusion/proto-common/src/generated/pbjson.rs
  • Cyclomatic Complexity · CreateViewNode::deserialize (cyclomatic 16) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · AnalyzeNode::deserialize (cyclomatic 16) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · DmlNode::deserialize (cyclomatic 16) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · UnnestExecNode::deserialize (cyclomatic 16) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · PhysicalDynamicFilterNode::deserialize (cyclomatic 16) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · PhysicalBinaryExprNode::deserialize (cyclomatic 16) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · SortExecNode::deserialize (cyclomatic 16) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · NestedLoopJoinExecNode::deserialize (cyclomatic 16) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · GenerateSeriesArgsInt64::deserialize (cyclomatic 16) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · GenerateSeriesArgsDate::deserialize (cyclomatic 16) datafusion/proto-models/src/generated/pbjson.rs
  • Cyclomatic Complexity · ConversionSpecifier::format_decimal (cyclomatic 16) datafusion/spark/src/function/string/format_string.rs
  • Cyclomatic Complexity · datafusion_spark::function::string::encode::encode_string (cyclomatic 16) datafusion/spark/src/function/string/encode.rs
  • Cyclomatic Complexity · datafusion_cli::main_inner (cyclomatic 16) datafusion-cli/src/main.rs
  • Cognitive Complexity · ArrowType::deserialize (cognitive 127) datafusion/proto-common/src/generated/pbjson.rs
  • Cognitive Complexity · PhysicalPlanNode::deserialize (cognitive 124) datafusion/proto-models/src/generated/pbjson.rs
  • Cognitive Complexity · LogicalExprNode::deserialize (cognitive 109) datafusion/proto-models/src/generated/pbjson.rs
  • Cognitive Complexity · LogicalPlanNode::deserialize (cognitive 106) datafusion/proto-models/src/generated/pbjson.rs
  • Cognitive Complexity · PhysicalExprNode::deserialize (cognitive 88) datafusion/proto-models/src/generated/pbjson.rs
  • Cognitive Complexity · ConversionSpecifier::format_hex_float (cognitive 84) datafusion/spark/src/function/string/format_string.rs
  • Cognitive Complexity · LogicalPlanNode::try_into_logical_plan (cognitive 72) datafusion/proto/src/logical_plan/mod.rs
  • Cognitive Complexity · ListingTableScanNode::deserialize (cognitive 49) datafusion/proto-models/src/generated/pbjson.rs
  • Cognitive Complexity · CreateExternalTableNode::deserialize (cognitive 49) datafusion/proto-models/src/generated/pbjson.rs
  • Cognitive Complexity · ConversionSpecifier::format_float (cognitive 49) datafusion/spark/src/function/string/format_string.rs
  • Cognitive Complexity · FileScanExecConf::deserialize (cognitive 46) datafusion/proto-models/src/generated/pbjson.rs
  • Cognitive Complexity · AggregateExecNode::deserialize (cognitive 46) datafusion/proto-models/src/generated/pbjson.rs
  • Cognitive Complexity · ConversionSpecifier::format (cognitive 43) datafusion/spark/src/function/string/format_string.rs
  • Cognitive Complexity · HashJoinExecNode::deserialize (cognitive 40) datafusion/proto-models/src/generated/pbjson.rs
  • Cognitive Complexity · datafusion_expr::logical_plan::builder::project_with_validation (cognitive 39) datafusion/expr/src/logical_plan/builder.rs
  • Cognitive Complexity · datafusion_physical_optimizer::limit_pushdown::pushdown_limit_helper_with_stats (cognitive 38) datafusion/physical-optimizer/src/limit_pushdown.rs
  • Cognitive Complexity · datafusion_spark::function::map::str_to_map::str_to_map_impl (cognitive 38) datafusion/spark/src/function/map/str_to_map.rs
  • Cognitive Complexity · datafusion_spark::function::url::url_decode::spark_handled_url_decode (cognitive 37) datafusion/spark/src/function/url/url_decode.rs
  • Cognitive Complexity · datafusion_spark::function::math::round::spark_round (cognitive 36) datafusion/spark/src/function/math/round.rs
Rebuild cost: about €1,100,000 · Estimate
Cost to rebuild€350,000 to €1,800,000, for 5,903 to 18,727 hours of work, about 7.3 person-years for 4 to 14 engineers
Difficulty of the problemStandard, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor×0.8 at a score of 61. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
SizeVery large: 769,237 lines of product code
What it is notNot a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.

How the estimate is made: We price the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.

Top priorities

The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.

1
Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up.
Raises the score by about 8 points · Medium effort · Type Safety
2
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with main.rs.
Raises the score by about 2 points · Low effort · ADR Quality
3
Delete the dead files and unused exports — every line is maintenance cost and rebuild-estimate inflation with zero runtime value.
Raises the score by about 3 points · Medium effort · Dead Code

Diagnosis: what the measurements show together

Each conclusion below combines several dimensions into one point that no single dimension shows, and lists the measurements it rests on.

Where the investment is most exposed · Value at risk
This code would cost about €1,100,000 to build again, about 7.3 person-years of work. Its weakest lens is Code Health, at 51 (Adequate). Code Health is about how easy the code is to read and change safely, and code that is hard to read is slow and risky to change, so every future change costs more than it should. Because the weakest lens counts most in the score, work on Code Health also moves the score most.
Based on: the rebuild estimate · the Code Health grade · how much each lens counts
What to do: Start with the Code Health actions in Top priorities.
If you do one thing first · First action
Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up. Of all the actions in this report, it raises the score most for the work it takes: about 8 points for medium effort. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 7.1 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 2% to 5% on every change. The history of the code shows how much it changes: about 440,693 lines over the last 90 days, which is about 1,787,255 lines a year. At that pace, the extra work comes to an estimated 102.3 to 613.5 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of our own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.

Architecture — module dependency graph

Project dependencies, layered top-to-bottom; arrows show direction. Any dashed red edge points upward or sideways, which only happens where the projects form a dependency cycle. A graph without cycles 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-csv datafusion-datasource-csv datafusion->datafusion-datasource-csv 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-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-csv->datafusion-common datafusion-datasource-csv->datafusion-datasource datafusion-datasource-csv->datafusion-execution datafusion-datasource-csv->datafusion-expr datafusion-datasource-csv->datafusion-physical-expr-common datafusion-datasource-csv->datafusion-physical-plan datafusion-datasource-csv->datafusion-proto-models datafusion-datasource-csv->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-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-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-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-csv 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__ +26 more projects

Architecture: which parts of the code depend on which

The code is divided into modules, groups of code that each handle one part of the product, and a module depends on another when it uses code from it. The table lists the modules both down the side and across the top, in an order where each module should only use modules listed above it. A number in a cell means the module on that row uses the module in that column, and it counts the pairs of building blocks (types) that connect them. The one thing to look for is a mark above the diagonal line. It means two or more modules use each other in a loop (a dependency cycle), so none of them can be changed, tested or released on its own.

1004 modules, with 3499 dependencies between them. 18 loops run through 61 of the modules, marked above the diagonal.

The table shows the 40 modules with the most connections; 964 more are left out to keep it readable.

Which modules use which. The module on each row uses the module in each column, and the number counts the pairs of types that connect them. A cell above the diagonal is part of a loop.
uses →1 datafusion_common.config2 datafusion_common.join_type3 datafusion_common.scalar4 datafusion_common.table_reference5 datafusion_doc6 datafusion_execution.memory_pool7 datafusion_execution.stream8 datafusion_expr_common.accumulator9 datafusion_expr_common.groups_accumulator10 datafusion_expr_common.operator11 datafusion_expr_common.signature12 datafusion_physical_expr_common.metrics13 datafusion_physical_expr_common.physical_expr.proto_encode14 datafusion_common.dfschema15 datafusion_common.stats16 datafusion_expr.simplify17 datafusion_expr.udwf18 datafusion_expr_common.columnar_value19 datafusion_physical_expr_common.metrics.baseline20 datafusion_physical_expr_common.physical_expr21 datafusion_physical_expr_common.sort_expr22 datafusion_physical_plan.display23 datafusion_expr.logical_plan.plan24 datafusion_expr.udf25 datafusion_physical_expr.equivalence.properties26 datafusion_physical_plan.statistics27 datafusion_expr.expr28 datafusion_optimizer.optimizer29 datafusion_physical_plan.joins.utils30 datafusion_expr.udaf31 datafusion_execution.task32 datafusion.execution.session_state33 datafusion_physical_plan.proto34 datafusion.execution.context35 datafusion_physical_plan.projection36 datafusion_substrait.logical_plan.consumer.substrait_consumer37 datafusion_physical_plan.execution_plan38 datafusion_datasource.file_scan_config39 datafusion_physical_plan.aggregates40 datafusion_physical_plan.joins.hash_join.exec
1 datafusion_common.config
2 datafusion_common.join_type
3 datafusion_common.scalar
4 datafusion_common.table_reference
5 datafusion_doc
6 datafusion_execution.memory_pool
7 datafusion_execution.stream
8 datafusion_expr_common.accumulator
9 datafusion_expr_common.groups_accumulator
10 datafusion_expr_common.operator
11 datafusion_expr_common.signature
12 datafusion_physical_expr_common.metrics
13 datafusion_physical_expr_common.physical_expr.proto_encode
14 datafusion_common.dfschema2
15 datafusion_common.stats1
16 datafusion_expr.simplify21
17 datafusion_expr.udwf331
18 datafusion_expr_common.columnar_value1
19 datafusion_physical_expr_common.metrics.baseline5
20 datafusion_physical_expr_common.physical_expr1
21 datafusion_physical_expr_common.sort_expr2
22 datafusion_physical_plan.display1
23 datafusion_expr.logical_plan.plan331415
24 datafusion_expr.udf333313
25 datafusion_physical_expr.equivalence.properties3
26 datafusion_physical_plan.statistics12
27 datafusion_expr.expr1121215121
28 datafusion_optimizer.optimizer214
29 datafusion_physical_plan.joins.utils315211
30 datafusion_expr.udaf3333119
31 datafusion_execution.task111
32 datafusion.execution.session_state62134324321
33 datafusion_physical_plan.proto22222
34 datafusion.execution.context1111211123
35 datafusion_physical_plan.projection11121222126
36 datafusion_substrait.logical_plan.consumer.substrait_consumer23141
37 datafusion_physical_plan.execution_plan113222211
38 datafusion_datasource.file_scan_config1113221121
39 datafusion_physical_plan.aggregates11232212134
40 datafusion_physical_plan.joins.hash_join.exec24322241223
Uses a module listed above itPart of a loopThe module itself
1 datafusion_common.config2 datafusion_common.join_type3 datafusion_common.scalar4 datafusion_common.table_reference5 datafusion_doc6 datafusion_execution.memory_pool7 datafusion_execution.stream8 datafusion_expr_common.accumulator9 datafusion_expr_common.groups_accumulator10 datafusion_expr_common.operator11 datafusion_expr_common.signature12 datafusion_physical_expr_common.metrics13 datafusion_physical_expr_common.physical_expr.proto_encode14 datafusion_common.dfschema15 datafusion_common.stats16 datafusion_expr.simplify17 datafusion_expr.udwf18 datafusion_expr_common.columnar_value19 datafusion_physical_expr_common.metrics.baseline20 datafusion_physical_expr_common.physical_expr21 datafusion_physical_expr_common.sort_expr22 datafusion_physical_plan.display23 datafusion_expr.logical_plan.plan24 datafusion_expr.udf25 datafusion_physical_expr.equivalence.properties26 datafusion_physical_plan.statistics27 datafusion_expr.expr28 datafusion_optimizer.optimizer29 datafusion_physical_plan.joins.utils30 datafusion_expr.udaf31 datafusion_execution.task32 datafusion.execution.session_state33 datafusion_physical_plan.proto34 datafusion.execution.context35 datafusion_physical_plan.projection36 datafusion_substrait.logical_plan.consumer.substrait_consumer37 datafusion_physical_plan.execution_plan38 datafusion_datasource.file_scan_config39 datafusion_physical_plan.aggregates40 datafusion_physical_plan.joins.hash_join.execdatafusion_common.config1datafusion_common.join_type2datafusion_common.scalar3datafusion_common.table_reference4datafusion_doc5datafusion_execution.memory_pool6datafusion_execution.stream7datafusion_expr_common.accumulator8datafusion_expr_common.groups_accumulator9datafusion_expr_common.operator10datafusion_expr_common.signature11datafusion_physical_expr_common.metrics12datafusion_physical_expr_common.physical_expr.proto_encode13datafusion_common.dfschema14datafusion_common.stats15datafusion_expr.simplify16datafusion_expr.udwf17datafusion_expr_common.columnar_value18datafusion_physical_expr_common.metrics.baseline19datafusion_physical_expr_common.physical_expr20datafusion_physical_expr_common.sort_expr21datafusion_physical_plan.display22datafusion_expr.logical_plan.plan23datafusion_expr.udf24datafusion_physical_expr.equivalence.properties25datafusion_physical_plan.statistics26datafusion_expr.expr27datafusion_optimizer.optimizer28datafusion_physical_plan.joins.utils29datafusion_expr.udaf30datafusion_execution.task31datafusion.execution.session_state32datafusion_physical_plan.proto33datafusion.execution.context34datafusion_physical_plan.projection35datafusion_substrait.logical_plan.consumer.substrait_consumer36datafusion_physical_plan.execution_plan37datafusion_datasource.file_scan_config38datafusion_physical_plan.aggregates39datafusion_physical_plan.joins.hash_join.exec402121331151213314153333133121121215121214315211333311911162134324321222221111211123111212221262314111322221111132211211123221213424322241223+964 more modules (most-connected shown)

At a glance — Code Health · 51% · Adequate · gated by R1 ·

At a glance — Architecture · 95% · Exemplary ·

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

At a glance — Readiness · 65% · Adequate · gated by R4 ·

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

At a glance — Performance · 94% · 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
A05:2025 — Injection52High / Critical
A03:2025 — Software Supply Chain Failures9High / Critical
A02:2025 — Security Misconfiguration6High / Critical

Roadmap

Top priorities: Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up; Delete the dead files and unused exports — every line is maintenance cost and rebuild-estimate inflation with zero runtime value; Resolve the 1 No ADRs found finding(s) in ADR Quality — start with main.rs.

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

Do thisHelpsEffortDimension
Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up.+7.6 ptsMediumType Safety
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with main.rs.+2.3 ptsLowADR Quality
Delete the dead files and unused exports — every line is maintenance cost and rebuild-estimate inflation with zero runtime value.+3.4 ptsMediumDead Code
Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.+2.0 ptsMediumArchitecture documentation
Add tests that import the unreached modules (directly or through their public entry).+1.7 ptsMediumTest Coverage
Act on each finding's own remediation rather than one rule: the move depends on what recurs. Where the copies are executable blocks, give the shared part one home and call it from each site; where they are declarations, a listing, a specialisation already delegating to its base, or one shape repeated per entity, there is no call site and the move is a shared type, a generated set or a factory — sometimes there is nothing to extract.+1.3 ptsMediumCode Duplication
Resolve the 3 Orphaned knowledge finding(s) in Knowledge Freshness — start with utils.rs, macros.rs, arguments.rs.+0.6 ptsLowKnowledge Freshness
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.+1.2 ptsMediumDeployment & Rollback

File quality

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

FileScoreBandWorst signal
REDACTED0.7SlopStatic Analysis (SAST): High: REDACTED
REDACTED0.7SlopStatic Analysis (SAST): High: REDACTED
REDACTED4.1MixedIaC & Container Security: High IaC: REDACTED
REDACTED4.3MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.6MixedStatic Analysis (SAST): High: REDACTED
datafusion/datasource-csv/src/source.rs4.8MixedCognitive Complexity: CsvOpener::open (cognitive 23)
REDACTED5.1MixedStatic Analysis (SAST): High: REDACTED
datafusion/proto-common/src/from_proto/mod.rs5.5MixedCyclomatic Complexity: ScalarValue::try_from (cyclomatic 57)
datafusion/core/src/dataframe/mod.rs5.5MixedCognitive Complexity: DataFrame::describe (cognitive 28)
datafusion/functions-aggregate/src/array_agg.rs5.5MixedCognitive Complexity: DistinctArrayAggGroupsAccumulator::evaluate (cognitive 24)
datafusion/functions-aggregate/src/average.rs5.5MixedGod Classes: FileTooLong: src/average.rs
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/datasource-arrow/src/file_format.rs5.5MixedCode Duplication: Edited copies of one member (4 members, 19+ corresponding lines)
datafusion/proto-common/src/to_proto/mod.rs5.6MixedCyclomatic Complexity: ScalarValue::try_from (cyclomatic 64)
datafusion/sql/src/planner.rs5.6MixedCyclomatic Complexity: SqlToRel::convert_simple_data_type (cyclomatic 37)
datafusion/functions/src/datetime/date_trunc.rs5.6MixedCyclomatic Complexity: DateTruncFunc::invoke_with_args (cyclomatic 28)
datafusion/datasource-arrow/src/source.rs5.6MixedGod Classes: MethodTooLong: ArrowFileOpener.open
REDACTED5.8MixedStatic Analysis (SAST): High: REDACTED
REDACTED5.8MixedStatic Analysis (SAST): High: REDACTED

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 — 49

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 — 2437

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 — 83

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

Could not be resolved — 15

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

This survey 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. All 58 evaluated dimensions are computed by tools and static analysis; no language model sets or judges any of them. Overall confidence is 0.9, the weighted average across measured dimensions.

Every figure here is one of two 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. 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.

What we checked — 58 dimensions across the health lenses
D1D2D3D4D5D6D12D13D14D15D16D17D19D20D26D28D29D30D31D34D35D36D37D43D44AX10AX3AX4AX8AX9M1M2M3M4P1P10P2P3P4P6PF1PF3R1R10R2R3R4R5R6R7R8R9X1X21X27X28X29X30

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, 2531 of 2569 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 or a scanner, 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
Canine Code Analyzer 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

Every finding is locatable in findings.md. Run 01a1daf1-4b51-7612-80b3-3605953d2166.

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.

  • D8 Code Coverage — not measured this run — We 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 MEASURED: the Rust half could not be measured — the Cargo suite in repository root did not build, so it was never run. Coverage is excluded from the score rather than counted as a near-zero. This is OUR limitation, not a defect in the repo — a Codecov configuration (.github/codecov.yml) and a coverage step in CI (`codecov/codecov-action`) shows coverage is measured in your own CI.
  • D11 Test Reliability — not measured this run — We 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, 873 test files), but it was not re-run: its build outgrew the 6 GB scratch ceiling (6.071 GB measured) and was stopped; its suite was not run. 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 — We measured this, but not all of it. What we 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.
  • D19 Documentation Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we 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. Each ecosystem's manifests (what makes a folder runnable or a published package) need their own proof before D19 judges its units. Until then those folders' READMEs are judged only as documents (boilerplate, structure), never counted as complete.
  • D19 Documentation Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we 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 kind did not reach the 95 % precision gate in three adjudicated runs (docs/plans/deterministic-engine/adjudication/D19-sample3-v3.md), so by the pre-registered fallback it publishes no row until a re-measurement shows it does. The candidates are counted here, not reported as findings, and the score does not include them.
  • D21 Naming Consistency — not measured this run — We 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. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
  • D22 Internal API Consistency — not measured this run — We 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. D22's deterministic call-shape rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. This says nothing about whether that surface is consistent.
  • D24 Comment Value — not measured this run — We 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. Each source language's comment syntax, and the code a comment annotates in it, needs its own proof before D24 judges it. Until then those comments are left unread, not counted as clean.
  • D27 Navigability — not measured this run — We 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. Navigability is taken over call sites whose callee resolved. For C# that population includes calls into referenced assemblies; for this language only calls declared inside the repository count, so the abstention threshold reads the repository's use of its standard library as a resolution failure. That is a limit of this analyzer, not a build problem in this repository.
  • AX6 Interface segregation — not measured this run — We 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.
  • AXB2 Runtime readiness — not measured this run — We 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. `npm run` found no package.json in the folder where our sandbox ran it. This is a limit of our sandbox, not of your repository. (rule: no-root-manifest). The renderer reported: the dev server (`npm run start`) exited before it served a page. Likely cause (our sandbox): `npm run` found no package.json in the folder where our sandbox ran it. This is a limit of our sandbox, not of your repository. Last output: "npm error code ENOENT / npm error syscall open / npm error path <repo>/package.json / npm error errno -2 / npm error enoent Could not read package.json: Error: ENOENT: no such file or directory, open '<repo>/package.json' / npm error enoent This is related to npm not being able to find a file. / npm error enoent / npm error A complete log of this run can be found in: <path>" No runtime evidence was gathered.
  • AXR1 Runtime accessibility — not measured this run — We 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. Render strategy: boot via DevServer (start). the dev server (`npm run start`) exited before it served a page. Likely cause (our sandbox): `npm run` found no package.json in the folder where our sandbox ran it. This is a limit of our sandbox, not of your repository. Last output: "npm error code ENOENT / npm error syscall open / npm error path <repo>/package.json / npm error errno -2 / npm error enoent Could not read package.json: Error: ENOENT: no such file or directory, open '<repo>/package.json' / npm error enoent This is related to npm not being able to find a file. / npm error enoent / npm error A complete log of this run can be found in: <path>" No runtime evidence was gathered.
  • GD1 Unfinished & placeholder code — not measured this run — We 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 C# syntax, F#, JavaScript/TypeScript, Dart, Ruby and Scala source only, and this repository's Python, Rust is most of its product and is not read yet, 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.
  • IC1 Incompleteness & stubs — not measured this run — We 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 C# syntax, JavaScript/TypeScript, Java, Dart, Ruby and Scala source only, and this repository's Python, Rust is most of its product and is not read yet, 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.
  • M4 Documentation accuracy — measured, with a gap in what it reached — We measured this, but not all of it. What we 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. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9), and artefact counts an order of magnitude off. Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
  • X12 Unreachable branch — not measured this run — We 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 most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
  • X16 Unfloored truncation loop — not measured this run — We 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 most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
  • X3 Exception handling — not measured this run — We 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 most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
  • X5 Nullable reference types — not measured this run — We 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 C# syntax and MSBuild project configuration, TypeScript source and its tsconfig files, Java source and its package and module declarations, PHP source and its PHPStan and Psalm configuration, Dart source and its pubspec language version, Ruby source and its Sorbet and Steep configuration, Scala source and its build's explicit-nulls, WartRemover and Scalafix settings, and Kotlin source only, and no C# was loaded, no TypeScript was found, and this repository's Python, Rust is not read yet, 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.

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

We assess the repository exactly as committed, and only the repository. By design we do 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.
  • D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
  • 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 Secret Scanning: Secret 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 publishes two things only: a runnable or packaged unit with no example, and a multi-project root README that maps none of its parts. It does not judge clarity, and its other checks (overview, licence, boilerplate, structure, empty sections, XML-doc coverage) are withheld after adjudication: their candidates are counted in the card's gaps, not shown as rows. A false statement in a document is M4's; units are .NET projects only.
  • D20 ADR Quality: ADR quality checks the structure of the decision records present: it cannot know about decisions made and never recorded, and it does not judge how well a record argues its case. Records in a language the section lexicon does not cover are not evaluated.
  • 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: Documentation accuracy checks links, versions and artefact counts against the tree: other claims (paths, commands, settings, routes) are read but not checked, and it cannot run the onboarding or measure how long a real new joiner takes.
  • 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.

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

174 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was SqlToRel::sql_statement_to_plan_with_context_impl at 214. A further 88 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:8916
SqlToRel::sql_statement_to_plan_with_context_impl (cyclomatic 214) · ×9datafusion/sql/src/statement.rs:254
datafusion_optimizer::decorrelate_predicate_subquery::build_join (cyclomatic 46) · ×9datafusion/optimizer/src/decorrelate_predicate_subquery.rs:870
datafusion_substrait::logical_plan::consumer::expr::literal::from_substrait_literal (cyclomatic 96) · ×7datafusion/substrait/src/logical_plan/consumer/expr/literal.rs:56
datafusion_functions::datetime::date_bin::date_bin_impl (cyclomatic 37) · ×6datafusion/functions/src/datetime/date_bin.rs:630

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

What to do

  1. Bring the 5 bodies over 120 down to 120 or less in Cyclomatic Complexity — start with SqlToRel::sql_statement_to_plan_with_context_impl (cyclomatic 214), Simplifier::f_up (cyclomatic 180), ScalarValue::deserialize (cyclomatic 136). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 5 together lifts Cyclomatic Complexity from 5.2 to about 5.8/10, projected with the scoring formula itself and assuming each lands exactly at 120; a cleaner split scores higher.

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

D2 · Cognitive Complexity5.0 / 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 5.0 / 10 · rule-coverage 100% · ceiling Prevented

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

datafusion_physical_plan::windows::window_equivalence_properties (cognitive 102) · ×21datafusion/physical-plan/src/windows/mod.rs:372
datafusion_functions::regex::regexpcount::regexp_count_inner (cognitive 43) · ×19datafusion/functions/src/regex/regexpcount.rs:248
SqlToRel::sql_statement_to_plan_with_context_impl (cognitive 237) · ×17datafusion/sql/src/statement.rs:254
datafusion_optimizer::decorrelate_predicate_subquery::build_join (cognitive 60) · ×17datafusion/optimizer/src/decorrelate_predicate_subquery.rs:870
datafusion_functions_nested::string::compute_array_to_string (cognitive 47) · ×15datafusion/functions-nested/src/string.rs:579

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

What to do

  1. Bring the 7 bodies over 120 down to 120 or less in Cognitive Complexity — start with Unparser::select_to_sql_recursively (cognitive 270), SqlToRel::sql_statement_to_plan_with_context_impl (cognitive 237), SqlToRel::sql_function_to_expr (cognitive 191). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 7 together lifts Cognitive Complexity from 5.0 to about 5.8/10, projected with the scoring formula itself and assuming each lands exactly at 120; a cleaner split scores higher.

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

328 god class(es) detected.

FileTooLong: scalar/mod.rs · ×133datafusion/common/src/scalar/mod.rs
MethodTooLong: SqlToRel.sql_statement_to_plan_with_context_impl · ×87datafusion/sql/src/statement.rs:254
ClassTooLong: ScalarValue · ×40datafusion/common/src/scalar/mod.rs:393
FunctionTooLong: datafusion_physical_expr::planner::create_physical_expr · ×40datafusion/physical-expr/src/planner.rs:120
TooManyMethods: SqlToRel · ×21datafusion/sql/src/planner.rs:442

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

What to do

  1. Resolve the 133 FileTooLong finding(s) in God Classes — start with mod.rs (20), exec.rs (3), plan.rs (2). — One of this dimension's main actionable groups (133 warning-level).
  2. Resolve the 87 MethodTooLong finding(s) in God Classes — start with mod.rs (21), plan.rs (7), expr.rs (7). — One of this dimension's main actionable groups (87 warning-level).
  3. Resolve the 40 ClassTooLong finding(s) in God Classes — start with mod.rs (8), exec.rs (3), nested_loop_join.rs (2). — One of this dimension's main actionable groups (40 warning-level).

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

D4 · Code Duplication8.5 / 10Strong✓ Tool-verified

What it measures: How much of the production code is copy-pasted: the share of production lines inside a reported copy (every copy of a duplicated block or of an edited member, each line once), 10 at none and 0 at a quarter of the lines.

Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), scored on the share of production lines inside a reported copy (each line once; 10 at none, 0 at a quarter). Deterministic.

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

560 duplicated block group(s) detected. 3.6 % of the production lines (27,920 of 769,237) are in a reported copy. A further 485 rows report members as variants of one another; the share counts each copied line once, however many rows cite it. 21 of the 1045 are in trees this repository does not ship — vendored, example/demo, project-template, 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) · ×45datafusion/common/src/utils/mod.rs:151
Duplicated block (7 lines × 2) · ×44datafusion-cli/src/object_storage/instrumented.rs:174
Duplicated block (10 lines × 2) · ×42datafusion/common/src/dfschema.rs:754
Duplicated block (8 lines × 2) · ×41datafusion/common/src/hash_utils.rs:171
Duplicated block (11 lines × 2) · ×30datafusion/datasource/src/file_compression_type.rs:131

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

What to do

  1. Resolve the 45 Duplicated block (9 lines × 2) finding(s) in Code Duplication — start with mod.rs (5), logical_extension_codec.rs (3), higher_order_function.rs (2). — One of this dimension's main actionable groups (45 warning-level).
  2. Resolve the 44 Duplicated block (7 lines × 2) finding(s) in Code Duplication — start with logical_extension_codec.rs (6), dfschema.rs (2), mod.rs (2). — One of this dimension's main actionable groups (44 warning-level).
  3. Resolve the 42 Duplicated block (10 lines × 2) finding(s) in Code Duplication — start with mod.rs (4), display.rs (3), hash_utils.rs (2). — One of this dimension's main actionable groups (42 warning-level).

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

D5 · Coupling7.5 / 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.5 / 10 · rule-coverage 100% · ceiling Prevented

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

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

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

What to do

  1. Resolve the 2 Off the main sequence finding(s) in Coupling. — One of this dimension's main actionable groups (2 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).

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

D6 · Cohesion (LCOM4)9.6 / 10Stronggated by 28 serious findings✓ Tool-verified

What it measures: Whether a class's methods are focused on a single responsibility.

Method: LCOM4 cohesion per production class with at least two methods: connected components of methods sharing state or calls, computed syntactically. Deterministic, not a proxy.

Coverage: Exhaustive · type-level: LCOM4 cohesion computed over every production class — the population is all types, not a name convention.

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

28 of 862 classes have LCOM4 above 3.

Low cohesion: CsvSource (LCOM4 7) · ×28datafusion/datasource-csv/src/source.rs:86

What to do

  1. Resolve the 28 Low cohesion finding(s) in Cohesion (LCOM4) — start with mod.rs (3), source.rs, task.rs. — One of this dimension's main actionable groups (28 warning-level).

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

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

What it measures: Whether dependencies are current, not deprecated, and not bloated. Known vulnerabilities are D30's.

Method: Manifest scan via dotnet list package across all projects; worst-signal-per-package deduction (capped-linear for deprecation, prerelease and outdated) per KLoC. Known-vulnerable packages are D30's and are not charged here (rubric-2026.11.2). Exhaustive.

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

8 outdated, 0 yanked direct Cargo dependencies. 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: aws-config · ×8

✓ On the Gold path — maintain.

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

D13 · Secret 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

Secret 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 582 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.7 / 10Stronggated by 87 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.7 / 10 · rule-coverage 100% · ceiling Documented

Top hotspots: datafusion/sql/src/statement.rs (18×214=3852); datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs (19×180=3420); REDACTED (28×115=3220) Repeated repair below the complexity floor: datafusion/physical-plan/src/sorts/sort.rs (11 of 19 changes were fixes); datafusion/physical-plan/src/filter.rs (10 of 18 changes were fixes); datafusion/physical-plan/src/joins/sort_merge_join/bitwise_stream.rs (7 of 9 changes were fixes)

Hotspot: datafusion/sql/src/statement.rs · ×67datafusion/sql/src/statement.rs:254
Repeated repair: datafusion/physical-plan/src/sorts/sort.rs · ×20datafusion/physical-plan/src/sorts/sort.rs:1905

What to do

  1. Resolve the 67 Hotspot finding(s) in Churn × Complexity Hotspots — start with mod.rs (7), from_proto.rs (3), plan.rs (2). — One of this dimension's main actionable groups (67 warning-level).
  2. Resolve the 20 Repeated repair finding(s) in Churn × Complexity Hotspots — start with sort.rs, filter.rs, bitwise_stream.rs. — One of this dimension's main actionable groups (20 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

37 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is datafusion/physical-plan/src/joins/logical_batch.rs. Counted over 995 of the 1160 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 331 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

401 deducted task-comment markers across 769237 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 · ×312test-utils/src/array_gen/primitive.rs:26
FixmeComment · ×8datafusion/substrait/src/physical_plan/producer.rs:71
HackComment · ×8datafusion/sqllogictest/src/engines/postgres_engine/mod.rs:160
TodoComment repeated across 10 filesdatafusion/substrait/tests/cases/roundtrip_logical_plan.rs:93
TodoComment repeated across 11 filesdatafusion/sql/src/utils.rs:753

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

What to do

  1. Resolve the 312 TodoComment finding(s) in Explicit Debt — start with mod.rs (25), enforce_sorting.rs (11), statistics.rs (10). — One of this dimension's main actionable groups (312 warning-level).
  2. Resolve the 8 FixmeComment finding(s) in Explicit Debt — start with producer.rs (3), sql_integration.rs (3), value.rs. — One of this dimension's main actionable groups (8 warning-level).
  3. Resolve the 8 HackComment finding(s) in Explicit Debt — start with nested_loop_join.rs (3), mod.rs (2), clustered_final_stream.rs. — One of this dimension's main actionable groups (8 warning-level).

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

D19 · Documentation Quality10.0 / 10Exemplary○ Nothing flagged

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

Method: Every README, docs/ document and root guide parsed by its markup and measured in Unicode letters. Published: a runnable or packaged .NET project whose README (or a document it links, or a root guide) shows no example, and a root README naming none of three or more projects. Overview, licence, boilerplate, wall-of-text, empty-section and XML-doc rows are measured and withheld (counted in gaps) after adjudication. Deterministic, exhaustive, advisory.

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

1 of 1 documentation facets pass in full. 146 document(s) read across 2 unit(s).

✓ On the Gold path — maintain.

Detailed fixes: d19_recommendation.md.

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

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

Method: Every ADR read by its section structure: nine located rules (a missing Decision, Context or Consequences section, a stale status, two records deciding the same question, a dangling supersede link, a number-only title, a single option, no named cost, no status where the log uses one, no enforcement field where the log adopted one), each a fixed deduction from 10; the score is the mean over evaluated records. Deterministic, no model. Advisory.

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

No architecture decision records were found.

No ADRs founddatafusion-cli/src/main.rs:1

What to do

  1. Resolve the 1 No ADRs found finding(s) in ADR Quality — start with main.rs. — 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.

D26 · Project Cohesion7.4 / 10Strong✓ 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.

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

6 of 47 build units (Cargo, Python, npm) 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)10.0 / 10Exemplary○ Nothing flagged

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

Method: Secret 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 10.0 / 10 · rule-coverage 100% · ceiling Documented

gitleaks scanned the full history AND the current working tree and found no secrets.

✓ On the Gold path — maintain.

Detailed fixes: d28_recommendation.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

52 finding(s): 0 critical, 44 high, 5 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 11 file(s) — `ci/scripts/changed_crates.sh` (line 27, line 56, line 76), `datafusion/common/src/error.rs` (line 962), `datafusion/common/src/tree_node.rs` (line 2444, line 2446), `datafusion/core/src/execution/session_state.rs` (line 1705, lines 1705–1731, lines 1732–1733), `datafusion/datasource-parquet/src/opener/mod.rs` (lines 615–618, line 619, line 639, …), … (+6 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

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

What to do

  1. Resolve the 20 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (18), REDACTED (2). — One of this dimension's main actionable groups (20 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.6 / 10Adequategated by 1 critical finding✓ 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 (and Scala, whose sbt build's pinned direct declarations are written into a CycloneDX SBOM the scanner reads, with rows attributed back to the build file), 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. Advisory since rubric-2026.11.2 (CAI decision 0006): every row is a match against a vulnerability database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.

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

5 finding(s): 0 critical, 1 high, 4 medium, 0 low.

REDACTED
REDACTED
REDACTED
REDACTED

What to do

  1. Resolve the 1 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
  2. Resolve the 2 Medium advisory (unmaintained) finding(s) in Dependency Vulnerabilities — start with REDACTED (2). — One of this dimension's main actionable groups (2 warning-level).
  3. Resolve the 1 Medium vulnerability finding(s) in Dependency Vulnerabilities — start with REDACTED. — One of this dimension's main actionable groups (1 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.6 / 10Adequategated by 3 critical findings✓ 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.6 / 10 · rule-coverage 100% · ceiling Documented

39 of 995 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is datafusion/datasource-json/src/utils.rs. Counted over 995 of the 1160 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

Orphaned knowledge · ×3datafusion/datasource-json/src/utils.rs:1
Orphaned file · ×36dev/create_license.py:1
Further orphaned files (smaller)

What to do

  1. Resolve the 3 Orphaned knowledge finding(s) in Knowledge Freshness — start with utils.rs, macros.rs, arguments.rs. — One of this dimension's main actionable groups (3 issue-level).
  2. Resolve the 36 Orphaned file finding(s) in Knowledge Freshness — start with tree_node.rs (2), create_license.py, object_store.rs. — One of this dimension's main actionable groups (36 recommendation-level).
  3. Resolve the 1 Further orphaned files (smaller) finding(s) in Knowledge Freshness. — One of this dimension's main actionable groups (1 recommendation-level).

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

D35 · Change Coupling9.5 / 10Stronggated by 25 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: ltrim.rs↔rtrim.rs 100%; btrim.rs↔rtrim.rs 100%; btrim.rs↔ltrim.rs 100%

Change coupling: file_format.rs ↔ from_proto.rs · ×21datafusion/datasource-parquet/src/file_format.rs:1
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 21 Change coupling finding(s) in Change Coupling — start with mod.rs (3), avro.rs (2), csv.rs (2). — One of this dimension's main actionable groups (21 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.

D37 · Vulnerability-disclosure Policy10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether the repository publishes a coordinated-vulnerability-disclosure policy (SECURITY.md or security.txt) with a reporting contact, so finders know how to report a vulnerability. Presence of a policy file with a contact, not whether the policy is adequate or honoured.

Method: Vulnerability-disclosure policy read deterministically from the repo: a SECURITY.md (root/.github/docs) or .well-known/security.txt / security.txt, regex-checked for a reporting contact (email / URL / mailto). Present + contact → 10; present without a contact → 4; NotApplicable when no policy file exists (it may live off-repo). Detects the policy file's presence + contact, not its adequacy.

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

A vulnerability-disclosure policy (SECURITY.md) is published with a reporting contact.

✓ On the Gold path — maintain.

Detailed fixes: d37_recommendation.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. Reported 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. Advisory since rubric-2026.11.2 (CAI decision 0006): the malicious-package feed is a database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.

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 11 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.

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.9 / 10Strong✓ Tool-verified

Maturity · Maturity — Whether the repository and its projects have a README, and whether it is substantive.

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.
  • Explain in the README how to run the tests. Add a section called Testing to the README in the repository's top folder, saying how to run the test suite.
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 your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
M3 · Folder & project structure10.0 / 10Exemplary✓ Tool-verified

Maturity · Maturity — Whether the repository is organised deliberately: production code and tests are set apart in a way its ecosystem or the repository itself declares.

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

M4 · Documentation accuracy10.0 / 10Exemplary○ Nothing flagged

Maturity · Maturity — Whether the project's current-state documentation describes the code that exists.

Method: Every current-state document's checkable claims looked up in the tree (links, versions, and artefact counts an order of magnitude off), plus two README checks: an advertised infrastructure product with no footprint, and a module the CHANGELOG records as removed. Deterministic, no model. Advisory.

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.

P10 · Library API & versioning10.0 / 10Exemplary✓ Tool-verified

Readiness · Readiness — For a library: a deliberate (small) public API surface and explicit semantic versioning so consumers can depend on it safely.

Method: Roslyn scan: public API surface area and semantic-versioning markers (SemVer attributes, changelog entries) for libraries; off .NET, a library is the ecosystem's publication act (an npm package that is not private and names an entry point, a PyPI distribution with a build system, a Rust library crate, a Maven/Gradle module that publishes, a Go module with no package main, a gemspec, a Composer library, a SwiftPM library product, a pub.dev or Hex package), its surface is the share of types the language's code model records as public (Rust, Swift, Java, Kotlin, Go, Dart; not measured where the model records no type visibility or, as in TypeScript, only module-level export), and its version is read from the manifest, a semver CHANGELOG, release tooling or semver git tags. Exhaustive, deterministic.

  • 1 public type in `datafusion_expr.async_udf` is marked as implementation by its own namespace, folder or name: `AsyncScalarUDFImpl` (datafusion/expr/src/async_udf.rs:24, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — datafusion/expr/src/async_udf.rs:24
  • 1 public type in `datafusion_expr.higher_order_function` is marked as implementation by its own namespace, folder or name: `HigherOrderUDFImpl` (datafusion/expr/src/higher_order_function.rs:510, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — datafusion/expr/src/higher_order_function.rs:510
  • 1 public type in `datafusion_expr.udaf` is marked as implementation by its own namespace, folder or name: `AggregateUDFImpl` (datafusion/expr/src/udaf.rs:451, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — datafusion/expr/src/udaf.rs:451
  • 1 public type in `datafusion_expr.udf` is marked as implementation by its own namespace, folder or name: `ScalarUDFImpl` (datafusion/expr/src/udf.rs:522, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — datafusion/expr/src/udf.rs:522
  • 1 public type in `datafusion_expr.udwf` is marked as implementation by its own namespace, folder or name: `WindowUDFImpl` (datafusion/expr/src/udwf.rs:302, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — datafusion/expr/src/udwf.rs:302
  • 1 public type in `datafusion_session.table` is marked as implementation by its own namespace, folder or name: `TableFunctionImpl` (datafusion/session/src/table.rs:758, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — datafusion/session/src/table.rs:758

What to do

  • Hide `datafusion_expr.async_udf` (`AsyncScalarUDFImpl`) (Rust: `pub(crate)`, or keep the module private): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
  • Hide `datafusion_expr.higher_order_function` (`HigherOrderUDFImpl`) (Rust: `pub(crate)`, or keep the module private): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
  • Hide `datafusion_expr.udaf` (`AggregateUDFImpl`) (Rust: `pub(crate)`, or keep the module private): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
  • Hide `datafusion_expr.udf` (`ScalarUDFImpl`) (Rust: `pub(crate)`, or keep the module private): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
  • Hide `datafusion_expr.udwf` (`WindowUDFImpl`) (Rust: `pub(crate)`, or keep the module private): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
  • Hide `datafusion_session.table` (`TableFunctionImpl`) (Rust: `pub(crate)`, or keep the module private): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
P2 · Observability8.4 / 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/26 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`, `xtask`.

What to do

  • Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.
P3 · Security & performance tooling9.0 / 10Exemplary✓ 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.

  • `REDACTED` schedules updates, but no `package-ecosystem` entry covers `gitsubmodule`, which this tree depends on — so those dependencies get no update pull requests and no advisory pressure, however complete the dep-scan credit looks. Add the missing entry to the `updates:` list. — REDACTED:6

What to do

  • Dependabot is configured but does not watch `gitsubmodule` — add that `package-ecosystem` entry 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.

  • The release is automated and no gate that pauses it for a human is DECLARED IN THIS REPOSITORY'S PIPELINE FILES. What was read: every file under `.github/workflows/`, `.forgejo/workflows/`, `.gitea/workflows/`, `.azuredevops/` and `.azure-pipelines/`, plus `.gitlab-ci*` and `azure-pipelines*` — with comment text stripped, so documenting a gate is not declaring one. What would have counted: GitLab's `when: manual`, CircleCI's `type: approval`, an Azure `ManualValidation@` task or an `approvals:` block, a Jenkins `input` step, a `uses:` step naming an approval action, an `environment:` paired with `reviewers` / `required_reviewers` / `protection` / `wait-timer` / `deployment_branch_policy`, a draft-release step, a `workflow_dispatch` promotion, or a release-event gate. ★ What this cannot see, because none of it is a file: a GitHub environment whose required reviewers are configured in repo SETTINGS, a branch protection rule, or an organisation deployment policy — all of them real, enforced gates that live outside the repository. If yours is one of those, this row is wrong and nothing in the tree could have told us. Otherwise: whatever the release trigger points at is published to users unreviewed, so a mistagged or unverified commit ships and the only remedy is a follow-up release.

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.

  • `.github/workflows/dependencies.yml:40` 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. — .github/workflows/dependencies.yml:40
  • `REDACTED:58` 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:58

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.
PF1 · Benchmark discipline9.0 / 10Exemplary✓ Tool-verified

Readiness · Performance — Whether the code protects its performance with benchmarks — a benchmark suite, allocation/memory measurement, and (ideally) a CI gate. Presence is credited as a bonus, never a deduction.

Method: Repo + source scan: BenchmarkDotNet referenced (csproj/source), [Benchmark]/[MemoryDiagnoser] attribute counts, and a benchmark step in CI; off .NET, the same ladder over Go testing.B, Rust criterion/#[bench]/divan, JMH/kotlinx-benchmark, pytest-benchmark/asv/pyperf, tinybench/mitata/vitest bench/benchmark.js and Swift package-benchmark — scored as a bonus ladder (absence is neutral, never a deduction). Deterministic, presence detection.

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 each language's code model, a blocking call inside an async function (Python, TS/JS, Rust, Kotlin, Swift, Dart) or inside a Java method returning a Reactor Mono/Flux or a Scala method returning a Future or effect — and, for a .NET library with ≥5 awaits, the share of awaits using ConfigureAwait(false). Deterministic, syntax/text detection.

R1 · Type Safety0.0 / 10Critical✓ Tool-verified

React / JS · Code Health — How much of the frontend is typed TypeScript vs untyped JavaScript.

Method: Frontend file inventory: the share of typed TypeScript vs untyped JavaScript across the source tree. Deterministic, exhaustive over frontend files.

  • 0 typed · 6 plain JS — the untyped files are ci/scripts/cancel_merge_queue_runs.cjs, ci/scripts/draft_inactive_prs.cjs, ci/scripts/release_version_labeler.js, ci/scripts/test_cancel_merge_queue_runs.cjs, REDACTED, datafusion/wasmtest/datafusion-wasm-app/index.js.

What to do

  • Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up.
R10 · Code Duplication7.0 / 10Adequate✓ Tool-verified

React / JS · Code Health — The share of the scored frontend lines inside a near-exact copy-pasted block of substantial extent (the D4 clone algorithm over JS/TS tokens, D-386; each line once, 10 at none and 0 at a quarter of the lines, as D4): a block is reported only where its copies still agree on most of their own identifiers and literals, or were renamed as they were pasted but kept most of their constants, and where the copies carry enough code to stand on their own or the copied extent reaches 30 lines — so a re-implementation sharing neither names nor values, and a small pasted declaration, are both found and deliberately not reported, and a clean R10 is not a claim that nothing was copied.

Method: Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm run over JS/TS tokens). Masking finds the candidates; a block is reported when its copies still agree on most of their own identifiers and literals, or when a renamed copy still agrees on most of its constants, AND the copies carry enough code to stand on their own — or when the copied extent reaches 30 lines. So a re-implementation sharing neither names nor values, and a small pasted declaration, are deliberately not counted. Scored on the share of the scored frontend lines inside a reported copy, on the same curve as D4. Deterministic.

  • REDACTED:152 · REDACTED:263 — the two spans are one implementation copied and then locally edited — 192 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — REDACTED:152
  • ci/scripts/test_cancel_merge_queue_runs.cjs:285 · ci/scripts/test_cancel_merge_queue_runs.cjs:300 — 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. — ci/scripts/test_cancel_merge_queue_runs.cjs:285
  • ci/scripts/test_cancel_merge_queue_runs.cjs:306 · ci/scripts/test_cancel_merge_queue_runs.cjs:430 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — ci/scripts/test_cancel_merge_queue_runs.cjs:306
  • ci/scripts/test_cancel_merge_queue_runs.cjs:160 · ci/scripts/test_cancel_merge_queue_runs.cjs:184 — 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. — ci/scripts/test_cancel_merge_queue_runs.cjs:160

What to do

  • Act on each finding's own remediation rather than one rule: the move depends on what recurs. Where the copies are executable blocks, give the shared part one home and call it from each site; where they are declarations, a listing, a specialisation already delegating to its base, or one shape repeated per entity, there is no call site and the move is a shared type, a generated set or a factory — sometimes there is nothing to extract.
R2 · Cyclomatic Complexity7.9 / 10Strong✓ Tool-verified

React / JS · Code Health — Per-function cyclomatic/cognitive complexity from the token-level function scanner (D-386) — real branching, not a regex heuristic.

Method: Per-function cyclomatic/cognitive complexity from a token-level function scanner (real branching, not a regex heuristic), computed over every frontend function. Deterministic.

  • run has cyclomatic complexity 25 and cognitive complexity 44; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — ci/scripts/cancel_merge_queue_runs.cjs:86
  • run has cyclomatic complexity 11 and cognitive complexity 18; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — ci/scripts/draft_inactive_prs.cjs:102
R3 · Large Files10.0 / 10Exemplary✓ Tool-verified

React / JS · Code Health — How many source files exceed the large-file threshold.

Method: Components/modules exceeding the large-file threshold, counted exhaustively across the frontend source tree. Deterministic.

R4 · Test Coverage2.5 / 10Weak✓ Tool-verified

React / JS · Readiness — Static test reachability (D-386): the share of production files reachable from any test via the import graph — measured without running anything.

Method: Static test reachability: the share of production files reachable from any test via the import graph — measured without running anything. Deterministic.

  • No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one. (×3) — ci/scripts/draft_inactive_prs.cjs:1, ci/scripts/release_version_labeler.js:1, datafusion/wasmtest/datafusion-wasm-app/index.js:1

What to do

  • Add tests that import the unreached modules (directly or through their public entry).
R5 · Dependency Freshness10.0 / 10Exemplary✓ Tool-verified

React / JS · Readiness — How outdated the npm dependencies are (a maturity signal). JS/npm CVEs are scored separately in D30 (JS/npm Dependency Vulnerabilities).

Method: npm dependency staleness from manifest/registry metadata (a maturity signal; JS/npm CVEs are scored separately in D30, which answers dependency vulnerabilities for every ecosystem). Deterministic.

R6 · Tooling10.0 / 10Exemplary✓ Tool-verified

React / JS · Readiness — Whether the project wires up test, lint and typecheck — detected from each package.json script's COMMAND (eslint / tsc / vitest / jest / playwright), not just its name, and corroborated against CI-workflow invocations so a tool run only in CI still counts.

Method: package.json scanned for test/lint/typecheck script wiring. Deterministic presence check.

R7 · Dead Code4.8 / 10Weak✓ Tool-verified

React / JS · Code Health — Files unreachable from every application/tooling/test entry point, and exports nothing imports (module-graph reachability, D-386).

Method: Dead code: files unreachable from every application/tooling/test entry point plus exports nothing imports, via module-graph reachability. Deterministic, exhaustive over the import graph.

  • Unreachable from the 4 application, 3 tooling and 2 test entry point(s) detected in this repo. Gate removals on `npm run build` — an undetected custom entry would make these reachable.
  • no import path from any entry point (4 application, 3 tooling, 2 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make — ci/scripts/draft_inactive_prs.cjs

What to do

  • Delete the dead files and unused exports — every line is maintenance cost and rebuild-estimate inflation with zero runtime value.
R8 · Dependency Hygiene10.0 / 10Exemplary✓ Tool-verified

React / JS · Readiness — npm dependency truthfulness (D-386): unused dependencies, imports not declared anywhere, and type-/test-only packages shipped as production deps.

Method: npm dependency truthfulness: unused dependencies, imports declared nowhere, and type-/test-only packages shipped as production deps — from the manifest + import graph. Deterministic.

R9 · Circular Imports10.0 / 10Exemplary✓ Tool-verified

React / JS · Architecture — Import cycles in the module graph (D-386) — files that can only be understood and changed together.

Method: Import cycles in the module graph, detected exhaustively over JS/TS imports (the same cycle detection as the .NET coupling dimension). Deterministic.

X1 · Async correctness10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether the code avoids sync-over-async (deadlock-prone blocking on tasks) and async void.

Method: Roslyn syntax scan: async methods scanned for .Wait()/.GetAwaiter().GetResult() and async-void outside event handlers. Deterministic, hard fact per invocation.

X21 · Side-effecting pattern guard10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a `when` guard is free of side effects — a guard that increments a counter or assigns while deciding whether its arm matches applies that change during PATTERN MATCHING, on an arm that may not be selected, and skips it entirely when a short-circuit to its left answers first.

Method: Roslyn syntax: `when` guards on case labels and switch-expression arms, read for a mutation (`++`/`--`/assignment) sitting in a position the guard's own `&&`/`||`/`??`/`?:`/`?.` can skip. Deterministic, provable per finding. Advisory.

X27 · Collection changed while being enumerated10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a `for` loop leaves the `RefCell` it is walking alone — safe Rust rejects a body that changes the collection its loop borrows at compile time, except through interior mutability: a `RefCell` borrowed in the loop's header stays borrowed until the loop ends, so a `borrow_mut()` of it inside the body panics with `already borrowed: BorrowMutError` and the remaining elements are never seen. Whether a `for` loop leaves the `dict`, `set` or `deque` it is walking alone — CPython's iterators over those check that the collection has not changed size since the loop began, so a body that removes from (or empties) the very collection the loop is walking makes the next step raise `RuntimeError: dictionary changed size during iteration` and the remaining items are never seen.

Method: Roslyn syntax + semantics: `foreach` statements whose body calls a structural mutator (`Add`/`Remove`/`Clear`/`Insert`/…) on the very expression the loop is enumerating. Two arms. ARM A — the source is a concrete fragile BCL collection, or a live `Keys`/`Values` view over one, and the mutator resolves to that same collection's own member; concurrent and immutable collections and arrays are outside the population by construction, since their enumerators survive a structural change. ARM B — the source is an argument-less accessor CALL on a receiver whose body is in source: the accessor must return a stored field VERBATIM and a sibling member must structurally change that same field, both read off the implementations rather than from the members' names. A mutation the loop provably exits immediately after (`break`/`return`/`throw`/`goto`), or one written inside a nested loop or a lambda, is counted and never reported. Deterministic, provable per finding. Advisory.

X28 · Index access outside its own emptiness guard10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a condition that tests a value for emptiness indexes that same value only where the test holds — an `||` written one parenthesis too far to the left leaves an index access outside the guard beside it, so the empty case the guard exists to anticipate reaches the index and throws.

Method: Roslyn syntax only, no semantic model: the OUTERMOST `&&`/`||` of every boolean condition, read for a symbol the condition tests for emptiness (`string.IsNullOrEmpty`/`IsNullOrWhiteSpace`, a `Length`/`Count` comparison against a literal, `Any()`, a `Length`/`Count` pattern, or a comparison against `""`) and ALSO indexes. Each `symbol[...]` access is placed by a boolean-reachability walk from the access up to the outermost connective: an access is COVERED when some enclosing step has it in the right operand and the left operand, under the truth value that step forces, proves the symbol non-empty — a recursion over `&&`/`||` whose true- and false-directions are asymmetric. A finding needs BOTH an uncovered access and a covered one on the same symbol in the same condition, which is the agreeing twin that separates a misplaced parenthesis from an unrelated length test. Bare index accesses with no emptiness test in the condition are neither counted nor reported; a non-identifier receiver and a lambda nested inside the condition are outside the population. Deterministic, provable per finding. Advisory.

X29 · Per-element action decided by a fixed element10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a decision taken once per element is taken ABOUT that element — a test inside a counted loop that reads a fixed subscript of the very collection its guarded statement indexes by the loop variable applies element zero's answer to all of them, so the elements that differ from it are all handled wrongly, and in the same direction.

Method: Roslyn syntax only, no semantic model: every `for` statement declaring exactly ONE loop variable, and every `if` inside its body that is not under a nested loop or a lambda. A site enters the population when the `if`’s condition never mentions the loop variable while the statement it guards indexes some collection by that variable ALONE (`c[i]`; `c[i + 1]` and `c[i, j]` are outside it). A finding additionally needs the AGREEING TWIN at the same-collection grain: the condition must read THAT SAME collection at a subscript that does not move — written into the condition, or reached through a local declared BEFORE the loop, so an alias bound inside the body is not followed. Both collection expressions must be simple identifiers. On a repository with no .NET source the same rule reads JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `for (let|var|const x = …; …; …)` with one declarator and a braced body, an alias followed only when it is declared before the loop in a block that encloses it and never assigned inside the loop. Deterministic, provable per finding. Advisory.

X30 · Support guard that admits what it rejects10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a guard written as a NEGATED `||` says what its author meant — `!(a || b || x != k)` is `!a && !b && x == k` by De Morgan, so a bail-out that mixes capabilities the code needs with a fault it refuses turns inside out: it fires only where the capabilities are ABSENT, and lets every value the fault term names walk straight into the body that cannot handle it.

Method: Roslyn syntax only, no semantic model: every logical-not whose operand is a parenthesised `||` chain of two or more disjuncts, flattened (a left-nested `a || b || c` read once would see `(a || b)` as one disjunct). A site enters the population on that shape alone. A finding additionally needs the disjuncts to DISAGREE in polarity: at least one bare boolean read — an identifier or member access, never an invocation, which is a predicate rather than a capability flag — and at least one `x != <constant>`, the only form that negates into an exact-value pin (`== null` negates into a looser requirement and is outside the fault set). Consistently-polarised disjunctions, all-fault or all-capability, are counted and never reported; a negated `&&` is outside the population entirely. No same-receiver gate: it was measured to cost a real defect and remove no false positive. Deterministic, provable per finding. Advisory.

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 Health51%Adequate — gated by R1Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture95%ExemplaryStrongest area.
Maturity68%Adequate — gated by M2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Readiness65%Adequate — gated by R4Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Security70%Adequate — gated by D29, D36Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Performance94%ExemplarySolid.
Unscored — 3 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.
  • X10 Duplicated predicate — 10 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X7 Silent fallback defaults — 1 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 1 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.

  • P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 67 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.
  • AX1 Captive dependencies — Not applicable: this repository's JavaScript imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's; this repository's Python imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's; Rust with no dependency-injection crate has no container to hand one lifetime's instance to another — every value is owned by the code that builds it, and the borrow checker rejects a longer-lived value keeping a borrow of a shorter-lived one.
  • AX2 Stateful singletons — No container singleton was found, so there is no shared instance for concurrent requests to race on. No function in this Python code is served by a threaded web framework (a Flask, Bottle or FastAPI route, a Django or Pyramid view), so no module is shared between request threads. Rust's compiler refuses unsynchronised shared mutation — a value shared across threads must be Sync — so the race this check looks for cannot be written. TypeScript/JavaScript runs each process's requests on one event loop, so no two requests write a shared object at the same instant (interleaving across an await is a different defect).
  • 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 — the dev server (`npm run start`) exited before it served a page. Likely cause (our sandbox): `npm run` found no package.json in the folder where our sandbox ran it. This is a limit of our sandbox, not of your repository. Last output: "npm error code ENOENT / npm error syscall open / npm error path <repo>/package.json / npm error errno -2 / npm error enoent Could not read package.json: Error: ENOENT: no such file or directory, open '<repo>/package.json' / npm error enoent This is related to npm not being able to find a file. / npm error enoent / npm error A complete log of this run can be found in: <path>" No runtime evidence was gathered. 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 — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no data at rest for these controls to protect.
  • C2 Access Controls — No access-control surface detected in the analyzed source — this repository starts no server another machine can reach (no actix-web HttpServer, axum::serve, Rocket launch, warp::serve, poem or salvo Server, tonic Server::builder, hyper or tiny_http server outside examples and tests, none bound beyond loopback). Access control is therefore N/A here — a crate is authorized by the application that serves it, not by itself. If this codebase grows request handlers, the dimension reactivates and a default-deny posture is expected then.
  • C3 Audit Trail — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no sensitive data whose changes an audit trail would record. If it does (through a store configured outside this repository, for instance), the trail belongs to wherever that data is stored.
  • C4 Data Retention — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no personal data whose lifetime a retention limit would bound.
  • C5 Data-Subject Rights — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no personal data for a data subject to erase, export or consent over.
  • D10 Test Quality — ~199765 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.
  • D21 Naming Consistency — D21 withholds its sibling role token rows: 6 candidate(s) found and not reported.
  • D22 Internal API Consistency — API consistency is measured on C# only; the exposed Rust surface was not measured.
  • D23 Boundary Type-Coupling — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ sibling projects each declaring an entity of their own or taking another project's integration events. Aggregate roots were found in only one source directory (physical-plan), which is a layered codebase, not two contexts. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
  • D24 Comment Value — D24 reads C#, Visual Basic, TypeScript and JavaScript comments only; comments in this repository's .py, .rs source were not judged.
  • D25 ADR Conformance — no ADRs to check
  • D27 Navigability — D27 counts a call into the standard library or a dependency as unresolved for this repository's language (.rs), so too few call sites counted as resolved to assess navigability. Not scored: this is a gap in the analyzer, not a verdict about this repository.
  • 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.
  • 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.
  • 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 measured — Rust suite
  • 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); 335 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 — no mutating command handlers or message consumers detected — idempotency check not applicable
  • 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#, F#, JavaScript/TypeScript, Dart, Ruby and Scala, and none was read for this repository's product. 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
  • 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 — coverage not measured: this check compares the coverage of the analyzer's own test run across the domain and web layers, and that run measured none here — Test coverage (D8) says why
  • PF2 Allocation hygiene — Not scored: this check counted allocation-aware idioms (Span, pools, stackalloc) per line, which describes what kind of code a repository is rather than whether it has an allocation problem, so it was withdrawn. Nothing here is a finding about your code.
  • R11 Import Boundaries — No recognizable feature-sliced/layered src layout — boundary rules not applicable.
  • S1 Web-Security Posture — No web surface: 1085 Rust file(s) were read for weak hashes and ciphers, key material fixed in the source, disabled TLS certificate validation and obsolete TLS versions, and none was found. This repository serves no HTTP of its own — no HTTP-server crate (actix-web, axum, Rocket, warp, poem, tide, salvo, tonic, a hyper server, …) among its Cargo manifests' run-time dependencies, and no server started in its production source — so HTTPS enforcement, HSTS, cookie flags and input validation are N/A here, as they are for a C# library or worker. If this codebase starts serving HTTP, the dimension reactivates automatically.
  • SC1 Supply-chain hygiene — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • X12 Unreachable branch — X12 reached only 0% of this repository's production lines — rust (767,277 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • X13 Undrained process stream — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X14 Bypassable address classification — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X15 Unvalidated length from an untrusted reader — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X16 Unfloored truncation loop — X16 reached only 0% of this repository's production lines — rust (767,277 lines), python (1,960 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • X17 Uncapped recursion over a caller-supplied document — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X18 Disposal-pattern correctness — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X19 Unrestored process-global state — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X2 Cancellation propagation — no C# was loaded; this repository's Python and Rust were read, and no request in it can be cancelled by a caller — a Python request takes no token: asyncio cancels the task and trio or anyio the scope that made it, from outside the call, and requests, httpx, aiohttp and gRPC take a timeout, not a cancellation; a Rust request takes no token: a future is cancelled by dropping it, from outside the call (select!, a timeout, an aborted task), and reqwest, hyper and tonic take none
  • X20 Mistyped argument guard — This check asks whether an argument guard reports an EMPTY value as a NULL one, which needs a language that throws a null-specific argument exception — .NET's ArgumentNullException, the JVM's NullPointerException, Dart's ArgumentError.notNull. This repository contains none of those languages: the ones it is written in have a single exception for a bad argument, so there is no pair of exceptions to confuse and nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X22 Contradicted release guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X23 Unguarded diagnostic materialisation — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X24 Document value interpolated into markup unescaped — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X25 Inert configuration knob — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X26 Unsynchronised callback handoff — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X3 Exception handling — X3 reached only 0% of this repository's production lines — rust (767,277 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X4 Structured logging — This check asks whether log calls keep a message's values apart from its text, which needs a logger that can carry them as fields. This repository's Rust was read, and it logs through none: the `log` crate's macros take one finished message (as log4net does in C#; its `kv` values are an opt-in its backends mostly drop), `println!`/`eprintln!` are not loggers, or it makes no log call outside its tests and examples at all. Calls through `tracing` (`tracing::info!`, or `info!` imported from it) would be judged.
  • 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 — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • 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 — 49 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
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
  • REDACTED
D34 · Knowledge Freshness · Orphaned knowledge · ×3
  • Orphaned knowledge datafusion/datasource-json/src/utils.rs:1 — No living knowledge remains for this large file — its last meaningful change has decayed away, so if it breaks, no one currently understands it. It does carry its own tests, so the behaviour is pinned even though the understanding is gone: schedule a read-through, using those tests as the specification, before the next change lands here.
  • Orphaned knowledge datafusion/functions-window/src/macros.rs:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
  • Orphaned knowledge datafusion/expr/src/arguments.rs:1 — No living knowledge remains for this large file — its last meaningful change has decayed away, so if it breaks, no one currently understands it. It does carry its own tests, so the behaviour is pinned even though the understanding is gone: schedule a read-through, using those tests as the specification, before the next change lands here.
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
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D30 · Dependency Vulnerabilities · High CVE · ×1
  • REDACTED
D31 · IaC & Container Security · High IaC · ×1
  • REDACTED
Serious — 2437 finding(s)
D17 · Explicit Debt · TodoComment · ×312
  • TodoComment test-utils/src/array_gen/primitive.rs:26 — // TODO: support generating more primitive arrays — 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 test-utils/src/array_gen/random_data.rs:97 — // TODO: constrain this range to valid dates if necessary — 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:308 — // 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/substrait/tests/cases/roundtrip_logical_plan.rs:2150 — // TODO: would be nice to have a struct inside the LargeList, but arrow_cast doesn't support that currently — 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/substrait/tests/cases/roundtrip_logical_plan.rs:2801 — // todo use core array_transform when it supports multiple lambda parameters — 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/substrait/src/extensions.rs:15 — /// TODO: DF doesn't yet use extensions for type variations <https://github.com/apache/datafusion/issues/11544>
  • TodoComment datafusion/substrait/src/extensions.rs:16 — /// TODO: DF doesn't yet provide valid extensionUris <https://github.com/apache/datafusion/issues/11545>
  • TodoComment datafusion/substrait/src/variation_const.rs:15 — //! TODO: Definitions here are not the final form. All the non-system-preferred variations will be defined — 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/substrait/src/variation_const.rs:23 — // TODO: Define as extensions: <https://github.com/apache/datafusion/issues/11544>
  • TodoComment datafusion/substrait/src/physical_plan/consumer.rs:97 — // TODO substrait plans do not have `last_modified` or `size` but `ObjectMeta` — 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/substrait/src/logical_plan/producer/substrait_producer.rs:128 — /// todo!() — 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/substrait/src/logical_plan/producer/substrait_producer.rs:134 — /// todo!() — 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/substrait/src/logical_plan/producer/rel/exchange_rel.rs:23 — // TODO: Support range repartitioning in Substrait exchange output. — 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/substrait/src/logical_plan/producer/rel/exchange_rel.rs:46 — // TODO: Support range repartitioning in Substrait exchange output. — 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/substrait/src/logical_plan/producer/expr/window_function.rs:109 — // TODO: Support GROUPS — 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/substrait/src/logical_plan/consumer/substrait_consumer.rs:165 — // TODO: Remove these two methods — 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/substrait/src/logical_plan/consumer/types.rs:283 — // TODO: remove the code below once the producer has been updated — 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/substrait/src/logical_plan/consumer/utils.rs:308 — /// TODO: Check nullability for List and Map fields. — 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/substrait/src/logical_plan/consumer/utils.rs:348 — /// TODO: Add support for List/LargeList/FixedSizeList and Map fields. — 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/substrait/src/logical_plan/consumer/rel/read_rel.rs:208 — // TODO: currently does not support multiple local files — 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/sql/tests/sql_integration.rs:5074 — // TODO: this sql should be parsed as join after — 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/sql/tests/common/mod.rs:75 — // TODO: change to to_string() if all the function name is converted to lowercase — 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/optimizer/tests/optimizer_integration.rs:870 — // TODO: change to to_string() if all the function name is converted to lowercase — 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/sql/src/parser.rs:1005 — // TODO: Change sql parser to take in `or_replace: bool` inside parse_create() — 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/sql/src/statement.rs:74 — // TODO: It might be better to return 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.
  • + 287 more in this group — see findings.md.
D3 · God Classes · FileTooLong · ×133
  • FileTooLong: scalar/mod.rs datafusion/common/src/scalar/mod.rs — FileTooLong — 3928 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, 393-6255). The bar is 500 significant lines; this is 3428 over it, 7.86× 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 — 3132 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 2632 over it, 6.26× 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 — 2581 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 66% of them inside a single declaration: DefaultPhysicalPlanner (5 blocks, 165-3717). The bar is 500 significant lines; this is 2081 over it, 5.16× 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: joins/nested_loop_join.rs datafusion/physical-plan/src/joins/nested_loop_join.rs — FileTooLong — 2262 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 1762 over it, 4.52× 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/statement.rs datafusion/sql/src/statement.rs — FileTooLong — 2153 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 91% of them inside a single declaration: SqlToRel (220-2968). The bar is 500 significant lines; this is 1653 over it, 4.31× 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 — 2148 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 1648 over it, 4.30× 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 — 1874 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 (161-2976). The bar is 500 significant lines; this is 1374 over it, 3.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: logical_plan/mod.rs datafusion/proto/src/logical_plan/mod.rs — FileTooLong — 1849 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 (468-2428). The bar is 500 significant lines; this is 1349 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: aggregates/mod.rs datafusion/physical-plan/src/aggregates/mod.rs — FileTooLong — 1808 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, 864-2848). The bar is 500 significant lines; this is 1308 over it, 3.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/config.rs datafusion/common/src/config.rs — FileTooLong — 1777 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 1277 over it, 3.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: joins/utils.rs datafusion/physical-plan/src/joins/utils.rs — FileTooLong — 1743 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 49 free functions. The bar is 500 significant lines; this is 1243 over it, 3.49× 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: hash_join/exec.rs datafusion/physical-plan/src/joins/hash_join/exec.rs — FileTooLong — 1729 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 1229 over it, 3.46× 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: topk/mod.rs datafusion/physical-plan/src/topk/mod.rs — FileTooLong — 1574 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 1074 over it, 3.15× 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: execution/session_state.rs datafusion/core/src/execution/session_state.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). 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: logical_plan/builder.rs datafusion/expr/src/logical_plan/builder.rs — FileTooLong — 1499 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 65% of them inside a single declaration: LogicalPlanBuilder (4 blocks, 208-1830). The bar is 500 significant lines; this is 999 over it, 3.00× 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: repartition/mod.rs datafusion/physical-plan/src/repartition/mod.rs — FileTooLong — 1413 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 913 over it, 2.83× 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/array_agg.rs datafusion/functions-aggregate/src/array_agg.rs — FileTooLong — 1398 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 898 over it, 2.80× 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/expr.rs datafusion/sql/src/unparser/expr.rs — FileTooLong — 1381 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 (89-1941). The bar is 500 significant lines; this is 881 over it, 2.76× 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: type_coercion/binary.rs datafusion/expr-common/src/type_coercion/binary.rs — FileTooLong — 1353 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 61 free functions. The bar is 500 significant lines; this is 853 over it, 2.71× 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: simplify_expressions/expr_simplifier.rs datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs — FileTooLong — 1309 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: Simplifier (3 blocks, 821-2120). The bar is 500 significant lines; this is 809 over it, 2.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: context/mod.rs datafusion/core/src/execution/context/mod.rs — FileTooLong — 1286 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 85% of them inside a single declaration: SessionContext (6 blocks, 281-2238). The bar is 500 significant lines; this is 786 over it, 2.57× 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/first_last.rs datafusion/functions-aggregate/src/first_last.rs — FileTooLong — 1261 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 761 over it, 2.52× 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: sorts/sort.rs datafusion/physical-plan/src/sorts/sort.rs — FileTooLong — 1252 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 752 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: opener/mod.rs datafusion/datasource-parquet/src/opener/mod.rs — FileTooLong — 1245 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 745 over it, 2.49× 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 — 1240 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: MaterializingSortMergeJoinStream (2 blocks, 340-2041). The bar is 500 significant lines; this is 740 over it, 2.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.
  • + 108 more in this group — see findings.md.
D3 · God Classes · MethodTooLong · ×87
  • MethodTooLong: SqlToRel.sql_statement_to_plan_with_context_impl datafusion/sql/src/statement.rs:254 — MethodTooLong — sql_statement_to_plan_with_context_impl runs 1024 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 924 over it, 10.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.
  • MethodTooLong: DefaultPhysicalPlanner.map_logical_node_to_physical REDACTED:786 — MethodTooLong — map_logical_node_to_physical runs 973 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 873 over it, 9.73× 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:855 — MethodTooLong — f_up runs 773 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 673 over it, 7.73× 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 698 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 598 over it, 6.98× 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:215 — MethodTooLong — sql_function_to_expr runs 465 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 365 over it, 4.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: PushDownFilter.rewrite datafusion/optimizer/src/push_down_filter.rs:849 — MethodTooLong — rewrite runs 384 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 284 over it, 3.84× 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:150 — MethodTooLong — expr_to_sql_inner runs 379 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 279 over it, 3.79× 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:910 — MethodTooLong — with_new_exprs runs 374 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 274 over it, 3.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: TypeCoercionRewriter.f_up datafusion/optimizer/src/analyzer/type_coercion.rs:698 — MethodTooLong — f_up runs 353 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 253 over it, 3.53× 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:89 — MethodTooLong — select_to_plan runs 339 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 239 over it, 3.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.
  • MethodTooLong: PgJsonVisitor.to_json_value datafusion/expr/src/logical_plan/display.rs:340 — MethodTooLong — to_json_value runs 329 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 229 over it, 3.29× 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:385 — MethodTooLong — sql_expr_to_logical_expr_internal runs 321 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 221 over it, 3.21× 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:2173 — MethodTooLong — display runs 311 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 211 over it, 3.11× 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:2426 — 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:3745 — MethodTooLong — to_array_of_size runs 290 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 190 over it, 2.90× 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:63 — MethodTooLong — map_children runs 289 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 189 over it, 2.89× 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: StepContext.run_test xtask/src/ci_steps.rs:229 — MethodTooLong — run_test runs 273 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 173 over it, 2.73× 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:3103 — 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: ScalarValue.try_from datafusion/proto-common/src/from_proto/mod.rs:385 — MethodTooLong — try_from 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: ScalarValue.try_from datafusion/proto-common/src/to_proto/mod.rs:307 — MethodTooLong — try_from runs 247 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 147 over it, 2.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: PullUpCorrelatedExpr.f_up datafusion/optimizer/src/decorrelate.rs:395 — MethodTooLong — f_up runs 245 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 145 over it, 2.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.
  • MethodTooLong: LogicalPlan.map_expressions datafusion/expr/src/logical_plan/tree_node.rs:550 — MethodTooLong — map_expressions runs 229 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 129 over it, 2.29× 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:3067 — 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: RowGroupsPrunedParquetOpen.build_stream datafusion/datasource-parquet/src/opener/mod.rs:1650 — MethodTooLong — build_stream 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.
  • MethodTooLong: ScalarValue.try_from_array datafusion/common/src/scalar/mod.rs:4333 — 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.
  • + 62 more in this group — see findings.md.
D15 · Churn × Complexity Hotspots · Hotspot · ×67
  • Hotspot: datafusion/sql/src/statement.rs datafusion/sql/src/statement.rs:254 — datafusion/sql/src/statement.rs changed 18 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 214 in SqlToRel::sql_statement_to_plan_with_context_impl at line 254. 6 of those changes were fix/bug commits, and the other 12 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +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/optimizer/src/simplify_expressions/expr_simplifier.rs datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:855 — datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs changed 19 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 180 in Simplifier::f_up at line 855. 12 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +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: REDACTED REDACTED:786 — REDACTED changed 28 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 115 in DefaultPhysicalPlanner::map_logical_node_to_physical at line 786. 5 of those changes were fix/bug commits, and the other 23 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +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/expr/src/logical_plan/plan.rs datafusion/expr/src/logical_plan/plan.rs:2173 — datafusion/expr/src/logical_plan/plan.rs changed 33 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 65 in LogicalPlan::display at line 2173. 13 of those changes were fix/bug commits, and the other 20 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +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/optimizer/src/push_down_filter.rs datafusion/optimizer/src/push_down_filter.rs:849 — datafusion/optimizer/src/push_down_filter.rs changed 25 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 73 in PushDownFilter::rewrite at line 849. 10 of those changes were fix/bug commits, and the other 15 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +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/sql/src/unparser/plan.rs datafusion/sql/src/unparser/plan.rs:837 — datafusion/sql/src/unparser/plan.rs changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 125 in Unparser::select_to_sql_recursively at line 837. 4 of those changes were fix/bug commits, and the other 10 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +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/optimizer/src/decorrelate.rs datafusion/optimizer/src/decorrelate.rs:395 — datafusion/optimizer/src/decorrelate.rs changed 21 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 55 in PullUpCorrelatedExpr::f_up at line 395. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +00:00' --full-history --no-merges -- datafusion/optimizer/src/decorrelate.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-common/src/generated/pbjson.rs datafusion/proto-common/src/generated/pbjson.rs:6796 — datafusion/proto-common/src/generated/pbjson.rs changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 121 in ParquetOptions::deserialize at line 6796. 3 of those changes were fix/bug commits, and the other 6 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +00:00' --full-history --no-merges -- datafusion/proto-common/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/proto-common/src/from_proto/mod.rs datafusion/proto-common/src/from_proto/mod.rs:385 — datafusion/proto-common/src/from_proto/mod.rs changed 19 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 57 in ScalarValue::try_from at line 385. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +00:00' --full-history --no-merges -- datafusion/proto-common/src/from_proto/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/joins/hash_join/exec.rs datafusion/physical-plan/src/joins/hash_join/exec.rs:3229 — datafusion/physical-plan/src/joins/hash_join/exec.rs changed 55 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 18 in datafusion_physical_plan::joins::hash_join::exec::build_in_memory at line 3229. 22 of those changes were fix/bug commits, and the other 33 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +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/common/src/scalar/mod.rs datafusion/common/src/scalar/mod.rs:5858 — datafusion/common/src/scalar/mod.rs changed 19 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 52 in ScalarValue::fmt at line 5858. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +00:00' --full-history --no-merges -- datafusion/common/src/scalar/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:150 — datafusion/sql/src/unparser/expr.rs changed 17 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 57 in Unparser::expr_to_sql_inner at line 150. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +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/decorrelate_predicate_subquery.rs datafusion/optimizer/src/decorrelate_predicate_subquery.rs:870 — datafusion/optimizer/src/decorrelate_predicate_subquery.rs changed 20 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 46 in datafusion_optimizer::decorrelate_predicate_subquery::build_join at line 870. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +00:00' --full-history --no-merges -- datafusion/optimizer/src/decorrelate_predicate_subquery.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:698 — datafusion/optimizer/src/analyzer/type_coercion.rs changed 21 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 38 in TypeCoercionRewriter::f_up at line 698. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +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/sql/src/expr/function.rs datafusion/sql/src/expr/function.rs:215 — datafusion/sql/src/expr/function.rs changed 8 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 215. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +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/pruning/src/pruning_predicate.rs datafusion/pruning/src/pruning_predicate.rs:1764 — datafusion/pruning/src/pruning_predicate.rs changed 15 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 35 in datafusion_pruning::pruning_predicate::build_predicate_expression at line 1764. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +00:00' --full-history --no-merges -- datafusion/pruning/src/pruning_predicate.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/display.rs datafusion/expr/src/logical_plan/display.rs:340 — datafusion/expr/src/logical_plan/display.rs changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 57 in PgJsonVisitor::to_json_value at line 340. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +00:00' --full-history --no-merges -- datafusion/expr/src/logical_plan/display.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/mod.rs datafusion/sql/src/expr/mod.rs:385 — datafusion/sql/src/expr/mod.rs changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 64 in SqlToRel::sql_expr_to_logical_expr_internal at line 385. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +00:00' --full-history --no-merges -- datafusion/sql/src/expr/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/expr/src/expr_schema.rs datafusion/expr/src/expr_schema.rs:299 — datafusion/expr/src/expr_schema.rs changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 40 in Expr::nullable at line 299. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +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-optimizer/src/ensure_requirements/enforce_distribution.rs datafusion/physical-optimizer/src/ensure_requirements/enforce_distribution.rs:1653 — 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 34 in datafusion_physical_optimizer::ensure_requirements::enforce_distribution::ensure_distribution_with_stats at line 1653. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +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/expr.rs datafusion/expr/src/expr.rs:3067 — datafusion/expr/src/expr.rs changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 55 in SchemaDisplay::fmt at line 3067. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +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/physical-plan/src/joins/nested_loop_join.rs datafusion/physical-plan/src/joins/nested_loop_join.rs:4149 — datafusion/physical-plan/src/joins/nested_loop_join.rs changed 23 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 4149. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +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/physical-plan/src/aggregates/grouped_hash_stream.rs datafusion/physical-plan/src/aggregates/grouped_hash_stream.rs:652 — datafusion/physical-plan/src/aggregates/grouped_hash_stream.rs changed 16 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 27 in GroupedHashAggregateStream::poll_next at line 652. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +00:00' --full-history --no-merges -- datafusion/physical-plan/src/aggregates/grouped_hash_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.
  • Hotspot: datafusion/functions/src/datetime/date_bin.rs datafusion/functions/src/datetime/date_bin.rs:630 — datafusion/functions/src/datetime/date_bin.rs changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 37 in datafusion_functions::datetime::date_bin::date_bin_impl at line 630. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +00:00' --full-history --no-merges -- datafusion/functions/src/datetime/date_bin.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/datasource-parquet/src/opener/mod.rs datafusion/datasource-parquet/src/opener/mod.rs:613 — datafusion/datasource-parquet/src/opener/mod.rs changed 22 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 18 in ParquetOpenState::transition at line 613. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +00:00' --full-history --no-merges -- datafusion/datasource-parquet/src/opener/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.
  • + 42 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×45
  • Duplicated block (9 lines × 2) datafusion/common/src/utils/mod.rs:151 — datafusion/common/src/utils/mod.rs:151-159 | datafusion/common/src/utils/mod.rs:201-209 — 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/datasource-parquet/src/metadata.rs:767 — datafusion/datasource-parquet/src/metadata.rs:767-775 | datafusion/datasource-parquet/src/metadata.rs:779-787 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/datasource-parquet/src/metadata.rs:767` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) datafusion/datasource/src/memory.rs:531 — datafusion/datasource/src/memory.rs:531-539 | datafusion/physical-plan/src/test.rs:321-329 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/datasource/src/memory.rs:531` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) datafusion/expr-common/src/sort_properties.rs:55 — datafusion/expr-common/src/sort_properties.rs:55-63 | datafusion/expr-common/src/sort_properties.rs:75-83 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/expr-common/src/sort_properties.rs:55` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) datafusion/expr/src/higher_order_function.rs:1245 — datafusion/expr/src/higher_order_function.rs:1245-1253 | datafusion/sql/src/expr/function.rs:426-436 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/expr/src/higher_order_function.rs:1245` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) datafusion/expr/src/utils.rs:1293 — datafusion/expr/src/utils.rs:1293-1301 | datafusion/expr/src/utils.rs:1317-1325 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/expr/src/utils.rs:1293` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `expr` to `&Expr` in one and `Expr` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (9 lines × 2) datafusion/ffi/src/config/mod.rs:84 — datafusion/ffi/src/config/mod.rs:84-92 | datafusion/ffi/src/config/mod.rs:97-105 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (9 lines × 2) datafusion/ffi/src/proto/logical_extension_codec.rs:197 — datafusion/ffi/src/proto/logical_extension_codec.rs:197-205 | datafusion/ffi/src/proto/physical_extension_codec.rs:183-191 — 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 124 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (9 lines × 2) datafusion/ffi/src/proto/logical_extension_codec.rs:223 — datafusion/ffi/src/proto/logical_extension_codec.rs:223-231 | datafusion/ffi/src/proto/physical_extension_codec.rs:209-217 — 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 124 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (9 lines × 2) datafusion/ffi/src/proto/logical_extension_codec.rs:249 — datafusion/ffi/src/proto/logical_extension_codec.rs:249-257 | datafusion/ffi/src/proto/physical_extension_codec.rs:235-243 — 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 124 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (9 lines × 2) datafusion/functions-aggregate/src/average.rs:289 — datafusion/functions-aggregate/src/average.rs:289-297 | datafusion/functions-aggregate/src/average.rs:311-319 — 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:340 — datafusion/functions-aggregate/src/covariance.rs:340-348 | datafusion/functions-aggregate/src/regr.rs:677-685 — 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:324 — datafusion/functions-aggregate/src/first_last.rs:324-332 | datafusion/functions-aggregate/src/first_last.rs:1651-1659 — 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:102 — datafusion/functions-nested/src/concat.rs:102-110 | datafusion/functions-nested/src/concat.rs:193-201 — 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:106 — datafusion/functions-nested/src/remove.rs:106-114 | datafusion/functions-nested/src/remove.rs:345-353 — 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/utils.rs:223 — datafusion/functions-nested/src/utils.rs:223-231 | datafusion/functions/src/utils.rs:107-115 — before extracting anything, compare `datafusion/functions-nested/src/utils.rs` and `datafusion/functions/src/utils.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. 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/functions-nested/src/utils.rs:223` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) datafusion/functions/src/math/monotonicity.rs:94 — datafusion/functions/src/math/monotonicity.rs:94-102 | datafusion/functions/src/math/monotonicity.rs:191-199 — 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/optimizer/src/simplify_expressions/expr_simplifier.rs:995 — datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:995-1003 | datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:1085-1093 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:995` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (9 lines × 2) datafusion/physical-expr/src/higher_order_function.rs:462 — datafusion/physical-expr/src/higher_order_function.rs:462-470 | datafusion/physical-expr/src/scalar_function.rs:353-361 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (9 lines × 2) datafusion/physical-expr/src/partitioning.rs:1004 — datafusion/physical-expr/src/partitioning.rs:1004-1012 | datafusion/physical-plan/src/repartition/mod.rs:871-879 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-expr/src/partitioning.rs:1004` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) datafusion/physical-optimizer/src/ensure_requirements/enforce_sorting/sort_pushdown.rs:785 — datafusion/physical-optimizer/src/ensure_requirements/enforce_sorting/sort_pushdown.rs:785-793 | datafusion/physical-optimizer/src/ensure_requirements/enforce_sorting/sort_pushdown.rs:799-807 — 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) datafusion/physical-plan/src/aggregates/group_values/multi_group_by/mod.rs:508 — datafusion/physical-plan/src/aggregates/group_values/multi_group_by/mod.rs:508-516 | datafusion/physical-plan/src/aggregates/group_values/multi_group_by/mod.rs:887-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 (9 lines × 2) datafusion/physical-plan/src/display.rs:294 — datafusion/physical-plan/src/display.rs:294-302 | datafusion/physical-plan/src/display.rs:488-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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/display.rs:294` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) datafusion/physical-plan/src/joins/hash_join/exec.rs:2170 — datafusion/physical-plan/src/joins/hash_join/exec.rs:2170-2178 | datafusion/physical-plan/src/joins/sort_merge_join/exec.rs:886-894 — `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 34 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/joins/hash_join/exec.rs:2170` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (9 lines × 2) datafusion/physical-plan/src/joins/symmetric_hash_join.rs:576 — datafusion/physical-plan/src/joins/symmetric_hash_join.rs:576-584 | datafusion/physical-plan/src/joins/symmetric_hash_join.rs:596-604 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/joins/symmetric_hash_join.rs:576` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • + 20 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (7 lines × 2) · ×44
  • Duplicated block (7 lines × 2) datafusion-cli/src/object_storage/instrumented.rs:174 — datafusion-cli/src/object_storage/instrumented.rs:174-180 | datafusion-cli/src/object_storage/instrumented.rs:197-203 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion-cli/src/object_storage/instrumented.rs:174` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `datafusion-cli/src/object_storage/instrumented.rs:181` calls `Some` and `datafusion-cli/src/object_storage/instrumented.rs:204` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7 lines × 2) datafusion/common/src/dfschema.rs:766 — datafusion/common/src/dfschema.rs:766-772 | datafusion/common/src/dfschema.rs:835-841 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/common/src/dfschema.rs:766` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) datafusion/common/src/scalar/mod.rs:3419 — datafusion/common/src/scalar/mod.rs:3419-3426 | datafusion/common/src/scalar/mod.rs:4096-4102 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/common/src/scalar/mod.rs:3419` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) datafusion/common/src/stats.rs:894 — datafusion/common/src/stats.rs:894-900 | datafusion/common/src/stats.rs:922-928 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/common/src/stats.rs:894` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (7 lines × 2) datafusion/datasource/src/display.rs:59 — datafusion/datasource/src/display.rs:59-65 | datafusion/datasource/src/display.rs:68-74 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/datasource/src/display.rs:59` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) datafusion/expr-common/src/interval_arithmetic.rs:992 — datafusion/expr-common/src/interval_arithmetic.rs:992-998 | datafusion/expr-common/src/interval_arithmetic.rs:1023-1029 — 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/src/logical_plan/plan.rs:1613 — datafusion/expr/src/logical_plan/plan.rs:1613-1620 | datafusion/expr/src/logical_plan/plan.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/ffi/src/proto/logical_extension_codec.rs:446 — datafusion/ffi/src/proto/logical_extension_codec.rs:446-452 | datafusion/ffi/src/proto/physical_extension_codec.rs:387-393 — 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 124 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (7 lines × 2) datafusion/functions-aggregate-common/src/aggregate/count_distinct/groups.rs:102 — datafusion/functions-aggregate-common/src/aggregate/count_distinct/groups.rs:102-108 | datafusion/functions-aggregate/src/count.rs:735-741 — 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:1555 — datafusion/functions-aggregate/src/first_last.rs:1555-1561 | datafusion/functions-aggregate/src/first_last.rs:1942-1948 — 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:643 — datafusion/functions-nested/src/extract.rs:643-649 | datafusion/functions-nested/src/extract.rs:730-736 — 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/lib.rs:222 — datafusion/functions-nested/src/lib.rs:222-228 | datafusion/functions/src/lib.rs:170-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.
  • Duplicated block (7 lines × 2) datafusion/functions/src/unicode/substr.rs:344 — datafusion/functions/src/unicode/substr.rs:344-350 | datafusion/functions/src/unicode/substrindex.rs:293-299 — 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/optimizer/src/push_down_filter.rs:981 — datafusion/optimizer/src/push_down_filter.rs:981-987 | datafusion/optimizer/src/push_down_filter.rs:1085-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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/optimizer/src/push_down_filter.rs:1085` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:1855 — datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:1855-1861 | datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:1965-1971 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:1855` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) datafusion/physical-optimizer/src/pushdown_sort.rs:93 — datafusion/physical-optimizer/src/pushdown_sort.rs:93-99 | datafusion/physical-optimizer/src/pushdown_sort.rs:149-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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-optimizer/src/pushdown_sort.rs:93` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) datafusion/physical-plan/src/aggregates/hash_stream.rs:411 — datafusion/physical-plan/src/aggregates/hash_stream.rs:411-417 | datafusion/physical-plan/src/aggregates/partial_reduce_stream.rs:211-217 — before extracting anything, compare `datafusion/physical-plan/src/aggregates/hash_stream.rs` and `datafusion/physical-plan/src/aggregates/partial_reduce_stream.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 59 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/aggregates/hash_stream.rs:411` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `hash_table` to `&mut AggregateHashTable<PartialMarker>` in one and `&mut AggregateHashTable<PartialReduceMarker>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (7 lines × 2) datafusion/physical-plan/src/analyze.rs:515 — datafusion/physical-plan/src/analyze.rs:515-521 | datafusion/physical-plan/src/analyze.rs:528-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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/analyze.rs:515` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs:1665 — datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs:1665-1671 | datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs:1789-1795 — 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:1303 — datafusion/physical-plan/src/joins/utils.rs:1303-1310 | datafusion/physical-plan/src/joins/utils.rs:1321-1327 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/joins/utils.rs:1303` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `self` to `crate) fn get(&mut` in one and `crate) fn get_shared(&mut` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (7 lines × 2) datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs:387 — datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs:387-393 | datafusion/physical-plan/src/windows/window_agg_exec.rs:178-184 — 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 7 separate duplicated blocks between them, totalling at least 68 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs:387` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) datafusion/sql/src/unparser/expr.rs:318 — datafusion/sql/src/unparser/expr.rs:318-324 | datafusion/sql/src/unparser/expr.rs:427-433 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/sql/src/unparser/expr.rs:318` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) datafusion/functions/src/string/replace.rs:80 — datafusion/functions/src/string/replace.rs:80-86 | datafusion/functions/src/string/replace.rs:102-108 — 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/dfschema.rs:741 — datafusion/common/src/dfschema.rs:741-747 | datafusion/common/src/dfschema.rs:810-816 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/common/src/dfschema.rs:741` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) datafusion/expr-common/src/type_coercion/binary.rs:1217 — datafusion/expr-common/src/type_coercion/binary.rs:1217-1223 | datafusion/expr-common/src/type_coercion/binary.rs:1225-1231 — 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.
  • + 19 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (10 lines × 2) · ×42
  • Duplicated block (10 lines × 2) datafusion/common/src/dfschema.rs:754 — datafusion/common/src/dfschema.rs:754-763 | datafusion/common/src/dfschema.rs:823-832 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/common/src/dfschema.rs:754` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (10 lines × 2) datafusion/common/src/hash_utils.rs:387 — datafusion/common/src/hash_utils.rs:387-396 | datafusion/common/src/hash_utils/build_hasher.rs:244-253 — 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 4 separate duplicated blocks between them, totalling at least 54 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/common/src/hash_utils.rs:387` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) datafusion/common/src/hash_utils.rs:812 — datafusion/common/src/hash_utils.rs:812-821 | datafusion/common/src/hash_utils.rs:855-864 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/common/src/hash_utils.rs:812` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) datafusion/core/src/execution/context/mod.rs:893 — datafusion/core/src/execution/context/mod.rs:893-902 | datafusion/core/src/execution/context/mod.rs:912-921 — 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-avro/src/source.rs:274 — datafusion/datasource-avro/src/source.rs:274-283 | datafusion/datasource-avro/src/source.rs:296-305 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/datasource-avro/src/source.rs:274` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) datafusion/datasource/src/boundary_stream.rs:225 — datafusion/datasource/src/boundary_stream.rs:225-234 | datafusion/datasource/src/boundary_stream.rs:266-275 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/datasource/src/boundary_stream.rs:225` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) datafusion/expr/src/expr_fn.rs:912 — datafusion/expr/src/expr_fn.rs:912-921 | datafusion/expr/src/expr_fn.rs:952-961 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/expr/src/expr_fn.rs:912` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) datafusion/expr/src/higher_order_function.rs:1410 — datafusion/expr/src/higher_order_function.rs:1410-1419 | datafusion/physical-expr/src/expressions/lambda.rs:330-339 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (10 lines × 2) datafusion/expr/src/logical_plan/builder.rs:2018 — datafusion/expr/src/logical_plan/builder.rs:2018-2027 | datafusion/physical-plan/src/joins/utils.rs:331-340 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `left` to `&DFSchema` in one and `&Schema` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (10 lines × 2) datafusion/expr/src/logical_plan/display.rs:355 — datafusion/expr/src/logical_plan/display.rs:355-364 | datafusion/expr/src/logical_plan/plan.rs:2194-2203 — 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 52 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/expr/src/logical_plan/display.rs:355` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) datafusion/expr/src/logical_plan/plan.rs:3689 — datafusion/expr/src/logical_plan/plan.rs:3689-3698 | datafusion/expr/src/logical_plan/plan.rs:3765-3774 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/expr/src/logical_plan/plan.rs:3689` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) datafusion/expr/src/type_coercion/functions.rs:1067 — datafusion/expr/src/type_coercion/functions.rs:1067-1076 | datafusion/expr/src/type_coercion/functions.rs:1095-1104 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/expr/src/type_coercion/functions.rs:1067` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) datafusion/functions-nested/src/utils.rs:237 — datafusion/functions-nested/src/utils.rs:237-247 | datafusion/functions/src/utils.rs:134-143 — before extracting anything, compare `datafusion/functions-nested/src/utils.rs` and `datafusion/functions/src/utils.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. 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/functions-nested/src/utils.rs:237` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) datafusion/functions/src/math/round.rs:200 — datafusion/functions/src/math/round.rs:200-209 | datafusion/functions/src/math/trunc.rs:95-104 — 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 60 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/functions/src/math/trunc.rs:95` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) datafusion/functions/src/string/levenshtein.rs:261 — datafusion/functions/src/string/levenshtein.rs:261-270 | datafusion/functions/src/string/levenshtein.rs:281-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 (10 lines × 2) datafusion/optimizer/src/push_down_filter.rs:1143 — datafusion/optimizer/src/push_down_filter.rs:1143-1152 | datafusion/optimizer/src/push_down_filter.rs:1224-1240 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/optimizer/src/push_down_filter.rs:1143` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) datafusion/physical-expr-common/src/binary_map.rs:637 — datafusion/physical-expr-common/src/binary_map.rs:637-646 | datafusion/physical-plan/src/aggregates/group_values/multi_group_by/bytes.rs:398-407 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-expr-common/src/binary_map.rs:637` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) datafusion/physical-expr-common/src/binary_view_map.rs:415 — datafusion/physical-expr-common/src/binary_view_map.rs:415-424 | datafusion/physical-plan/src/aggregates/group_values/multi_group_by/bytes_view.rs:327-336 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-expr-common/src/binary_view_map.rs:415` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) datafusion/physical-plan/src/aggregates/aggregate_hash_table/common.rs:152 — datafusion/physical-plan/src/aggregates/aggregate_hash_table/common.rs:152-161 | datafusion/physical-plan/src/aggregates/aggregate_hash_table/common_clustered.rs:187-196 — before extracting anything, compare `datafusion/physical-plan/src/aggregates/aggregate_hash_table/common.rs` and `datafusion/physical-plan/src/aggregates/aggregate_hash_table/common_clustered.rs` as WHOLE FILES: this scan already matched 4 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/aggregates/aggregate_hash_table/common.rs:152` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) datafusion/physical-plan/src/aggregates/mod.rs:2690 — datafusion/physical-plan/src/aggregates/mod.rs:2690-2699 | datafusion/physical-plan/src/aggregates/mod.rs:2700-2709 — 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/display.rs:308 — datafusion/physical-plan/src/display.rs:308-317 | datafusion/physical-plan/src/display.rs:503-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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/display.rs:308` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) datafusion/physical-plan/src/display.rs:609 — datafusion/physical-plan/src/display.rs:609-618 | datafusion/physical-plan/src/display.rs:717-726 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/display.rs:609` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) datafusion/physical-plan/src/joins/proto.rs:42 — datafusion/physical-plan/src/joins/proto.rs:42-51 | datafusion/physical-plan/src/joins/symmetric_hash_join.rs:847-856 — 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 (10 lines × 2) datafusion/physical-plan/src/joins/sort_merge_join/bitwise_stream.rs:543 — datafusion/physical-plan/src/joins/sort_merge_join/bitwise_stream.rs:543-552 | datafusion/physical-plan/src/joins/sort_merge_join/bitwise_stream.rs:579-588 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/joins/sort_merge_join/bitwise_stream.rs:543` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (10 lines × 2) datafusion/physical-plan/src/sorts/sort.rs:2067 — datafusion/physical-plan/src/sorts/sort.rs:2067-2076 | datafusion/physical-plan/src/sorts/sort_preserving_merge.rs:434-443 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/sorts/sort.rs:2067` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • + 17 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (8 lines × 2) · ×41
  • Duplicated block (8 lines × 2) datafusion/common/src/hash_utils.rs:171 — datafusion/common/src/hash_utils.rs:171-179 | datafusion/common/src/hash_utils/build_hasher.rs:67-74 — 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 4 separate duplicated blocks between them, totalling at least 54 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 (8 lines × 2) datafusion/common/src/scalar/mod.rs:2012 — datafusion/common/src/scalar/mod.rs:2012-2019 | datafusion/common/src/scalar/mod.rs:2163-2170 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/common/src/scalar/mod.rs:2012` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) datafusion/core/src/dataframe/mod.rs:1217 — datafusion/core/src/dataframe/mod.rs:1217-1224 | datafusion/core/src/dataframe/mod.rs:1244-1251 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/core/src/dataframe/mod.rs:1217` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) datafusion/core/src/dataframe/mod.rs:1226 — datafusion/core/src/dataframe/mod.rs:1226-1233 | datafusion/core/src/dataframe/mod.rs:1235-1242 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/core/src/dataframe/mod.rs:1226` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) datafusion/datasource-parquet/src/schema_coercion.rs:629 — datafusion/datasource-parquet/src/schema_coercion.rs:629-636 | datafusion/datasource-parquet/src/schema_coercion.rs:663-670 — 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:582 — datafusion/expr-common/src/interval_arithmetic.rs:582-589 | datafusion/expr-common/src/interval_arithmetic.rs:607-614 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/expr-common/src/interval_arithmetic.rs:582` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) datafusion/expr-common/src/interval_arithmetic.rs:2003 — datafusion/expr-common/src/interval_arithmetic.rs:2003-2010 | datafusion/expr-common/src/interval_arithmetic.rs:2043-2050 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/expr-common/src/interval_arithmetic.rs:2003` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (8 lines × 2) datafusion/expr/src/expr.rs:824 — datafusion/expr/src/expr.rs:824-831 | datafusion/physical-expr/src/expressions/binary.rs:217-224 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/expr/src/expr.rs:824` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `f` to `&mut Formatter<'_>` in one and `&mut std::fmt::Formatter` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (8 lines × 2) datafusion/expr/src/expr_schema.rs:405 — datafusion/expr/src/expr_schema.rs:405-412 | datafusion/expr/src/expr_schema.rs:576-583 — 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/logical_plan/invariants.rs:66 — datafusion/expr/src/logical_plan/invariants.rs:66-73 | datafusion/expr/src/logical_plan/invariants.rs:119-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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/expr/src/logical_plan/invariants.rs:66` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) datafusion/ffi/src/proto/logical_extension_codec.rs:464 — datafusion/ffi/src/proto/logical_extension_codec.rs:464-471 | datafusion/ffi/src/proto/physical_extension_codec.rs:405-412 — 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 124 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (8 lines × 2) datafusion/ffi/src/proto/logical_extension_codec.rs:483 — datafusion/ffi/src/proto/logical_extension_codec.rs:483-490 | datafusion/ffi/src/proto/physical_extension_codec.rs:424-431 — 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 124 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (8 lines × 2) datafusion/functions-aggregate/src/approx_distinct.rs:847 — datafusion/functions-aggregate/src/approx_distinct.rs:847-854 | datafusion/functions-aggregate/src/approx_distinct.rs:976-983 — 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:976 — datafusion/functions-nested/src/array_has.rs:976-983 | datafusion/functions-nested/src/array_has.rs:989-996 — 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/regex/regexpcount.rs:181 — datafusion/functions/src/regex/regexpcount.rs:181-188 | datafusion/functions/src/regex/regexpcount.rs:201-210 — 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/split_part.rs:364 — datafusion/functions/src/string/split_part.rs:364-372 | datafusion/functions/src/unicode/initcap.rs:238-245 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/functions/src/unicode/initcap.rs:238` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (8 lines × 2) datafusion/physical-expr/src/expressions/binary.rs:201 — datafusion/physical-expr/src/expressions/binary.rs:201-208 | datafusion/physical-expr/src/expressions/binary.rs:948-955 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-expr/src/expressions/binary.rs:201` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) datafusion/physical-plan/src/aggregates/aggregate_hash_table/common.rs:303 — datafusion/physical-plan/src/aggregates/aggregate_hash_table/common.rs:303-310 | datafusion/physical-plan/src/aggregates/aggregate_hash_table/common_clustered.rs:435-442 — before extracting anything, compare `datafusion/physical-plan/src/aggregates/aggregate_hash_table/common.rs` and `datafusion/physical-plan/src/aggregates/aggregate_hash_table/common_clustered.rs` as WHOLE FILES: this scan already matched 4 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/aggregates/aggregate_hash_table/common.rs:303` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) datafusion/physical-plan/src/aggregates/aggregate_hash_table/common.rs:379 — datafusion/physical-plan/src/aggregates/aggregate_hash_table/common.rs:379-386 | datafusion/physical-plan/src/aggregates/aggregate_hash_table/common_clustered.rs:334-341 — before extracting anything, compare `datafusion/physical-plan/src/aggregates/aggregate_hash_table/common.rs` and `datafusion/physical-plan/src/aggregates/aggregate_hash_table/common_clustered.rs` as WHOLE FILES: this scan already matched 4 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/aggregates/aggregate_hash_table/common.rs:379` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) datafusion/physical-plan/src/aggregates/clustered_partial_stream.rs:144 — datafusion/physical-plan/src/aggregates/clustered_partial_stream.rs:144-151 | datafusion/physical-plan/src/aggregates/hash_stream.rs:212-219 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `datafusion/physical-plan/src/aggregates/hash_stream.rs:221` calls `counter` and `datafusion/physical-plan/src/aggregates/clustered_partial_stream.rs:153` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 2) datafusion/physical-plan/src/aggregates/group_values/multi_group_by/dictionary.rs:521 — datafusion/physical-plan/src/aggregates/group_values/multi_group_by/dictionary.rs:521-529 | datafusion/physical-plan/src/aggregates/group_values/multi_group_by/dictionary.rs:538-545 — 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:1366 — datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs:1366-1373 | datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs:1421-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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs:1366` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs:1375` calls `Ok` and `datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs:1430` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 2) datafusion/physical-plan/src/repartition/range.rs:397 — datafusion/physical-plan/src/repartition/range.rs:397-404 | datafusion/physical-plan/src/repartition/range.rs:453-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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/repartition/range.rs:397` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) datafusion/proto-common/gen/src/main.rs:18 — datafusion/proto-common/gen/src/main.rs:18-25 | datafusion/proto-models/gen/src/main.rs:20-27 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/proto-common/gen/src/main.rs:18` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) datafusion/sql/src/expr/mod.rs:1158 — datafusion/sql/src/expr/mod.rs:1158-1165 | datafusion/sql/src/expr/mod.rs:1189-1196 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/sql/src/expr/mod.rs:1158` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • + 16 more in this group — see findings.md.
D3 · God Classes · ClassTooLong · ×40
  • ClassTooLong: ScalarValue datafusion/common/src/scalar/mod.rs:393 — ClassTooLong — 3439 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 89 methods, 15 blocks, lines 393-6255. The bar is 400 significant lines; this is 3039 over it, 8.60× 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:165 — ClassTooLong — 1714 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 165-3717. The bar is 400 significant lines; this is 1314 over it, 4.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: LogicalPlan datafusion/expr/src/logical_plan/plan.rs:269 — ClassTooLong — 1505 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 269-2597. The bar is 400 significant lines; this is 1105 over it, 3.76× 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:864 — ClassTooLong — 1162 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 46 methods, 5 blocks, lines 864-2848. The bar is 400 significant lines; this is 762 over it, 2.91× 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:314 — ClassTooLong — 1100 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 314-3857. The bar is 400 significant lines; this is 700 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: SessionContext datafusion/core/src/execution/context/mod.rs:281 — ClassTooLong — 1097 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 281-2238. The bar is 400 significant lines; this is 697 over it, 2.74× 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:208 — ClassTooLong — 967 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 70 methods, 4 blocks, lines 208-1830. The bar is 400 significant lines; this is 567 over it, 2.42× 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:840 — ClassTooLong — 907 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 840-2371. The bar is 400 significant lines; this is 507 over it, 2.27× 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:2103 — 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), 26 methods, 5 blocks, lines 2103-3852. 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: MaterializingSortMergeJoinStream datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs:340 — ClassTooLong — 862 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 340-2041. The bar is 400 significant lines; this is 462 over it, 2.16× 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:220 — ClassTooLong — 838 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 220-2900. The bar is 400 significant lines; this is 438 over it, 2.10× 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 — 780 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-2120. The bar is 400 significant lines; this is 380 over it, 1.95× 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:375 — ClassTooLong — 694 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 59 methods, 3 blocks, lines 375-1927. The bar is 400 significant lines; this is 294 over it, 1.74× 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:133 — ClassTooLong — 671 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 66 methods, 9 blocks, lines 133-2481. The bar is 400 significant lines; this is 271 over it, 1.68× 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:272 — ClassTooLong — 668 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 272-1477. The bar is 400 significant lines; this is 268 over it, 1.67× 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:173 — ClassTooLong — 661 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 32 methods, 5 blocks, lines 173-1287. The bar is 400 significant lines; this is 261 over it, 1.65× 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:280 — ClassTooLong — 630 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 12 methods, 3 blocks, lines 280-1141. The bar is 400 significant lines; this is 230 over it, 1.58× 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:1156 — ClassTooLong — 610 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 1156-2110. The bar is 400 significant lines; this is 210 over it, 1.53× 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:439 — 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 439-1505. 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: FilterExec datafusion/physical-plan/src/filter.rs:73 — ClassTooLong — 593 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, 6 blocks, lines 73-1127. The bar is 400 significant lines; this is 193 over it, 1.48× 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:239 — ClassTooLong — 591 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 32 methods, 2 blocks, lines 239-1249. The bar is 400 significant lines; this is 191 over it, 1.48× 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:156 — ClassTooLong — 587 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 17 methods, 6 blocks, lines 156-1044. The bar is 400 significant lines; this is 187 over it, 1.47× 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:283 — ClassTooLong — 572 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 283-1332. The bar is 400 significant lines; this is 172 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: SymmetricHashJoinExec datafusion/physical-plan/src/joins/symmetric_hash_join.rs:163 — ClassTooLong — 572 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 163-953. The bar is 400 significant lines; this is 172 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: SortExec datafusion/physical-plan/src/sorts/sort.rs:1436 — ClassTooLong — 553 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 1436-2310. The bar is 400 significant lines; this is 153 over it, 1.38× 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.
  • + 15 more in this group — see findings.md.
D3 · God Classes · FunctionTooLong · ×40
  • FunctionTooLong: datafusion_physical_expr::planner::create_physical_expr datafusion/physical-expr/src/planner.rs:120 — 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:56 — 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:157 — 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:40 — 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:571 — 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_optimizer::decorrelate_predicate_subquery::build_join datafusion/optimizer/src/decorrelate_predicate_subquery.rs:870 — FunctionTooLong — datafusion_optimizer::decorrelate_predicate_subquery::build_join runs 264 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 164 over it, 2.64× 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:123 — FunctionTooLong — datafusion_optimizer::optimize_projections::optimize_projections runs 245 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 145 over it, 2.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::producer::types::to_substrait_type_from_field datafusion/substrait/src/logical_plan/producer/types.rs:29 — 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_substrait::logical_plan::producer::expr::literal::to_substrait_literal datafusion/substrait/src/logical_plan/producer/expr/literal.rs:42 — FunctionTooLong — datafusion_substrait::logical_plan::producer::expr::literal::to_substrait_literal 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_physical_optimizer::ensure_requirements::enforce_distribution::ensure_distribution_with_stats datafusion/physical-optimizer/src/ensure_requirements/enforce_distribution.rs:1653 — FunctionTooLong — datafusion_physical_optimizer::ensure_requirements::enforce_distribution::ensure_distribution_with_stats runs 216 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 116 over it, 2.16× 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:630 — FunctionTooLong — datafusion_functions::datetime::date_bin::date_bin_impl runs 215 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 115 over it, 2.15× 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:248 — 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:182 — FunctionTooLong — datafusion_functions_aggregate_common::min_max::min_max_scalar_same_variant runs 185 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 85 over it, 1.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.
  • FunctionTooLong: datafusion_physical_plan::joins::utils::estimate_join_cardinality datafusion/physical-plan/src/joins/utils.rs:488 — FunctionTooLong — datafusion_physical_plan::joins::utils::estimate_join_cardinality runs 181 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 81 over it, 1.81× 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:82 — 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_physical_plan::joins::hash_join::exec::build_in_memory datafusion/physical-plan/src/joins/hash_join/exec.rs:3229 — FunctionTooLong — datafusion_physical_plan::joins::hash_join::exec::build_in_memory runs 167 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 67 over it, 1.67× 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:1764 — FunctionTooLong — datafusion_pruning::pruning_predicate::build_predicate_expression runs 151 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 51 over it, 1.51× 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:215 — FunctionTooLong — datafusion_physical_optimizer::ensure_requirements::enforce_sorting::sort_pushdown::pushdown_sorts_helper runs 147 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 47 over it, 1.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.
  • FunctionTooLong: datafusion_expr_common::casts::try_cast_numeric_literal datafusion/expr-common/src/casts.rs:700 — 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:460 — 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:1408 — FunctionTooLong — datafusion_physical_optimizer::ensure_requirements::enforce_distribution::enforce_distribution_relationships 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_optimizer::decorrelate_lateral_join::rewrite_internal datafusion/optimizer/src/decorrelate_lateral_join.rs:60 — FunctionTooLong — datafusion_optimizer::decorrelate_lateral_join::rewrite_internal runs 138 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 38 over it, 1.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_substrait::logical_plan::consumer::rel::read_rel::from_read_rel datafusion/substrait/src/logical_plan/consumer/rel/read_rel.rs:25 — FunctionTooLong — datafusion_substrait::logical_plan::consumer::rel::read_rel::from_read_rel runs 138 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 38 over it, 1.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_optimizer::eliminate_join::rewrite_node datafusion/optimizer/src/eliminate_join.rs:198 — 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_functions_nested::string::compute_array_to_string datafusion/functions-nested/src/string.rs:579 — FunctionTooLong — datafusion_functions_nested::string::compute_array_to_string runs 121 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 21 over it, 1.21× 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.
  • + 15 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (11 lines × 2) · ×30
  • Duplicated block (11 lines × 2) datafusion/datasource/src/file_compression_type.rs:131 — datafusion/datasource/src/file_compression_type.rs:131-141 | datafusion/datasource/src/file_compression_type.rs:231-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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/datasource/src/file_compression_type.rs:131` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) datafusion/expr-common/src/signature.rs:947 — datafusion/expr-common/src/signature.rs:947-957 | datafusion/expr-common/src/signature.rs:1017-1027 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/expr-common/src/signature.rs:947` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) datafusion/expr/src/expr.rs:3094 — datafusion/expr/src/expr.rs:3094-3104 | datafusion/expr/src/expr.rs:3367-3377 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/expr/src/expr.rs:3094` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) datafusion/expr/src/utils.rs:279 — datafusion/expr/src/utils.rs:279-289 | datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:681-691 — 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 (11 lines × 2) datafusion/functions-aggregate/src/min_max/min_max_bytes.rs:62 — datafusion/functions-aggregate/src/min_max/min_max_bytes.rs:62-72 | datafusion/functions-aggregate/src/min_max/min_max_bytes.rs:76-86 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/functions-aggregate/src/min_max/min_max_bytes.rs:62` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) datafusion/functions/src/math/ceil.rs:54 — datafusion/functions/src/math/ceil.rs:54-64 | datafusion/functions/src/math/floor.rs:58-68 — 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/optimizer/src/scalar_subquery_to_join.rs:114 — datafusion/optimizer/src/scalar_subquery_to_join.rs:114-124 | datafusion/optimizer/src/scalar_subquery_to_join.rs:187-197 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/optimizer/src/scalar_subquery_to_join.rs:114` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) datafusion/physical-expr-common/src/physical_expr.rs:883 — datafusion/physical-expr-common/src/physical_expr.rs:883-893 | datafusion/physical-expr-common/src/sort_expr.rs:384-394 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-expr-common/src/physical_expr.rs:883` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) datafusion/physical-expr/src/expressions/case.rs:854 — datafusion/physical-expr/src/expressions/case.rs:854-864 | datafusion/physical-expr/src/expressions/case.rs:941-951 — 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 2) datafusion/physical-expr/src/expressions/cast.rs:170 — datafusion/physical-expr/src/expressions/cast.rs:170-180 | datafusion/physical-expr/src/expressions/try_cast.rs:53-63 — 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 4 separate duplicated blocks between them, totalling at least 60 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `datafusion/physical-expr/src/expressions/cast.rs:181` calls `target_nullable`, `hash` and `datafusion/physical-expr/src/expressions/try_cast.rs:64` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (11 lines × 2) datafusion/physical-expr/src/higher_order_function.rs:246 — datafusion/physical-expr/src/higher_order_function.rs:246-256 | datafusion/physical-expr/src/scalar_function.rs:203-213 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-expr/src/higher_order_function.rs:246` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) datafusion/physical-plan/src/display.rs:598 — datafusion/physical-plan/src/display.rs:598-608 | datafusion/physical-plan/src/display.rs:613-623 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/display.rs:598` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) datafusion/physical-plan/src/joins/nested_loop_join.rs:3169 — datafusion/physical-plan/src/joins/nested_loop_join.rs:3169-3179 | datafusion/physical-plan/src/joins/nested_loop_join.rs:3268-3278 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/joins/nested_loop_join.rs:3169` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) datafusion/physical-plan/src/repartition/range.rs:411 — datafusion/physical-plan/src/repartition/range.rs:411-421 | datafusion/physical-plan/src/repartition/range.rs:471-481 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/repartition/range.rs:411` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) datafusion/proto/src/logical_plan/from_proto.rs:423 — datafusion/proto/src/logical_plan/from_proto.rs:423-433 | datafusion/proto/src/logical_plan/from_proto.rs:437-447 — 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:353 — datafusion/sql/src/expr/function.rs:353-363 | datafusion/sql/src/expr/function.rs:531-541 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/sql/src/expr/function.rs:353` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) datafusion/sql/src/unparser/utils.rs:67 — datafusion/sql/src/unparser/utils.rs:67-77 | datafusion/sql/src/unparser/utils.rs:90-100 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/sql/src/unparser/utils.rs:67` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) datafusion/common/src/scalar/mod.rs:4472 — datafusion/common/src/scalar/mod.rs:4472-4482 | datafusion/common/src/scalar/mod.rs:5010-5020 — 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:90 — datafusion/functions/src/core/arrow_cast.rs:90-100 | datafusion/functions/src/core/arrow_try_cast.rs:62-72 — 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 39 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/joins/asof_join.rs:691 — datafusion/physical-plan/src/joins/asof_join.rs:691-701 | datafusion/physical-plan/src/joins/hash_join/exec.rs:2287-2299 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/joins/asof_join.rs:691` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (11 lines × 2) datafusion/sql/src/parser.rs:1070 — datafusion/sql/src/parser.rs:1070-1080 | datafusion/sql/src/parser.rs:1149-1161 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/sql/src/parser.rs:1070` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) datafusion/physical-plan/src/joins/sort_merge_join/exec.rs:986 — datafusion/physical-plan/src/joins/sort_merge_join/exec.rs:986-998 | datafusion/physical-plan/src/joins/symmetric_hash_join.rs:830-840 — 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 5 separate duplicated blocks between them, totalling at least 60 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/joins/sort_merge_join/exec.rs:986` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (11 lines × 2) datafusion/proto/src/logical_plan/from_proto.rs:216 — datafusion/proto/src/logical_plan/from_proto.rs:216-226 | datafusion/proto/src/logical_plan/from_proto.rs:527-537 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (11 lines × 2) datafusion/physical-expr/src/expressions/cast.rs:766 — datafusion/physical-expr/src/expressions/cast.rs:766-776 | datafusion/physical-expr/src/expressions/try_cast.rs:265-275 — 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 4 separate duplicated blocks between them, totalling at least 60 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/common/src/scalar/mod.rs:2042 — datafusion/common/src/scalar/mod.rs:2042-2052 | datafusion/common/src/scalar/mod.rs:2116-2126 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/common/src/scalar/mod.rs:2042` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • + 5 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (12 lines × 2) · ×28
  • Duplicated block (12 lines × 2) datafusion/common/src/scalar/mod.rs:2056 — datafusion/common/src/scalar/mod.rs:2056-2067 | datafusion/common/src/scalar/mod.rs:2130-2141 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/common/src/scalar/mod.rs:2056` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) datafusion/datasource/src/memory.rs:776 — datafusion/datasource/src/memory.rs:776-787 | datafusion/proto/src/physical_plan/to_proto.rs:393-404 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/datasource/src/memory.rs:776` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) datafusion/expr-common/src/type_coercion/binary.rs:2124 — datafusion/expr-common/src/type_coercion/binary.rs:2124-2135 | datafusion/expr-common/src/type_coercion/binary.rs:2171-2182 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/expr-common/src/type_coercion/binary.rs:2124` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) datafusion/expr/src/logical_plan/tree_node.rs:524 — datafusion/expr/src/logical_plan/tree_node.rs:524-535 | datafusion/expr/src/logical_plan/tree_node.rs:827-838 — 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:96 — datafusion/ffi/src/udtf.rs:96-107 | datafusion/ffi/src/udtf.rs:124-135 — 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:174 — datafusion/functions-nested/src/cosine_distance.rs:174-185 | datafusion/functions-nested/src/inner_product.rs:180-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 4 separate duplicated blocks between them, totalling at least 91 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:129 — datafusion/functions-nested/src/flatten.rs:129-140 | datafusion/functions-nested/src/flatten.rs:164-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 (12 lines × 2) datafusion/functions-nested/src/replace.rs:132 — datafusion/functions-nested/src/replace.rs:132-143 | datafusion/functions-nested/src/replace.rs:358-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 (12 lines × 2) datafusion/functions/src/core/arrow_cast.rs:119 — datafusion/functions/src/core/arrow_cast.rs:119-130 | datafusion/functions/src/core/arrow_try_cast.rs:90-101 — 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 39 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/core/arrow_field.rs:122 — datafusion/functions/src/core/arrow_field.rs:122-133 | datafusion/functions/src/core/arrow_metadata.rs:125-136 — 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:54 — datafusion/functions/src/crypto/md5.rs:54-65 | datafusion/functions/src/crypto/sha.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/current_date.rs:99 — datafusion/functions/src/datetime/current_date.rs:99-110 | datafusion/functions/src/datetime/current_time.rs:96-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 (12 lines × 2) datafusion/functions/src/datetime/make_date.rs:70 — datafusion/functions/src/datetime/make_date.rs:70-81 | datafusion/functions/src/datetime/make_time.rs:71-82 — 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/common.rs:63 — datafusion/functions/src/math/common.rs:63-74 | datafusion/functions/src/math/common.rs:102-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 (12 lines × 2) datafusion/functions/src/math/round.rs:442 — datafusion/functions/src/math/round.rs:442-453 | datafusion/functions/src/math/trunc.rs:253-264 — 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 60 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/regex/regexpreplace.rs:431 — datafusion/functions/src/regex/regexpreplace.rs:431-442 | datafusion/functions/src/regex/regexpreplace.rs:495-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 (12 lines × 2) datafusion/functions/src/string/levenshtein.rs:248 — datafusion/functions/src/string/levenshtein.rs:248-259 | datafusion/functions/src/string/levenshtein.rs:268-279 — 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:46 — datafusion/functions/src/unicode/left.rs:46-57 | datafusion/functions/src/unicode/right.rs:46-57 — 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/optimizer/src/simplify_expressions/expr_simplifier.rs:902 — datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:902-913 | datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:952-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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:902` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (12 lines × 2) datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:935 — datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:935-950 | datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:953-964 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:935` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) datafusion/physical-plan/src/joins/sort_merge_join/exec.rs:651 — datafusion/physical-plan/src/joins/sort_merge_join/exec.rs:651-662 | datafusion/physical-plan/src/joins/symmetric_hash_join.rs:465-476 — 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 5 separate duplicated blocks between them, totalling at least 60 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/joins/sort_merge_join/exec.rs:651` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs:606 — datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs:606-617 | datafusion/physical-plan/src/windows/window_agg_exec.rs:369-380 — 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 7 separate duplicated blocks between them, totalling at least 68 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs:606` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) datafusion/proto/src/logical_plan/from_proto.rs:346 — datafusion/proto/src/logical_plan/from_proto.rs:346-357 | datafusion/proto/src/logical_plan/from_proto.rs:363-374 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/proto/src/logical_plan/from_proto.rs:346` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) datafusion/sql/src/expr/function.rs:707 — datafusion/sql/src/expr/function.rs:707-718 | datafusion/sql/src/expr/function.rs:863-874 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/sql/src/expr/function.rs:707` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) datafusion/sql/src/unparser/expr.rs:924 — datafusion/sql/src/unparser/expr.rs:924-935 | datafusion/sql/src/unparser/expr.rs:938-949 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/sql/src/unparser/expr.rs:924` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • + 3 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (6 lines × 2) · ×28
  • Duplicated block (6 lines × 2) datafusion/datasource-arrow/src/source.rs:79 — datafusion/datasource-arrow/src/source.rs:79-84 | datafusion/datasource-arrow/src/source.rs:121-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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/datasource-arrow/src/source.rs:79` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) datafusion/datasource/src/file_scan_config/mod.rs:790 — datafusion/datasource/src/file_scan_config/mod.rs:790-796 | datafusion/datasource/src/file_scan_config/mod.rs:1622-1627 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/datasource/src/file_scan_config/mod.rs:790` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) datafusion/expr-common/src/type_coercion/binary.rs:2005 — datafusion/expr-common/src/type_coercion/binary.rs:2005-2010 | datafusion/expr-common/src/type_coercion/binary.rs:2011-2016 — 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/src/logical_plan/information_schema.rs:80 — datafusion/expr/src/logical_plan/information_schema.rs:80-85 | datafusion/expr/src/logical_plan/information_schema.rs:150-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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/expr/src/logical_plan/information_schema.rs:80` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) datafusion/expr/src/logical_plan/information_schema.rs:722 — datafusion/expr/src/logical_plan/information_schema.rs:722-727 | datafusion/expr/src/logical_plan/information_schema.rs:834-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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/expr/src/logical_plan/information_schema.rs:722` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) datafusion/functions-aggregate/src/correlation.rs:421 — datafusion/functions-aggregate/src/correlation.rs:421-426 | datafusion/functions-aggregate/src/correlation.rs:575-580 — 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:492 — datafusion/functions-aggregate/src/correlation.rs:492-497 | datafusion/functions-aggregate/src/correlation.rs:540-545 — 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-nested/src/array_any_match.rs:146 — datafusion/functions-nested/src/array_any_match.rs:146-151 | datafusion/functions-nested/src/array_first.rs:132-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 (6 lines × 2) datafusion/functions/src/datetime/to_char.rs:215 — datafusion/functions/src/datetime/to_char.rs:215-220 | datafusion/functions/src/datetime/to_char.rs:277-282 — 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:58 — datafusion/functions/src/regex/regexpcount.rs:58-63 | datafusion/functions/src/regex/regexpinstr.rs:70-75 — before extracting anything, compare `datafusion/functions/src/regex/regexpcount.rs` and `datafusion/functions/src/regex/regexpinstr.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 40 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:137 — datafusion/functions/src/string/ends_with.rs:137-142 | datafusion/functions/src/string/starts_with.rs:133-138 — 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 69 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-plan/src/aggregates/group_values/row.rs:355 — datafusion/physical-plan/src/aggregates/group_values/row.rs:355-360 | datafusion/physical-plan/src/aggregates/group_values/row.rs:365-370 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/aggregates/group_values/row.rs:355` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) datafusion/physical-plan/src/aggregates/group_values/row.rs:381 — datafusion/physical-plan/src/aggregates/group_values/row.rs:381-386 | datafusion/physical-plan/src/aggregates/group_values/row.rs:392-397 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/aggregates/group_values/row.rs:381` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) datafusion/physical-plan/src/aggregates/grouped_hash_stream.rs:498 — datafusion/physical-plan/src/aggregates/grouped_hash_stream.rs:498-504 | datafusion/physical-plan/src/aggregates/spill.rs:182-187 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/aggregates/grouped_hash_stream.rs:498` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (6 lines × 2) datafusion/proto/src/physical_plan/from_proto.rs:294 — datafusion/proto/src/physical_plan/from_proto.rs:294-301 | datafusion/proto/src/physical_plan/from_proto.rs:328-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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/proto/src/physical_plan/from_proto.rs:294` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (6 lines × 2) datafusion/substrait/src/logical_plan/producer/expr/aggregate_function.rs:37 — datafusion/substrait/src/logical_plan/producer/expr/aggregate_function.rs:37-42 | datafusion/substrait/src/logical_plan/producer/expr/window_function.rs:52-59 — 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (6 lines × 2) datafusion/expr-common/src/type_coercion/binary.rs:2192 — datafusion/expr-common/src/type_coercion/binary.rs:2192-2197 | datafusion/expr-common/src/type_coercion/binary.rs:2198-2203 — 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/optimizer/src/push_down_limit.rs:78 — datafusion/optimizer/src/push_down_limit.rs:78-83 | datafusion/optimizer/src/push_down_limit.rs:87-92 — 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 2) datafusion/expr-common/src/type_coercion/binary.rs:432 — datafusion/expr-common/src/type_coercion/binary.rs:432-437 | datafusion/physical-expr/src/expressions/binary.rs:241-246 — 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/core/greatest.rs:128 — datafusion/functions/src/core/greatest.rs:128-133 | datafusion/functions/src/core/least.rs:141-146 — 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/physical-expr-common/src/binary_map.rs:67 — datafusion/physical-expr-common/src/binary_map.rs:67-72 | datafusion/physical-expr-common/src/binary_view_map.rs:44-49 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `datafusion/physical-expr-common/src/binary_view_map.rs:53` calls `take`, `Self` and `datafusion/physical-expr-common/src/binary_map.rs:77` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (6 lines × 2) datafusion/common/src/types/canonical_extensions/fixed_shape_tensor.rs:35 — datafusion/common/src/types/canonical_extensions/fixed_shape_tensor.rs:35-40 | datafusion/common/src/types/canonical_extensions/variable_shape_tensor.rs:33-38 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/common/src/types/canonical_extensions/fixed_shape_tensor.rs:35` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `metadata` to `<FixedShapeTensor as ExtensionType>::Metadata` in one and `<VariableShapeTensor as ExtensionType>::Metadata` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (6 lines × 2) datafusion/ffi/src/catalog_provider.rs:96 — datafusion/ffi/src/catalog_provider.rs:96-101 | datafusion/ffi/src/catalog_provider_list.rs:87-92 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/ffi/src/catalog_provider.rs:96` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) datafusion/ffi/src/proto/logical_extension_codec.rs:272 — datafusion/ffi/src/proto/logical_extension_codec.rs:272-277 | datafusion/ffi/src/proto/physical_extension_codec.rs:258-263 — 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 124 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/ffi/src/proto/logical_extension_codec.rs:272` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) datafusion/physical-expr/src/proto.rs:212 — datafusion/physical-expr/src/proto.rs:212-217 | datafusion/physical-plan/src/proto/registry.rs:183-188 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `node` to `&PhysicalExprNode` in one and `&PhysicalPlanNode` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • + 3 more in this group — see findings.md.
D6 · Cohesion (LCOM4) · Low cohesion · ×28
  • Low cohesion: CsvSource (LCOM4 7) datafusion/datasource-csv/src/source.rs:86 — CsvSource's methods fall into 7 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 7 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: TaskContext (LCOM4 7) datafusion/execution/src/task.rs:39 — TaskContext's methods fall into 7 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 7 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: Sum (LCOM4 7) datafusion/functions-aggregate/src/sum.rs:151 — Sum's methods fall into 7 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 7 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: GetFieldFunc (LCOM4 6) datafusion/functions/src/core/getfield.rs:78 — GetFieldFunc's methods fall into 6 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 6 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: Count (LCOM4 6) datafusion/functions-aggregate/src/count.rs:144 — Count's methods fall into 6 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 6 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: PlanProperties (LCOM4 6) datafusion/physical-plan/src/execution_plan.rs:1508 — PlanProperties's methods fall into 6 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 6 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: InformationSchemaConfig (LCOM4 5) datafusion/catalog/src/information_schema.rs:421 — InformationSchemaConfig's methods fall into 5 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 5 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: SQLOptions (LCOM4 5) datafusion/core/src/execution/context/mod.rs:2343 — SQLOptions's methods fall into 5 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 5 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: PartitionedFile (LCOM4 5) datafusion/datasource/src/mod.rs:117 — PartitionedFile's methods fall into 5 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 5 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: ArrowFormat (LCOM4 5) datafusion/datasource-arrow/src/file_format.rs:125 — ArrowFormat's methods fall into 5 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 5 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: Interval (LCOM4 5) datafusion/expr-common/src/interval_arithmetic.rs:165 — Interval's methods fall into 5 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 5 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: FFI_ExtensionOptions (LCOM4 5) datafusion/ffi/src/config/extension_options.rs:32 — FFI_ExtensionOptions's methods fall into 5 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 5 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: CoalesceFunc (LCOM4 5) datafusion/functions/src/core/coalesce.rs:40 — CoalesceFunc's methods fall into 5 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 5 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: GroupByMetrics (LCOM4 5) datafusion/physical-plan/src/aggregates/group_values/metrics.rs:231 — GroupByMetrics's methods fall into 5 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 5 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: PlannerContext (LCOM4 5) datafusion/sql/src/planner.rs:245 — PlannerContext's methods fall into 5 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 5 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: SubstraitConsumerContext (LCOM4 5) datafusion/substrait/src/logical_plan/consumer/substrait_consumer.rs:632 — SubstraitConsumerContext's methods fall into 5 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 5 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: GraphvizBuilder (LCOM4 4) datafusion/common/src/display/graphviz.rs:10 — GraphvizBuilder's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: DataFrameWriteOptions (LCOM4 4) datafusion/core/src/dataframe/mod.rs:67 — DataFrameWriteOptions's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: FFI_QueryPlanner (LCOM4 4) datafusion/ffi/src/query_planner.rs:78 — FFI_QueryPlanner's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: FFI_TableProviderFactory (LCOM4 4) datafusion/ffi/src/table_provider_factory.rs:39 — FFI_TableProviderFactory's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: DateBinFunc (LCOM4 4) datafusion/functions/src/datetime/date_bin.rs:108 — DateBinFunc's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: DateTruncFunc (LCOM4 4) datafusion/functions/src/datetime/date_trunc.rs:179 — DateTruncFunc's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: RegexpLikeFunc (LCOM4 4) datafusion/functions/src/regex/regexplike.rs:58 — RegexpLikeFunc's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: ArrayAgg (LCOM4 4) datafusion/functions-aggregate/src/array_agg.rs:81 — ArrayAgg's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: Avg (LCOM4 4) datafusion/functions-aggregate/src/average.rs:81 — Avg's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • + 3 more in this group — see findings.md.
D4 · Code Duplication · Edited copy of a member (13 corresponding lines) · ×24
  • Edited copy of a member (13 corresponding lines) datafusion/expr/src/logical_plan/information_schema.rs:705 — datafusion/expr/src/logical_plan/information_schema.rs:705-718 | datafusion/expr/src/logical_plan/information_schema.rs:818-830 — 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.
  • Edited copy of a member (13 corresponding lines) datafusion/ffi/src/udtf.rs:259 — datafusion/ffi/src/udtf.rs:259-277 | datafusion/ffi/src/udtf.rs:279-291 — 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.
  • Edited copy of a member (13 corresponding lines) datafusion/physical-expr/src/expressions/cast.rs:169 — datafusion/physical-expr/src/expressions/cast.rs:169-183 | datafusion/physical-expr/src/expressions/try_cast.rs:52-64 — 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.
  • Edited copy of a member (13 corresponding lines) datafusion/common/src/scalar/mod.rs:2675 — datafusion/common/src/scalar/mod.rs:2675-2687 | datafusion/common/src/scalar/mod.rs:2693-2705 — 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.
  • Edited copy of a member (13 corresponding lines) datafusion/physical-plan/src/joins/stream_join_utils.rs:587 — datafusion/physical-plan/src/joins/stream_join_utils.rs:587-599 | datafusion/physical-plan/src/joins/stream_join_utils.rs:622-634 — 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.
  • Edited copy of a member (13 corresponding lines) datafusion/physical-plan/src/joins/utils.rs:1302 — datafusion/physical-plan/src/joins/utils.rs:1302-1317 | datafusion/physical-plan/src/joins/utils.rs:1320-1332 — 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.
  • Edited copy of a member (13 corresponding lines) datafusion/datasource/src/memory.rs:773 — datafusion/datasource/src/memory.rs:773-787 | datafusion/proto/src/physical_plan/to_proto.rs:392-404 — 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.
  • Edited copy of a member (13 corresponding lines) datafusion/optimizer/src/push_down_limit/topk_through_join.rs:329 — datafusion/optimizer/src/push_down_limit/topk_through_join.rs:329-341 | datafusion/optimizer/src/push_down_limit/topk_through_join.rs:358-371 — 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.
  • Edited copy of a member (13 corresponding lines) datafusion/core/src/execution/context/mod.rs:1096 — datafusion/core/src/execution/context/mod.rs:1096-1108 | datafusion/core/src/execution/context/mod.rs:1110-1122 — 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.
  • Edited copy of a member (13 corresponding lines) datafusion/sql/src/unparser/utils.rs:241 — datafusion/sql/src/unparser/utils.rs:241-254 | datafusion/sql/src/utils.rs:288-300 — 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.
  • Edited copy of a member (13 corresponding lines) datafusion/physical-plan/src/aggregates/aggregate_stream.rs:214 — datafusion/physical-plan/src/aggregates/aggregate_stream.rs:214-226 | datafusion/physical-plan/src/aggregates/aggregate_stream.rs:237-249 — 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.
  • Edited copy of a member (13 corresponding lines) datafusion/datasource-parquet/src/file_format.rs:557 — datafusion/datasource-parquet/src/file_format.rs:557-569 | datafusion/datasource-parquet/src/file_format.rs:577-590 — 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.
  • Edited copy of a member (13 corresponding lines) datafusion/core/src/execution/context/mod.rs:1081 — datafusion/core/src/execution/context/mod.rs:1081-1094 | datafusion/core/src/execution/context/mod.rs:1502-1514 — 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.
  • Edited copy of a member (13 corresponding lines) datafusion/ffi/src/udaf/mod.rs:484 — datafusion/ffi/src/udaf/mod.rs:484-496 | datafusion/ffi/src/udf/mod.rs:417-429 — 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.
  • Edited copy of a member (13 corresponding lines) datafusion/functions/src/unicode/left.rs:77 — datafusion/functions/src/unicode/left.rs:77-89 | datafusion/functions/src/unicode/right.rs:77-89 — 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.
  • Edited copy of a member (13 corresponding lines) datafusion/ffi/src/udwf/partition_evaluator.rs:281 — datafusion/ffi/src/udwf/partition_evaluator.rs:281-293 | datafusion/ffi/src/udwf/partition_evaluator.rs:324-340 — 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.
  • Edited copy of a member (13 corresponding lines) datafusion/physical-expr-common/src/metrics/expression.rs:44 — datafusion/physical-expr-common/src/metrics/expression.rs:44-58 | datafusion/physical-plan/src/aggregates/group_values/metrics.rs:121-133 — 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.
  • Edited copy of a member (13 corresponding lines) REDACTED:553 — REDACTED:553-565 | REDACTED:759-771 — 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.
  • Edited copy of a member (13 corresponding lines) datafusion/pruning/src/pruning_predicate.rs:1183 — datafusion/pruning/src/pruning_predicate.rs:1183-1195 | datafusion/pruning/src/pruning_predicate.rs:1203-1215 — 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.
  • Edited copy of a member (13 corresponding lines) datafusion/expr/src/utils.rs:42 — datafusion/expr/src/utils.rs:42-54 | datafusion/expr/src/utils.rs:242-257 — 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.
  • Edited copy of a member (13 corresponding lines) datafusion/expr/src/expr_rewriter/mod.rs:188 — datafusion/expr/src/expr_rewriter/mod.rs:188-201 | datafusion/expr/src/expr_rewriter/mod.rs:232-244 — 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.
  • Edited copy of a member (13 corresponding lines) datafusion/physical-expr-common/src/binary_map.rs:300 — datafusion/physical-expr-common/src/binary_map.rs:300-312 | datafusion/physical-expr-common/src/binary_view_map.rs:173-185 — 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.
  • Edited copy of a member (13 corresponding lines) datafusion/physical-expr/src/higher_order_function.rs:260 — datafusion/physical-expr/src/higher_order_function.rs:260-273 | datafusion/physical-expr/src/scalar_function.rs:217-229 — 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.
  • Edited copy of a member (13 corresponding lines) datafusion/catalog-listing/src/helpers.rs:451 — datafusion/catalog-listing/src/helpers.rs:451-463 | datafusion/datasource/src/mod.rs:403-415 — 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 · Duplicated block (5 lines × 2) · ×24
  • Duplicated block (5 lines × 2) datafusion-cli/src/functions.rs:719 — datafusion-cli/src/functions.rs:719-723 | datafusion-cli/src/functions.rs:846-850 — 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-csv/src/source.rs:940 — datafusion/datasource-csv/src/source.rs:940-944 | datafusion/datasource-json/src/source.rs:610-615 — before extracting anything, compare `datafusion/datasource-csv/src/source.rs` and `datafusion/datasource-json/src/source.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 57 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/datasource-csv/src/source.rs:940` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) datafusion/datasource/src/memory.rs:731 — datafusion/datasource/src/memory.rs:731-735 | datafusion/physical-plan/src/joins/sort_merge_join/exec.rs:1024-1028 — 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/execution/src/disk_manager.rs:127 — datafusion/execution/src/disk_manager.rs:127-131 | datafusion/execution/src/disk_manager.rs:136-140 — 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/udf/mod.rs:286 — datafusion/ffi/src/udf/mod.rs:286-290 | datafusion/ffi/src/udwf/mod.rs:215-219 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/ffi/src/udf/mod.rs:286` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `udf` to `Arc<ScalarUDF>` in one and `Arc<WindowUDF>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (5 lines × 2) datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:393 — datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:393-397 | datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:487-491 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:393` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) datafusion/functions-aggregate/src/array_agg.rs:917 — datafusion/functions-aggregate/src/array_agg.rs:917-921 | datafusion/functions-aggregate/src/array_agg.rs:1333-1337 — 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:836 — datafusion/functions-nested/src/array_has.rs:836-840 | datafusion/functions-nested/src/array_has.rs:951-955 — 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:151 — datafusion/functions-nested/src/array_transform.rs:151-160 | datafusion/functions-nested/src/lambda_utils.rs:189-193 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/functions-nested/src/lambda_utils.rs:189` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) datafusion/functions/src/datetime/make_date.rs:110 — datafusion/functions/src/datetime/make_date.rs:110-114 | datafusion/functions/src/datetime/make_time.rs:111-115 — 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:457 — datafusion/functions/src/encoding/inner.rs:457-462 | datafusion/functions/src/encoding/inner.rs:489-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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/functions/src/encoding/inner.rs:457` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) datafusion/physical-expr-common/src/physical_expr.rs:268 — datafusion/physical-expr-common/src/physical_expr.rs:268-272 | datafusion/physical-expr-common/src/physical_expr.rs:325-329 — 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:1257 — datafusion/physical-plan/src/display.rs:1257-1268 | datafusion/physical-plan/src/display.rs:1324-1328 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/display.rs:1257` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `datafusion/physical-plan/src/display.rs:1271` calls `repeat` and `datafusion/physical-plan/src/display.rs:1329` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 2) datafusion/physical-plan/src/joins/utils.rs:1521 — datafusion/physical-plan/src/joins/utils.rs:1521-1525 | datafusion/physical-plan/src/joins/utils.rs:1529-1533 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/joins/utils.rs:1521` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) datafusion/substrait/src/logical_plan/producer/types.rs:262 — datafusion/substrait/src/logical_plan/producer/types.rs:262-266 | datafusion/substrait/src/logical_plan/producer/types.rs:273-277 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/substrait/src/logical_plan/producer/types.rs:262` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:114 — datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:114-119 | datafusion/functions-aggregate-common/src/utils.rs:248-252 — 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:276 — datafusion/physical-expr/src/higher_order_function.rs:276-280 | datafusion/physical-expr/src/scalar_function.rs:232-236 — 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 (5 lines × 2) datafusion/physical-expr-common/src/tree_node.rs:51 — datafusion/physical-expr-common/src/tree_node.rs:51-55 | datafusion/physical-plan/src/tree_node.rs:62-67 — 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/functions-nested/src/array_add.rs:107 — datafusion/functions-nested/src/array_add.rs:107-111 | datafusion/functions-nested/src/array_subtract.rs:106-110 — 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/common/src/stats.rs:228 — datafusion/common/src/stats.rs:228-232 | datafusion/common/src/stats.rs:290-294 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/common/src/stats.rs:228` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) datafusion/expr-common/src/type_coercion/binary.rs:2205 — datafusion/expr-common/src/type_coercion/binary.rs:2205-2209 | datafusion/expr-common/src/type_coercion/binary.rs:2211-2215 — 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/src/expr_schema.rs:647 — datafusion/expr/src/expr_schema.rs:647-651 | datafusion/expr/src/expr_schema.rs:655-659 — 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:1142 — datafusion/functions-aggregate/src/average.rs:1142-1146 | datafusion/functions-aggregate/src/average.rs:1166-1170 — 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/src/simplifier/not.rs:90 — datafusion/physical-expr/src/simplifier/not.rs:90-94 | datafusion/physical-expr/src/simplifier/not.rs:100-104 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `datafusion/physical-expr/src/simplifier/not.rs:87` calls `op` and `datafusion/physical-expr/src/simplifier/not.rs:97` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Edited copy of a member (8 corresponding lines) · ×23
  • Edited copy of a member (8 corresponding lines) datafusion/functions-nested/src/set_ops.rs:118 — datafusion/functions-nested/src/set_ops.rs:118-125 | datafusion/functions-nested/src/set_ops.rs:201-208 — These two members are one piece of code written twice and then edited apart: 8 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.
  • Edited copy of a member (8 corresponding lines) datafusion/common/src/scalar/mod.rs:1633 — datafusion/common/src/scalar/mod.rs:1633-1640 | datafusion/common/src/scalar/mod.rs:1701-1708 — These two members are one piece of code written twice and then edited apart: 8 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.
  • Edited copy of a member (8 corresponding lines) datafusion/common/src/scalar/mod.rs:1711 — datafusion/common/src/scalar/mod.rs:1711-1718 | datafusion/common/src/scalar/mod.rs:1721-1728 — These two members are one piece of code written twice and then edited apart: 8 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.
  • Edited copy of a member (8 corresponding lines) datafusion/functions/src/string/bit_length.rs:74 — datafusion/functions/src/string/bit_length.rs:74-81 | datafusion/functions/src/string/octet_length.rs:89-96 — These two members are one piece of code written twice and then edited apart: 8 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.
  • Edited copy of a member (8 corresponding lines) datafusion/functions-aggregate/src/average.rs:664 — datafusion/functions-aggregate/src/average.rs:664-671 | datafusion/functions-aggregate/src/sum.rs:537-544 — These two members are one piece of code written twice and then edited apart: 8 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.
  • Edited copy of a member (8 corresponding lines) datafusion/physical-plan/src/aggregates/topk/heap.rs:167 — datafusion/physical-plan/src/aggregates/topk/heap.rs:167-174 | datafusion/physical-plan/src/aggregates/topk/heap.rs:253-263 — These two members are one piece of code written twice and then edited apart: 8 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.
  • Edited copy of a member (8 corresponding lines) datafusion/functions-aggregate-common/src/aggregate/count_distinct/groups.rs:101 — datafusion/functions-aggregate-common/src/aggregate/count_distinct/groups.rs:101-108 | datafusion/functions-aggregate/src/count.rs:734-741 — These two members are one piece of code written twice and then edited apart: 8 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.
  • Edited copy of a member (8 corresponding lines) datafusion/physical-plan/src/joins/hash_join/exec.rs:1285 — datafusion/physical-plan/src/joins/hash_join/exec.rs:1285-1292 | datafusion/physical-plan/src/joins/nested_loop_join.rs:449-458 — These two members are one piece of code written twice and then edited apart: 8 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.
  • Edited copy of a member (8 corresponding lines) datafusion/functions-window/src/lead_lag.rs:60 — datafusion/functions-window/src/lead_lag.rs:60-67 | datafusion/functions-window/src/lead_lag.rs:79-86 — These two members are one piece of code written twice and then edited apart: 8 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.
  • Edited copy of a member (8 corresponding lines) datafusion/functions-nested/src/min_max.rs:103 — datafusion/functions-nested/src/min_max.rs:103-110 | datafusion/functions-nested/src/min_max.rs:181-188 — These two members are one piece of code written twice and then edited apart: 8 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.
  • Edited copy of a member (8 corresponding lines) datafusion/sql/src/expr/mod.rs:336 — datafusion/sql/src/expr/mod.rs:336-343 | datafusion/sql/src/expr/mod.rs:351-358 — These two members are one piece of code written twice and then edited apart: 8 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.
  • Edited copy of a member (8 corresponding lines) datafusion/common/src/scalar/mod.rs:1486 — datafusion/common/src/scalar/mod.rs:1486-1493 | datafusion/expr-common/src/casts.rs:554-561 — These two members are one piece of code written twice and then edited apart: 8 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.
  • Edited copy of a member (8 corresponding lines) datafusion/common/src/utils/mod.rs:1114 — datafusion/common/src/utils/mod.rs:1114-1124 | datafusion/common/src/utils/mod.rs:1131-1138 — These two members are one piece of code written twice and then edited apart: 8 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.
  • Edited copy of a member (8 corresponding lines) datafusion/ffi/src/execution/task_ctx.rs:99 — datafusion/ffi/src/execution/task_ctx.rs:99-107 | datafusion/ffi/src/session/mod.rs:264-271 — These two members are one piece of code written twice and then edited apart: 8 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.
  • Edited copy of a member (8 corresponding lines) datafusion/physical-plan/src/aggregates/mod.rs:3112 — datafusion/physical-plan/src/aggregates/mod.rs:3112-3120 | datafusion/physical-optimizer/src/eliminate_constant_join.rs:223-230 — These two members are one piece of code written twice and then edited apart: 8 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.
  • Edited copy of a member (8 corresponding lines) datafusion/physical-plan/src/coalesce_batches.rs:247 — datafusion/physical-plan/src/coalesce_batches.rs:247-255 | datafusion/physical-plan/src/coalesce_partitions.rs:334-341 — These two members are one piece of code written twice and then edited apart: 8 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.
  • Edited copy of a member (8 corresponding lines) datafusion/ffi/src/execution_plan.rs:133 — datafusion/ffi/src/execution_plan.rs:133-140 | datafusion/ffi/src/session/mod.rs:351-359 — These two members are one piece of code written twice and then edited apart: 8 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.
  • Edited copy of a member (8 corresponding lines) datafusion/common/src/hash_utils.rs:1370 — datafusion/common/src/hash_utils.rs:1370-1377 | datafusion/common/src/hash_utils/build_hasher.rs:104-115 — These two members are one piece of code written twice and then edited apart: 8 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.
  • Edited copy of a member (8 corresponding lines) datafusion/physical-plan/src/aggregates/topk/hash_table.rs:214 — datafusion/physical-plan/src/aggregates/topk/hash_table.rs:214-221 | datafusion/physical-plan/src/aggregates/topk/heap.rs:145-152 — These two members are one piece of code written twice and then edited apart: 8 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.
  • Edited copy of a member (8 corresponding lines) datafusion/physical-plan/src/filter.rs:1788 — datafusion/physical-plan/src/filter.rs:1788-1795 | datafusion/physical-plan/src/joins/nested_loop_join.rs:2215-2223 — These two members are one piece of code written twice and then edited apart: 8 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.
  • Edited copy of a member (8 corresponding lines) datafusion/functions-aggregate/src/bit_and_or_xor.rs:216 — datafusion/functions-aggregate/src/bit_and_or_xor.rs:216-226 | datafusion/functions/src/string/to_hex.rs:97-104 — These two members are one piece of code written twice and then edited apart: 8 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.
  • Edited copy of a member (8 corresponding lines) datafusion/physical-plan/src/test.rs:533 — datafusion/physical-plan/src/test.rs:533-540 | datafusion/physical-plan/src/test.rs:542-551 — These two members are one piece of code written twice and then edited apart: 8 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.
  • Edited copy of a member (8 corresponding lines) test-utils/src/array_gen/binary.rs:29 — test-utils/src/array_gen/binary.rs:29-36 | test-utils/src/array_gen/binary.rs:52-59 — These two members are one piece of code written twice and then edited apart: 8 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 (10 corresponding lines) · ×22
  • Edited copy of a member (10 corresponding lines) datafusion/functions-aggregate/src/bool_and_or.rs:187 — datafusion/functions-aggregate/src/bool_and_or.rs:187-196 | datafusion/functions-aggregate/src/bool_and_or.rs:322-331 — These two members are one piece of code written twice and then edited apart: 10 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.
  • Edited copy of a member (10 corresponding lines) datafusion/functions-nested/src/extract.rs:845 — datafusion/functions-nested/src/extract.rs:845-854 | datafusion/functions-nested/src/extract.rs:939-948 — These two members are one piece of code written twice and then edited apart: 10 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.
  • Edited copy of a member (10 corresponding lines) datafusion/substrait/src/logical_plan/consumer/rel/filter_rel.rs:16 — datafusion/substrait/src/logical_plan/consumer/rel/filter_rel.rs:16-30 | datafusion/substrait/src/logical_plan/consumer/rel/sort_rel.rs:16-25 — These two members are one piece of code written twice and then edited apart: 10 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.
  • Edited copy of a member (10 corresponding lines) datafusion/physical-plan/src/operator_statistics/mod.rs:369 — datafusion/physical-plan/src/operator_statistics/mod.rs:369-378 | datafusion/physical-plan/src/operator_statistics/mod.rs:626-637 — These two members are one piece of code written twice and then edited apart: 10 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.
  • Edited copy of a member (10 corresponding lines) datafusion/functions-aggregate/src/count.rs:563 — datafusion/functions-aggregate/src/count.rs:563-572 | datafusion/functions-aggregate/src/sum.rs:683-696 — These two members are one piece of code written twice and then edited apart: 10 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.
  • Edited copy of a member (10 corresponding lines) datafusion/expr/src/type_coercion/functions.rs:371 — datafusion/expr/src/type_coercion/functions.rs:371-380 | datafusion/optimizer/src/analyzer/type_coercion.rs:1463-1475 — These two members are one piece of code written twice and then edited apart: 10 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.
  • Edited copy of a member (10 corresponding lines) datafusion/physical-plan/src/aggregates/clustered_final_stream.rs:86 — datafusion/physical-plan/src/aggregates/clustered_final_stream.rs:86-95 | datafusion/physical-plan/src/aggregates/hash_stream.rs:534-543 — These two members are one piece of code written twice and then edited apart: 10 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.
  • Edited copy of a member (10 corresponding lines) datafusion/ffi/src/physical_expr/mod.rs:598 — datafusion/ffi/src/physical_expr/mod.rs:598-607 | datafusion/ffi/src/physical_expr/mod.rs:637-648 — These two members are one piece of code written twice and then edited apart: 10 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.
  • Edited copy of a member (10 corresponding lines) datafusion/functions-aggregate/src/min_max.rs:693 — datafusion/functions-aggregate/src/min_max.rs:693-702 | datafusion/functions-aggregate/src/min_max.rs:821-830 — These two members are one piece of code written twice and then edited apart: 10 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.
  • Edited copy of a member (10 corresponding lines) datafusion/functions-aggregate/src/count.rs:869 — datafusion/functions-aggregate/src/count.rs:869-879 | datafusion/functions-aggregate/src/count.rs:883-892 — These two members are one piece of code written twice and then edited apart: 10 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.
  • Edited copy of a member (10 corresponding lines) datafusion/physical-expr/src/expressions/case/literal_lookup_table/bytes_like_lookup_table.rs:58 — datafusion/physical-expr/src/expressions/case/literal_lookup_table/bytes_like_lookup_table.rs:58-67 | datafusion/physical-expr/src/expressions/case/literal_lookup_table/primitive_lookup_table.rs:78-93 — These two members are one piece of code written twice and then edited apart: 10 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.
  • Edited copy of a member (10 corresponding lines) datafusion/ffi/src/config/mod.rs:62 — datafusion/ffi/src/config/mod.rs:62-71 | datafusion/ffi/src/config/mod.rs:152-161 — These two members are one piece of code written twice and then edited apart: 10 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.
  • Edited copy of a member (10 corresponding lines) datafusion/sql/src/unparser/plan.rs:2503 — datafusion/sql/src/unparser/plan.rs:2503-2512 | datafusion/sql/src/unparser/plan.rs:2514-2526 — These two members are one piece of code written twice and then edited apart: 10 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.
  • Edited copy of a member (10 corresponding lines) datafusion/common/src/types/canonical_extensions/bool8.rs:79 — datafusion/common/src/types/canonical_extensions/bool8.rs:79-88 | datafusion/common/src/types/canonical_extensions/uuid.rs:79-90 — These two members are one piece of code written twice and then edited apart: 10 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.
  • Edited copy of a member (10 corresponding lines) datafusion/expr-common/src/signature.rs:1364 — datafusion/expr-common/src/signature.rs:1364-1373 | datafusion/expr/src/logical_plan/dml.rs:471-480 — These two members are one piece of code written twice and then edited apart: 10 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.
  • Edited copy of a member (10 corresponding lines) datafusion/datasource/src/memory.rs:70 — datafusion/datasource/src/memory.rs:70-79 | datafusion/physical-plan/src/test.rs:200-209 — These two members are one piece of code written twice and then edited apart: 10 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.
  • Edited copy of a member (10 corresponding lines) datafusion/physical-plan/src/aggregates/clustered_final_stream.rs:305 — datafusion/physical-plan/src/aggregates/clustered_final_stream.rs:305-314 | datafusion/physical-plan/src/aggregates/single_stream.rs:300-314 — These two members are one piece of code written twice and then edited apart: 10 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.
  • Edited copy of a member (10 corresponding lines) datafusion/functions/src/datetime/now.rs:59 — datafusion/functions/src/datetime/now.rs:59-69 | datafusion/functions/src/datetime/to_timestamp.rs:308-317 — These two members are one piece of code written twice and then edited apart: 10 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.
  • Edited copy of a member (10 corresponding lines) datafusion/physical-plan/src/async_func.rs:86 — datafusion/physical-plan/src/async_func.rs:86-95 | datafusion/physical-plan/src/coalesce_batches.rs:98-107 — These two members are one piece of code written twice and then edited apart: 10 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.
  • Edited copy of a member (10 corresponding lines) datafusion/physical-plan/src/coalesce_batches.rs:70 — datafusion/physical-plan/src/coalesce_batches.rs:70-79 | datafusion/physical-plan/src/limit.rs:66-75 — These two members are one piece of code written twice and then edited apart: 10 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.
  • Edited copy of a member (10 corresponding lines) datafusion/functions-nested/src/except.rs:76 — datafusion/functions-nested/src/except.rs:76-85 | datafusion/functions-nested/src/set_ops.rs:97-106 — These two members are one piece of code written twice and then edited apart: 10 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.
  • Edited copy of a member (10 corresponding lines) datafusion/physical-plan/src/test.rs:497 — datafusion/physical-plan/src/test.rs:497-506 | datafusion/physical-plan/src/test.rs:508-521 — These two members are one piece of code written twice and then edited apart: 10 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 (11 corresponding lines) · ×22
  • Edited copy of a member (11 corresponding lines) datafusion/physical-expr/src/intervals/cp_solver.rs:209 — datafusion/physical-expr/src/intervals/cp_solver.rs:209-219 | datafusion/physical-expr/src/statistics/stats_solver.rs:89-104 — These two members are one piece of code written twice and then edited apart: 11 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.
  • Edited copy of a member (11 corresponding lines) datafusion/functions-nested/src/concat.rs:548 — datafusion/functions-nested/src/concat.rs:548-558 | datafusion/functions-nested/src/concat.rs:560-570 — These two members are one piece of code written twice and then edited apart: 11 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.
  • Edited copy of a member (11 corresponding lines) datafusion/functions/src/encoding/inner.rs:109 — datafusion/functions/src/encoding/inner.rs:109-119 | datafusion/functions/src/encoding/inner.rs:182-192 — These two members are one piece of code written twice and then edited apart: 11 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.
  • Edited copy of a member (11 corresponding lines) datafusion/expr-common/src/interval_arithmetic.rs:767 — datafusion/expr-common/src/interval_arithmetic.rs:767-777 | datafusion/expr-common/src/interval_arithmetic.rs:784-794 — These two members are one piece of code written twice and then edited apart: 11 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.
  • Edited copy of a member (11 corresponding lines) datafusion/pruning/src/string_in_list.rs:19 — datafusion/pruning/src/string_in_list.rs:19-29 | datafusion/pruning/src/string_in_list.rs:31-41 — These two members are one piece of code written twice and then edited apart: 11 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.
  • Edited copy of a member (11 corresponding lines) datafusion/common/src/tree_node.rs:186 — datafusion/common/src/tree_node.rs:186-196 | datafusion/expr/src/logical_plan/tree_node.rs:882-899 — These two members are one piece of code written twice and then edited apart: 11 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.
  • Edited copy of a member (11 corresponding lines) datafusion/common/src/tree_node.rs:221 — datafusion/common/src/tree_node.rs:221-231 | datafusion/common/src/tree_node.rs:245-256 — These two members are one piece of code written twice and then edited apart: 11 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.
  • Edited copy of a member (11 corresponding lines) datafusion/functions-aggregate/src/average.rs:548 — datafusion/functions-aggregate/src/average.rs:548-558 | datafusion/functions-aggregate/src/average.rs:595-605 — These two members are one piece of code written twice and then edited apart: 11 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.
  • Edited copy of a member (11 corresponding lines) datafusion/functions/src/core/overlay.rs:90 — datafusion/functions/src/core/overlay.rs:90-100 | datafusion/functions/src/string/levenshtein.rs:92-104 — These two members are one piece of code written twice and then edited apart: 11 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.
  • Edited copy of a member (11 corresponding lines) datafusion/physical-expr/src/expressions/is_not_null.rs:64 — datafusion/physical-expr/src/expressions/is_not_null.rs:64-75 | datafusion/physical-expr/src/expressions/is_null.rs:64-74 — These two members are one piece of code written twice and then edited apart: 11 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.
  • Edited copy of a member (11 corresponding lines) datafusion/common/src/utils/mod.rs:1219 — datafusion/common/src/utils/mod.rs:1219-1232 | datafusion/physical-plan/src/joins/hash_join/shared_bounds.rs:229-239 — These two members are one piece of code written twice and then edited apart: 11 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.
  • Edited copy of a member (11 corresponding lines) datafusion/physical-expr/src/expressions/case.rs:1069 — datafusion/physical-expr/src/expressions/case.rs:1069-1079 | datafusion/physical-expr/src/expressions/case.rs:1092-1102 — These two members are one piece of code written twice and then edited apart: 11 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.
  • Edited copy of a member (11 corresponding lines) datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:2331 — datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:2331-2343 | datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:2348-2358 — These two members are one piece of code written twice and then edited apart: 11 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.
  • Edited copy of a member (11 corresponding lines) datafusion/functions-aggregate/src/average.rs:653 — datafusion/functions-aggregate/src/average.rs:653-663 | datafusion/functions-aggregate/src/average.rs:840-850 — These two members are one piece of code written twice and then edited apart: 11 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.
  • Edited copy of a member (11 corresponding lines) datafusion/sql/src/expr/mod.rs:317 — datafusion/sql/src/expr/mod.rs:317-329 | datafusion/sql/src/expr/mod.rs:885-895 — These two members are one piece of code written twice and then edited apart: 11 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.
  • Edited copy of a member (11 corresponding lines) datafusion/datasource/src/memory.rs:791 — datafusion/datasource/src/memory.rs:791-803 | datafusion/proto/src/physical_plan/from_proto.rs:483-493 — These two members are one piece of code written twice and then edited apart: 11 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.
  • Edited copy of a member (11 corresponding lines) datafusion/common/src/dfschema.rs:195 — datafusion/common/src/dfschema.rs:195-205 | datafusion/common/src/dfschema.rs:1173-1183 — These two members are one piece of code written twice and then edited apart: 11 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.
  • Edited copy of a member (11 corresponding lines) datafusion/functions/src/datetime/to_unixtime.rs:143 — datafusion/functions/src/datetime/to_unixtime.rs:143-153 | datafusion/functions/src/datetime/to_unixtime.rs:155-168 — These two members are one piece of code written twice and then edited apart: 11 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.
  • Edited copy of a member (11 corresponding lines) datafusion/core/src/dataframe/mod.rs:2726 — datafusion/core/src/dataframe/mod.rs:2726-2738 | datafusion/core/src/dataframe/mod.rs:2844-2854 — These two members are one piece of code written twice and then edited apart: 11 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.
  • Edited copy of a member (11 corresponding lines) datafusion/physical-optimizer/src/sanity_checker.rs:90 — datafusion/physical-optimizer/src/sanity_checker.rs:90-100 | datafusion/sql/src/unparser/plan.rs:2173-2183 — These two members are one piece of code written twice and then edited apart: 11 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.
  • Edited copy of a member (11 corresponding lines) datafusion/physical-expr/src/window/aggregate.rs:119 — datafusion/physical-expr/src/window/aggregate.rs:119-131 | datafusion/physical-expr/src/window/standard.rs:62-72 — These two members are one piece of code written twice and then edited apart: 11 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.
  • Edited copy of a member (11 corresponding lines) datafusion/physical-expr/src/proto_test_util.rs:22 — datafusion/physical-expr/src/proto_test_util.rs:22-32 | datafusion/physical-plan/src/proto_test_util.rs:64-74 — These two members are one piece of code written twice and then edited apart: 11 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 (9 corresponding lines) · ×22
  • Edited copy of a member (9 corresponding lines) datafusion/functions-aggregate-common/src/min_max.rs:45 — datafusion/functions-aggregate-common/src/min_max.rs:45-53 | datafusion/functions-aggregate-common/src/min_max.rs:59-67 — These two members are one piece of code written twice and then edited apart: 9 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.
  • Edited copy of a member (9 corresponding lines) datafusion/functions-aggregate-common/src/aggregate/groups_accumulator/bool_op.rs:116 — datafusion/functions-aggregate-common/src/aggregate/groups_accumulator/bool_op.rs:116-124 | datafusion/physical-plan/src/aggregates/group_values/multi_group_by/boolean.rs:171-183 — These two members are one piece of code written twice and then edited apart: 9 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.
  • Edited copy of a member (9 corresponding lines) datafusion/functions-aggregate-common/src/aggregate/groups_accumulator/prim_op.rs:115 — datafusion/functions-aggregate-common/src/aggregate/groups_accumulator/prim_op.rs:115-123 | datafusion/physical-plan/src/aggregates/group_values/multi_group_by/primitive.rs:272-287 — These two members are one piece of code written twice and then edited apart: 9 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.
  • Edited copy of a member (9 corresponding lines) datafusion/ffi/src/physical_optimizer.rs:162 — datafusion/ffi/src/physical_optimizer.rs:162-170 | datafusion/ffi/src/physical_optimizer.rs:176-187 — These two members are one piece of code written twice and then edited apart: 9 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.
  • Edited copy of a member (9 corresponding lines) datafusion/common/src/hash_utils.rs:725 — datafusion/common/src/hash_utils.rs:725-738 | datafusion/common/src/hash_utils.rs:746-754 — These two members are one piece of code written twice and then edited apart: 9 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.
  • Edited copy of a member (9 corresponding lines) datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs:432 — datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs:432-440 | datafusion/physical-plan/src/windows/window_agg_exec.rs:224-236 — These two members are one piece of code written twice and then edited apart: 9 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.
  • Edited copy of a member (9 corresponding lines) datafusion/functions-nested/src/map_extract.rs:93 — datafusion/functions-nested/src/map_extract.rs:93-105 | datafusion/functions-nested/src/map_keys.rs:76-84 — These two members are one piece of code written twice and then edited apart: 9 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.
  • Edited copy of a member (9 corresponding lines) datafusion/expr-common/src/type_coercion/binary.rs:1922 — datafusion/expr-common/src/type_coercion/binary.rs:1922-1935 | datafusion/expr-common/src/type_coercion/binary.rs:2070-2078 — These two members are one piece of code written twice and then edited apart: 9 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.
  • Edited copy of a member (9 corresponding lines) datafusion/functions-aggregate/src/variance.rs:356 — datafusion/functions-aggregate/src/variance.rs:356-364 | datafusion/functions-aggregate/src/variance.rs:366-374 — These two members are one piece of code written twice and then edited apart: 9 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.
  • Edited copy of a member (9 corresponding lines) datafusion/physical-expr-common/src/binary_map.rs:691 — datafusion/physical-expr-common/src/binary_map.rs:691-699 | datafusion/physical-expr-common/src/binary_view_map.rs:590-599 — These two members are one piece of code written twice and then edited apart: 9 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.
  • Edited copy of a member (9 corresponding lines) datafusion/physical-plan/src/aggregates/mod.rs:1232 — datafusion/physical-plan/src/aggregates/mod.rs:1232-1242 | datafusion/physical-plan/src/aggregates/mod.rs:1244-1252 — These two members are one piece of code written twice and then edited apart: 9 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.
  • Edited copy of a member (9 corresponding lines) datafusion/expr/src/udaf.rs:1503 — datafusion/expr/src/udaf.rs:1503-1513 | datafusion/functions-aggregate/src/regr.rs:455-463 — These two members are one piece of code written twice and then edited apart: 9 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.
  • Edited copy of a member (9 corresponding lines) datafusion/functions/src/strings.rs:1495 — datafusion/functions/src/strings.rs:1495-1506 | datafusion/functions/src/strings.rs:1510-1518 — These two members are one piece of code written twice and then edited apart: 9 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.
  • Edited copy of a member (9 corresponding lines) datafusion/ffi/src/physical_optimizer.rs:303 — datafusion/ffi/src/physical_optimizer.rs:303-311 | datafusion/ffi/src/physical_optimizer.rs:317-329 — These two members are one piece of code written twice and then edited apart: 9 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.
  • Edited copy of a member (9 corresponding lines) datafusion/expr/src/logical_plan/builder.rs:158 — datafusion/expr/src/logical_plan/builder.rs:158-168 | datafusion/functions-aggregate/src/average.rs:492-500 — These two members are one piece of code written twice and then edited apart: 9 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.
  • Edited copy of a member (9 corresponding lines) datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs:446 — datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs:446-455 | datafusion/physical-plan/src/windows/window_agg_exec.rs:242-250 — These two members are one piece of code written twice and then edited apart: 9 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.
  • Edited copy of a member (9 corresponding lines) datafusion/physical-plan/src/aggregates/clustered_single_stream.rs:232 — datafusion/physical-plan/src/aggregates/clustered_single_stream.rs:232-240 | datafusion/physical-plan/src/aggregates/hash_stream.rs:654-668 — These two members are one piece of code written twice and then edited apart: 9 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.
  • Edited copy of a member (9 corresponding lines) datafusion/datasource-avro/src/source.rs:35 — datafusion/datasource-avro/src/source.rs:35-43 | datafusion/datasource-csv/src/source.rs:96-105 — These two members are one piece of code written twice and then edited apart: 9 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.
  • Edited copy of a member (9 corresponding lines) datafusion/execution/src/object_store.rs:242 — datafusion/execution/src/object_store.rs:242-250 | datafusion/execution/src/parquet_encryption.rs:60-69 — These two members are one piece of code written twice and then edited apart: 9 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.
  • Edited copy of a member (9 corresponding lines) datafusion/physical-plan/src/joins/sort_merge_join/bitwise_stream.rs:1149 — datafusion/physical-plan/src/joins/sort_merge_join/bitwise_stream.rs:1149-1157 | datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs:904-912 — These two members are one piece of code written twice and then edited apart: 9 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.
  • Edited copy of a member (9 corresponding lines) datafusion/datasource/src/sink.rs:223 — datafusion/datasource/src/sink.rs:223-233 | datafusion/physical-plan/src/analyze.rs:173-181 — These two members are one piece of code written twice and then edited apart: 9 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.
  • Edited copy of a member (9 corresponding lines) test-utils/src/tpcds.rs:604 — test-utils/src/tpcds.rs:604-612 | test-utils/src/tpch.rs:125-133 — These two members are one piece of code written twice and then edited apart: 9 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.
D2 · Cognitive Complexity · datafusion_physical_plan · ×21
  • datafusion_physical_plan::windows::window_equivalence_properties (cognitive 102) datafusion/physical-plan/src/windows/mod.rs:372 — 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::aggregates::get_finer_aggregate_exprs_requirement (cognitive 39) datafusion/physical-plan/src/aggregates/mod.rs:2983 — 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:4149 — 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::utils::max_distinct_count (cognitive 30) datafusion/physical-plan/src/joins/utils.rs:1202 — 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::build_in_memory (cognitive 29) datafusion/physical-plan/src/joins/hash_join/exec.rs:3229 — datafusion_physical_plan::joins::hash_join::exec::build_in_memory has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (19 pts), boolean chains 5, match/switch 1 (3 pts), loops 1 (2 pts) (nesting depth added 7). 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::joins::join_hash_map::get_matched_indices_with_limit_offset (cognitive 25) datafusion/physical-plan/src/joins/join_hash_map.rs:422 — datafusion_physical_plan::joins::join_hash_map::get_matched_indices_with_limit_offset has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 2 (3 pts), match/switch 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.
  • datafusion_physical_plan::joins::utils::estimate_semi_join_cardinality (cognitive 24) datafusion/physical-plan/src/joins/utils.rs:1134 — 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:2797 — 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::joins::utils::calculate_join_output_ordering (cognitive 23) datafusion/physical-plan/src/joins/utils.rs:162 — 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::utils::estimate_join_cardinality (cognitive 23) datafusion/physical-plan/src/joins/utils.rs:488 — datafusion_physical_plan::joins::utils::estimate_join_cardinality has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (18 pts), match/switch 3 (4 pts), boolean chains 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_physical_plan::projection::try_pushdown_through_join_with_column_indices (cognitive 23) datafusion/physical-plan/src/projection.rs:940 — 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::filter::collect_null_rejecting_columns (cognitive 22) datafusion/physical-plan/src/filter.rs:1334 — datafusion_physical_plan::filter::collect_null_rejecting_columns has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 2 (4 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_physical_plan::joins::hash_join::exec::array_map_key_range (cognitive 21) datafusion/physical-plan/src/joins/hash_join/exec.rs:163 — datafusion_physical_plan::joins::hash_join::exec::array_map_key_range has cognitive complexity 21 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 3 (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.
  • datafusion_physical_plan::joins::hash_join::not_in::mark_null_candidates_for_probe_batch (cognitive 21) datafusion/physical-plan/src/joins/hash_join/not_in.rs:826 — datafusion_physical_plan::joins::hash_join::not_in::mark_null_candidates_for_probe_batch has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9, match/switch 5 (9 pts), loops 1 (2 pts), 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.
  • datafusion_physical_plan::joins::utils::build_batch_from_indices (cognitive 21) datafusion/physical-plan/src/joins/utils.rs:1480 — 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:1277 — 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:371 — 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::joins::utils::estimate_join_null_counts (cognitive 19) datafusion/physical-plan/src/joins/utils.rs:884 — datafusion_physical_plan::joins::utils::estimate_join_null_counts has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 3, match/switch 1 (2 pts), 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.
  • datafusion_physical_plan::projection::try_collapse_projection_chain (cognitive 19) datafusion/physical-plan/src/projection.rs:1381 — 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::filter::like_selectivity (cognitive 18) datafusion/physical-plan/src/filter.rs:1460 — datafusion_physical_plan::filter::like_selectivity has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (17 pts), 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.
  • datafusion_physical_plan::joins::utils::estimate_disjoint_inputs (cognitive 17) datafusion/physical-plan/src/joins/utils.rs:1047 — 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.
D3 · God Classes · TooManyMethods · ×21
  • TooManyMethods: SqlToRel datafusion/sql/src/planner.rs:442 — TooManyMethods — 147 methods, declared across 19 files: src/statement.rs (29), expr/mod.rs (28), src/select.rs (20), src/planner.rs (12), +15 more file(s). The bar is 30 methods; this is 117 over it, 4.90× 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:281 — 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:44 — 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:393 — TooManyMethods — 89 methods. The bar is 30 methods; this is 59 over it, 2.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: LogicalPlanBuilder datafusion/expr/src/logical_plan/builder.rs:208 — TooManyMethods — 70 methods. The bar is 30 methods; this is 40 over it, 2.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: SessionState datafusion/core/src/execution/session_state.rs:133 — TooManyMethods — 66 methods. The bar is 30 methods; this is 36 over it, 2.20× 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:220 — 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: SessionStateBuilder datafusion/core/src/execution/session_state.rs:1156 — 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: SessionConfig datafusion/execution/src/config.rs:80 — TooManyMethods — 62 methods. The bar is 30 methods; this is 32 over it, 2.07× 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: EquivalenceProperties datafusion/physical-expr/src/equivalence/properties/mod.rs:375 — 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:314 — 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:102 — TooManyMethods — 51 methods. The bar is 30 methods; this is 21 over it, 1.70× 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:269 — 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: AggregateExec datafusion/physical-plan/src/aggregates/mod.rs:864 — TooManyMethods — 46 methods, declared across 2 files: aggregates/mod.rs (38), aggregates/optimizations.rs (8). The bar is 30 methods; this is 16 over it, 1.53× 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: MaterializingSortMergeJoinStream datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs:340 — 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: Interval datafusion/expr-common/src/interval_arithmetic.rs:165 — 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:70 — 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: ListingTable datafusion/catalog-listing/src/table.rs:173 — TooManyMethods — 32 methods. The bar is 30 methods; this is 2 over it, 1.07× 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: BitwiseSortMergeJoinStream datafusion/physical-plan/src/joins/sort_merge_join/bitwise_stream.rs:239 — TooManyMethods — 32 methods. The bar is 30 methods; this is 2 over it, 1.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.
  • TooManyMethods: ExternalSorter datafusion/physical-plan/src/sorts/sort.rs:250 — TooManyMethods — 32 methods. The bar is 30 methods; this is 2 over it, 1.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.
  • TooManyMethods: SelectBuilder datafusion/sql/src/unparser/ast.rs:126 — 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.
D35 · Change Coupling · Change coupling · ×21
  • Change coupling: file_format.rs ↔ from_proto.rs datafusion/datasource-parquet/src/file_format.rs:1 — `datafusion/datasource-parquet/src/file_format.rs` and `datafusion/proto-models/src/from_proto.rs` change together 83% of the time (10 of the 12 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 10 shared commits counted here, the most recent 3 are `b43e8e86` feat: exact reverse scan for parquet sort pushdown (#27079); `d89a85d3` fix: validate parquet.coerce_int96_tz when it is set. (#26420); `96eb0dfd` fix: validate parquet encoding when configured (#25784) — run `git show` on any of them.
  • Change coupling: avro.rs ↔ csv.rs datafusion/core/src/datasource/physical_plan/avro.rs:1 — `datafusion/core/src/datasource/physical_plan/avro.rs` and `datafusion/core/src/datasource/physical_plan/csv.rs` change together 75% of the time (9 of the 12 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: csv.rs ↔ json.rs datafusion/core/src/datasource/file_format/csv.rs:1 — `datafusion/core/src/datasource/file_format/csv.rs` and `datafusion/core/src/datasource/file_format/json.rs` change together 74% of the time (20 of the 27 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 20 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:1 — `datafusion/proto-common/src/from_proto/mod.rs` and `datafusion/proto/src/logical_plan/file_formats.rs` change together 72% of the time (28 of the 39 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 28 shared commits counted here, the most recent 3 are `5e5d79d3` introduce optional rle reads from parquet (#24227); `1b7f4035` feat: Add option to assign Parquet row groups to file ranges by midpo…; `54f5cf16` fix(proto): check integer conversions in common options and constrain… — run `git show` on any of them.
  • Change coupling: from_proto.rs ↔ to_proto.rs datafusion/proto/src/physical_plan/from_proto.rs:1 — `datafusion/proto/src/physical_plan/from_proto.rs` and `datafusion/proto/src/physical_plan/to_proto.rs` change together 69% of the time (73 of the 106 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 73 shared commits counted here, the most recent 3 are `9c626cd7` feat: allow extension `PhysicalExpr`s to decode via a per-type regist…; `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… — run `git show` on any of them.
  • Change coupling: mod.rs ↔ file_formats.rs datafusion/proto-common/src/to_proto/mod.rs:1 — `datafusion/proto-common/src/to_proto/mod.rs` and `datafusion/proto/src/logical_plan/file_formats.rs` change together 67% of the time (26 of the 39 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 `5e5d79d3` introduce optional rle reads from parquet (#24227); `1b7f4035` feat: Add option to assign Parquet row groups to file ranges by midpo…; `aa38d3c6` feat(pruning): expose pruning predicate IN-list rewrite size cap as a… — run `git show` on any of them.
  • Change coupling: source.rs ↔ test_util.rs datafusion/datasource-csv/src/source.rs:1 — `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: csv.rs ↔ json.rs datafusion/core/src/datasource/physical_plan/csv.rs:1 — `datafusion/core/src/datasource/physical_plan/csv.rs` and `datafusion/core/src/datasource/physical_plan/json.rs` change together 59% of the time (19 of the 32 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 19 shared commits counted here, the most recent 3 are `6eb8d45c` Let `FileScanConfig` own a list of `ProjectionExpr`s (#18253); `3af31caa` Migrate datasource tests to insta (#15258); `1ae06a49` Rename `DataSource` and `FileSource` fields for consistency (#14898) — 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:1 — `datafusion/physical-plan/src/aggregates/grouped_hash_stream.rs` and `datafusion/physical-plan/src/aggregates/grouped_topk_stream.rs` change together 58% of the time (7 of the 12 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: avro.rs ↔ parquet.rs datafusion/core/src/datasource/physical_plan/avro.rs:1 — `datafusion/core/src/datasource/physical_plan/avro.rs` and `datafusion/core/src/datasource/physical_plan/parquet.rs` change together 58% of the time (7 of the 12 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 `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: expr_schema.rs ↔ tree_node.rs datafusion/expr/src/expr_schema.rs:1 — `datafusion/expr/src/expr_schema.rs` and `datafusion/expr/src/tree_node.rs` change together 57% of the time (25 of the 44 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 25 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: hash_table.rs ↔ heap.rs datafusion/physical-plan/src/aggregates/topk/hash_table.rs:1 — `datafusion/physical-plan/src/aggregates/topk/hash_table.rs` and `datafusion/physical-plan/src/aggregates/topk/heap.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 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 6 shared commits counted here, the most recent 3 are `6663e434` perf: Concretely typed TopK StringHeap, and StringHashTable slot reus…; `c81e7070` perf: Concretely typed TopK ArrowHashTable storage (#23609); `07e63edf` Fix TopK aggregation for UTF-8/Utf8View group keys and add safe fallb… — run `git show` on any of them.
  • Change coupling: json.rs ↔ parquet.rs datafusion/core/src/datasource/file_format/json.rs:1 — `datafusion/core/src/datasource/file_format/json.rs` and `datafusion/core/src/datasource/file_format/parquet.rs` change together 52% of the time (14 of the 27 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 14 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: lib.rs ↔ to_proto.rs datafusion/functions-aggregate/src/lib.rs:1 — `datafusion/functions-aggregate/src/lib.rs` and `datafusion/proto/src/physical_plan/to_proto.rs` change together 50% of the time (15 of the 30 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:1 — `datafusion/expr-common/src/type_coercion/aggregates.rs` and `datafusion/functions-aggregate/src/lib.rs` change together 50% of the time (15 of the 30 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: listing_schema.rs ↔ listing_table_factory.rs datafusion/catalog/src/listing_schema.rs:1 — `datafusion/catalog/src/listing_schema.rs` and `datafusion/core/src/datasource/listing_table_factory.rs` change together 50% of the time (7 of the 14 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 7 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:1 — `datafusion/catalog/src/listing_schema.rs` and `datafusion/sql/src/statement.rs` change together 50% of the time (7 of the 14 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 7 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: mod.rs ↔ partial.rs datafusion/physical-plan/src/aggregates/mod.rs:1 — `datafusion/physical-plan/src/aggregates/mod.rs` and `datafusion/physical-plan/src/aggregates/order/partial.rs` change together 50% of the time (6 of the 12 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: cte_worktable.rs ↔ REDACTED datafusion/catalog/src/cte_worktable.rs:1 — `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:1 — `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: source.rs ↔ test_util.rs datafusion/datasource-arrow/src/source.rs:1 — `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.
D15 · Churn × Complexity Hotspots · Repeated repair · ×20
  • Repeated repair: datafusion/physical-plan/src/sorts/sort.rs datafusion/physical-plan/src/sorts/sort.rs:1905 — datafusion/physical-plan/src/sorts/sort.rs changed 19 times in last 90 days and 11 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 SortExec::execute at line 1905), AT OR 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: leave memory for others when a spilled sort merges its runs (#26264)”; “fix: split multi-column sort runs into smaller batches under a memory limit (#26953)”; “fix: count the largest capacity seen for a shared buffer address (#27097)”; “fix: give each SortExec reset_state copy its own TopK dynamic filter (revert #26670) (#27142)”. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +00:00' --full-history --no-merges -- datafusion/physical-plan/src/sorts/sort.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/filter.rs datafusion/physical-plan/src/filter.rs:491 — datafusion/physical-plan/src/filter.rs changed 18 times in last 90 days and 10 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 FilterExec::statistics_under_fetch at line 491), AT OR 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: “Revert #25790 (Decimal filter selectivity) due to TPC-H Q18 regression (#27145)”; “fix: use null counts to estimate IS NULL and IS NOT NULL (#25648)”; “fix: use NDV for unresolved scalar subquery selectivity instead of 20% fallback (#25719)”; “fix: keep file order for scans that advertise an output ordering (#26434)”. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +00:00' --full-history --no-merges -- datafusion/physical-plan/src/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.
  • Repeated repair: datafusion/physical-plan/src/joins/sort_merge_join/bitwise_stream.rs datafusion/physical-plan/src/joins/sort_merge_join/bitwise_stream.rs:1192 — datafusion/physical-plan/src/joins/sort_merge_join/bitwise_stream.rs changed 9 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is BitwiseSortMergeJoinStream::join at line 1192), AT OR 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(smj): compare all key types across batch boundaries in semi/anti/mark joins (#26830)”; “fix: evaluate sort-merge join filters that reference no columns (#26010)”; “fix: charge semi/anti sort-merge join key groups by their sliced size (#25933)”; “fix: release semi/anti/mark sort-merge join reservations before the final output (#25986)”. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +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/physical-expr/src/equivalence/class.rs datafusion/physical-expr/src/equivalence/class.rs:920 — datafusion/physical-expr/src/equivalence/class.rs changed 11 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 10 (its worst body is EquivalenceGroup::exprs_equal at line 920), AT OR 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 constant equivalence properties through projection (#27123)”; “fix: retain only valid orderings after order-preserving repartition (#26747)”; “fix: treat an uncorrelated scalar subquery as a constant in ordering checks (#26836)”; “fix: keep a constant sort key when a projection reads a duplicate alias (#26397)”. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +00:00' --full-history --no-merges -- datafusion/physical-expr/src/equivalence/class.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/datasource/src/file_scan_config/mod.rs datafusion/datasource/src/file_scan_config/mod.rs:786 — datafusion/datasource/src/file_scan_config/mod.rs changed 10 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 9 (its worst body is FileScanConfig::fmt_as at line 786), AT OR 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: declare Hive partitioned scans as Range (#25279)”; “fix: include nulls in file ordering bounds (#26280)”; “fix: keep file order for scans that advertise an output ordering (#26434)”; “fix: derive scan equivalences only from filters the source applies exactly (#25780)”. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +00:00' --full-history --no-merges -- datafusion/datasource/src/file_scan_config/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.
  • Repeated repair: datafusion/physical-plan/src/sorts/streaming_merge.rs datafusion/physical-plan/src/sorts/streaming_merge.rs:225 — datafusion/physical-plan/src/sorts/streaming_merge.rs changed 8 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 6 (its worst body is StreamingMergeBuilder::build at line 225), AT OR 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: leave memory for others when a spilled sort merges its runs (#26264)”; “fix: split multi-column sort runs into smaller batches under a memory limit (#26953)”; “fix: size aggregate spill batches by bytes as well as rows (#25853)”; “Fix GroupValues retained memory accounting (#25188)”. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +00:00' --full-history --no-merges -- datafusion/physical-plan/src/sorts/streaming_merge.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/aggregates/group_values/row.rs datafusion/physical-plan/src/aggregates/group_values/row.rs:328 — datafusion/physical-plan/src/aggregates/group_values/row.rs changed 9 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 11 (its worst body is datafusion_physical_plan::aggregates::group_values::row::encode_array_if_necessary at line 328), AT OR 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: release clustered aggregate table capacity after emitting completed groups on memory pressure (#26726)”; “Fix GroupValues retained memory accounting (#25188)”; “fix: clear_shrink(0) on rows should reset to original size + single group by fixes in clear_shrink (#25914)”; “fix: support zero-field struct group keys in aggregate emit (#25282)”. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +00:00' --full-history --no-merges -- datafusion/physical-plan/src/aggregates/group_values/row.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:703 — datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs changed 9 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 14 (its worst body is MaterializingSortMergeJoinStream::join at line 703), AT OR 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: evaluate sort-merge join filters that reference no columns (#26010)”; “fix: allow NULL-padded rows in sort-merge join filter evaluation (#26027)”; “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)”. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +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/optimizer/src/utils.rs datafusion/optimizer/src/utils.rs:68 — datafusion/optimizer/src/utils.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 6 (its worst body is datafusion_optimizer::utils::is_duplicate_insensitive_aggregate at line 68), AT OR 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: keep constant filters above grand totals (#27117)”; “fix: use session timezone for timestamp subtraction and comparison (#25094)”; “fix: respect volatility for all function expressions (#25511)”; “fix: preserve MERGE target qualifier bindings (#24429)”. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +00:00' --full-history --no-merges -- datafusion/optimizer/src/utils.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/datasource-csv/src/file_format.rs datafusion/datasource-csv/src/file_format.rs:526 — datafusion/datasource-csv/src/file_format.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 14 (its worst body is CsvFormat::infer_schema_from_stream at line 526), AT OR 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(proto): preserve CSV sink writer options (#25058)”; “fix: return an error for an invalid CSV null_regex instead of panicking (#25261)”; “fix(proto): check integer conversions in common options and constraints (#24726)”; “fix: reject duplicate field names during CSV and Parquet schema inference (#24387)”. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +00:00' --full-history --no-merges -- datafusion/datasource-csv/src/file_format.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/sorts/stream.rs datafusion/physical-plan/src/sorts/stream.rs:411 — datafusion/physical-plan/src/sorts/stream.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 10 (its worst body is IncrementalSortIterator::next at line 411), AT OR 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: size aggregate spill batches by bytes as well as rows (#25853)”; “fix: avoid quadratic row-buffer accounting in sort merges (#26366)”; “fix: Account for buffered rows in `RowCursorStream` (#25372)”; “fix: report correct number of items left in the iterator for `IncrementalSortIterator` (#25107)”. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +00:00' --full-history --no-merges -- datafusion/physical-plan/src/sorts/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/expr-common/src/interval_arithmetic.rs datafusion/expr-common/src/interval_arithmetic.rs:1034 — datafusion/expr-common/src/interval_arithmetic.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 13 (its worst body is datafusion_expr_common::interval_arithmetic::apply_operator at line 1034), AT OR 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: “Revert #25790 (Decimal filter selectivity) due to TPC-H Q18 regression (#27145)”; “fix: handle zero endpoints in division interval bounds (#25985)”; “fix: avoid query failures from inferred numeric cast bounds (#25528)”; “fix: preserve unbounded multiplication interval endpoints (#25795)”. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +00:00' --full-history --no-merges -- datafusion/expr-common/src/interval_arithmetic.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/parquet_config.rs datafusion/common/src/parquet_config.rs:295 — datafusion/common/src/parquet_config.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 11 (its worst body is DFParquetEncoding::from_str at line 295), AT OR 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 encoding when configured (#25784)”; “fix: validate parquet.coerce_int96 when it is set (#25628)”; “fix: validate parquet.compression when it is set (#25626)”; “fix: validate parquet statistics config (#24642)”. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +00:00' --full-history --no-merges -- datafusion/common/src/parquet_config.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/unnest.rs datafusion/physical-plan/src/unnest.rs:612 — datafusion/physical-plan/src/unnest.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 UnnestStream::poll_next_impl at line 612), AT OR 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 nulls when unnesting structs (#25389)”; “fix(proto): check plan integer conversions across usize boundaries (#24483)”; “fix: count UnnestExec output batches after splitting (#24482)”; “fix: make UnnestExec respect datafusion.execution.batch_size (#24384)”. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +00:00' --full-history --no-merges -- datafusion/physical-plan/src/unnest.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/aggregates/group_values/single_group_by/primitive.rs datafusion/physical-plan/src/aggregates/group_values/single_group_by/primitive.rs:122 — datafusion/physical-plan/src/aggregates/group_values/single_group_by/primitive.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 5 (its worst body is GroupValuesPrimitive::intern at line 122), AT OR 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: release clustered aggregate table capacity after emitting completed groups on memory pressure (#26726)”; “fix(physical-plan): replace approximate map_size accounting with exac… (#25825)”; “Fix GroupValues retained memory accounting (#25188)”; “fix: clear_shrink(0) on rows should reset to original size + single group by fixes in clear_shrink (#25914)”. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +00:00' --full-history --no-merges -- datafusion/physical-plan/src/aggregates/group_values/single_group_by/primitive.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/average.rs datafusion/functions-aggregate/src/average.rs:279 — datafusion/functions-aggregate/src/average.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 7 (its worst body is Avg::accumulator at line 279), AT OR 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +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-aggregate/src/bit_and_or_xor.rs datafusion/functions-aggregate/src/bit_and_or_xor.rs:246 — datafusion/functions-aggregate/src/bit_and_or_xor.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 4 (its worst body is BitwiseOperation::state_fields at line 246), AT OR 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: return NULL from `bit_xor` when a sliding frame has no non-NULL values (#26485)”; “fix: reject groups accumulator for NULL-typed bitwise aggregates (#25687)”; “Fix panic from `avg(x ORDER BY y)` (and more) (#25711)”; “fix: reject groups accumulator for bit_xor(DISTINCT) (#24989)”. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +00:00' --full-history --no-merges -- datafusion/functions-aggregate/src/bit_and_or_xor.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/math/log.rs datafusion/functions/src/math/log.rs:260 — datafusion/functions/src/math/log.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 LogFunc::invoke_with_args at line 260), AT OR 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 precision in log() with mixed-width float arguments (#23676)”; “fix(functions): prevent invalid sort omission in log monotonicity when base <= 1 (#25746)”; “fix: preserve nested log and power results (#25138)”. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +00:00' --full-history --no-merges -- datafusion/functions/src/math/log.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:429 — datafusion/functions/src/regex/regexplike.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_functions::regex::regexplike::handle_regexp_like at line 429), AT OR 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)”. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +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/functions-nested/src/cosine_distance.rs datafusion/functions-nested/src/cosine_distance.rs:148 — datafusion/functions-nested/src/cosine_distance.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 15 (its worst body is datafusion_functions_nested::cosine_distance::general_cosine_distance at line 148), AT OR 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: clamp cosine_distance to enforce metric non-negativity and boundedness [0.0, 2.0] (#25744)”; “fix: avoid overflow and underflow in vector functions (#25289)”; “chore: fix the remaining malformed example tables in function docs (#24596)”. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 14:26:28 +00:00' --until='2026-11-14 14:26:28 +00:00' --full-history --no-merges -- datafusion/functions-nested/src/cosine_distance.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_functions · ×19
  • datafusion_functions::regex::regexpcount::regexp_count_inner (cognitive 43) datafusion/functions/src/regex/regexpcount.rs:248 — 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:290 — 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:364 — 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:460 — 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:349 — 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 26) datafusion/functions/src/regex/regexpreplace.rs:400 — datafusion_functions::regex::regexpreplace::regexp_replace has cognitive complexity 26 (threshold 15). Drivers by points: match/switch 9 (19 pts), if/else 3 (7 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::unicode::pad::pad_impl (cognitive 25) datafusion/functions/src/unicode/pad.rs:383 — datafusion_functions::unicode::pad::pad_impl has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 2 (5 pts), match/switch 1 (3 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.
  • datafusion_functions::string::common::string_view_trim (cognitive 24) datafusion/functions/src/string/common.rs:124 — 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:593 — 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:461 — 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:165 — 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::core::getfield::simplify_get_field_over_struct_constructor (cognitive 20) datafusion/functions/src/core/getfield.rs:181 — 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:630 — 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::string::repeat::repeat_impl (cognitive 20) datafusion/functions/src/string/repeat.rs:292 — 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::datetime::common::string_to_datetime_formatted (cognitive 19) datafusion/functions/src/datetime/common.rs:93 — 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::string::concat::simplify_concat (cognitive 18) datafusion/functions/src/string/concat.rs:296 — 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::utils::map_lookup (cognitive 18) datafusion/functions/src/utils.rs:362 — 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::chr::chr_array (cognitive 17) datafusion/functions/src/string/chr.rs:22 — 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::pad::pad_scalar_ascii (cognitive 16) datafusion/functions/src/unicode/pad.rs:208 — datafusion_functions::unicode::pad::pad_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 (15 lines × 2) · ×19
  • Duplicated block (15 lines × 2) REDACTED:1503 — REDACTED:1503-1517 | REDACTED:1518-1532 — 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:315 — datafusion/ffi/src/proto/logical_extension_codec.rs:315-329 | datafusion/ffi/src/proto/physical_extension_codec.rs:301-315 — 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 124 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/ffi/src/proto/logical_extension_codec.rs:315` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) datafusion/functions-aggregate/src/array_agg.rs:709 — datafusion/functions-aggregate/src/array_agg.rs:709-723 | datafusion/functions-aggregate/src/array_agg.rs:1101-1115 — 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/first_last.rs:1455 — datafusion/functions-aggregate/src/first_last.rs:1455-1469 | datafusion/functions-aggregate/src/first_last.rs:1843-1857 — 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:709 — datafusion/functions-aggregate/src/min_max.rs:709-723 | datafusion/functions-aggregate/src/min_max.rs:837-851 — 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:239 — datafusion/functions-aggregate/src/nth_value.rs:239-253 | datafusion/functions-aggregate/src/nth_value.rs:414-428 — 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:458 — datafusion/functions-nested/src/remove.rs:458-472 | datafusion/functions-nested/src/replace.rs:448-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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/functions-nested/src/remove.rs:458` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 2) datafusion/functions-nested/src/replace.rs:82 — datafusion/functions-nested/src/replace.rs:82-96 | datafusion/functions-nested/src/replace.rs:308-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 (15 lines × 2) datafusion/functions/src/math/ceil.rs:125 — datafusion/functions/src/math/ceil.rs:125-139 | datafusion/functions/src/math/floor.rs:171-185 — 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/src/regex/regexpcount.rs:390 — datafusion/functions/src/regex/regexpcount.rs:390-404 | datafusion/functions/src/regex/regexpcount.rs:463-477 — 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:872 — datafusion/physical-expr/src/expressions/case.rs:872-886 | datafusion/physical-expr/src/expressions/case.rs:959-973 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-expr/src/expressions/case.rs:872` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) datafusion/physical-plan/src/aggregates/aggregate_hash_table/common.rs:210 — datafusion/physical-plan/src/aggregates/aggregate_hash_table/common.rs:210-224 | datafusion/physical-plan/src/aggregates/aggregate_hash_table/common_clustered.rs:242-256 — before extracting anything, compare `datafusion/physical-plan/src/aggregates/aggregate_hash_table/common.rs` and `datafusion/physical-plan/src/aggregates/aggregate_hash_table/common_clustered.rs` as WHOLE FILES: this scan already matched 4 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/aggregates/aggregate_hash_table/common.rs:210` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) datafusion/physical-plan/src/aggregates/group_values/multi_group_by/boolean.rs:105 — datafusion/physical-plan/src/aggregates/group_values/multi_group_by/boolean.rs:105-119 | datafusion/physical-plan/src/aggregates/group_values/multi_group_by/primitive.rs:199-213 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/aggregates/group_values/multi_group_by/boolean.rs:105` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) datafusion/physical-plan/src/coop.rs:375 — datafusion/physical-plan/src/coop.rs:375-389 | datafusion/physical-plan/src/projection.rs:610-624 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/coop.rs:375` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) datafusion/physical-plan/src/joins/hash_join/exec.rs:1929 — datafusion/physical-plan/src/joins/hash_join/exec.rs:1929-1943 | datafusion/physical-plan/src/joins/symmetric_hash_join.rs:625-639 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/joins/hash_join/exec.rs:1929` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) datafusion/physical-plan/src/sorts/partial_sort.rs:319 — datafusion/physical-plan/src/sorts/partial_sort.rs:319-333 | datafusion/physical-plan/src/sorts/sort.rs:1767-1781 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/sorts/partial_sort.rs:319` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `f` to `&mut std::fmt::Formatter` in one and `&mut Formatter` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (15 lines × 2) datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs:325 — datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs:325-339 | datafusion/physical-plan/src/windows/window_agg_exec.rs:138-152 — 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 7 separate duplicated blocks between them, totalling at least 68 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (15 lines × 2) datafusion/functions-aggregate/src/covariance.rs:92 — datafusion/functions-aggregate/src/covariance.rs:92-106 | datafusion/functions-aggregate/src/covariance.rs:182-196 — 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/macros/src/user_doc.rs:126 — datafusion/macros/src/user_doc.rs:126-140 | datafusion/macros/src/user_doc.rs:142-156 — 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 · Edited copy of a member (15 corresponding lines) · ×18
  • Edited copy of a member (15 corresponding lines) datafusion/functions-nested/src/array_add.rs:104 — datafusion/functions-nested/src/array_add.rs:104-118 | datafusion/functions-nested/src/array_subtract.rs:103-117 — These two members are one piece of code written twice and then edited apart: 15 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.
  • Edited copy of a member (15 corresponding lines) datafusion/physical-expr/src/equivalence/properties/mod.rs:734 — datafusion/physical-expr/src/equivalence/properties/mod.rs:734-748 | datafusion/physical-expr/src/equivalence/properties/mod.rs:802-824 — These two members are one piece of code written twice and then edited apart: 15 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.
  • Edited copy of a member (15 corresponding lines) datafusion/functions-nested/src/map_keys.rs:95 — datafusion/functions-nested/src/map_keys.rs:95-110 | datafusion/functions-nested/src/map_values.rs:105-119 — These two members are one piece of code written twice and then edited apart: 15 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.
  • Edited copy of a member (15 corresponding lines) datafusion/ffi/src/session/mod.rs:213 — datafusion/ffi/src/session/mod.rs:213-228 | datafusion/ffi/src/session/mod.rs:246-260 — These two members are one piece of code written twice and then edited apart: 15 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.
  • Edited copy of a member (15 corresponding lines) datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:219 — datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:219-233 | datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:299-317 — These two members are one piece of code written twice and then edited apart: 15 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.
  • Edited copy of a member (15 corresponding lines) datafusion/expr/src/logical_plan/information_schema.rs:674 — datafusion/expr/src/logical_plan/information_schema.rs:674-690 | datafusion/expr/src/logical_plan/information_schema.rs:788-802 — These two members are one piece of code written twice and then edited apart: 15 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.
  • Edited copy of a member (15 corresponding lines) datafusion/expr/src/expr_fn.rs:911 — datafusion/expr/src/expr_fn.rs:911-925 | datafusion/expr/src/expr_fn.rs:951-965 — These two members are one piece of code written twice and then edited apart: 15 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.
  • Edited copy of a member (15 corresponding lines) datafusion/functions-aggregate/src/first_last.rs:1399 — datafusion/functions-aggregate/src/first_last.rs:1399-1417 | datafusion/functions-aggregate/src/first_last.rs:1789-1803 — These two members are one piece of code written twice and then edited apart: 15 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.
  • Edited copy of a member (15 corresponding lines) datafusion/physical-plan/src/aggregates/group_values/multi_group_by/boolean.rs:53 — datafusion/physical-plan/src/aggregates/group_values/multi_group_by/boolean.rs:53-67 | datafusion/physical-plan/src/aggregates/group_values/multi_group_by/primitive.rs:158-175 — These two members are one piece of code written twice and then edited apart: 15 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.
  • Edited copy of a member (15 corresponding lines) datafusion/functions/src/strings.rs:84 — datafusion/functions/src/strings.rs:84-98 | datafusion/functions/src/strings.rs:291-305 — These two members are one piece of code written twice and then edited apart: 15 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.
  • Edited copy of a member (15 corresponding lines) datafusion/substrait/src/logical_plan/producer/expr/field_reference.rs:33 — datafusion/substrait/src/logical_plan/producer/expr/field_reference.rs:33-47 | datafusion/substrait/src/logical_plan/producer/expr/lambda_variable.rs:21-36 — These two members are one piece of code written twice and then edited apart: 15 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.
  • Edited copy of a member (15 corresponding lines) datafusion/functions/src/crypto/md5.rs:53 — datafusion/functions/src/crypto/md5.rs:53-67 | datafusion/functions/src/crypto/sha.rs:108-124 — These two members are one piece of code written twice and then edited apart: 15 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.
  • Edited copy of a member (15 corresponding lines) datafusion/common/src/config.rs:144 — datafusion/common/src/config.rs:144-2262 | datafusion/common/src/config.rs:3492-3812 — These two members are one piece of code written twice and then edited apart: 15 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.
  • Edited copy of a member (15 corresponding lines) datafusion/datasource-parquet/src/reader.rs:119 — datafusion/datasource-parquet/src/reader.rs:119-133 | datafusion/datasource-parquet/src/reader.rs:167-183 — These two members are one piece of code written twice and then edited apart: 15 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.
  • Edited copy of a member (15 corresponding lines) datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs:516 — datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs:516-530 | datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs:548-570 — These two members are one piece of code written twice and then edited apart: 15 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.
  • Edited copy of a member (15 corresponding lines) datafusion/physical-plan/src/aggregates/order/partial.rs:126 — datafusion/physical-plan/src/aggregates/order/partial.rs:126-142 | datafusion/physical-plan/src/aggregates/order/full.rs:69-83 — These two members are one piece of code written twice and then edited apart: 15 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.
  • Edited copy of a member (15 corresponding lines) datafusion/expr-common/src/operator.rs:206 — datafusion/expr-common/src/operator.rs:206-222 | datafusion/pruning/src/pruning_predicate.rs:1318-1332 — These two members are one piece of code written twice and then edited apart: 15 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.
  • Edited copy of a member (15 corresponding lines) datafusion/physical-plan/src/test.rs:447 — datafusion/physical-plan/src/test.rs:447-463 | datafusion/physical-plan/src/test.rs:469-483 — These two members are one piece of code written twice and then edited apart: 15 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 (12 corresponding lines) · ×18
  • Edited copy of a member (12 corresponding lines) datafusion/common/src/utils/mod.rs:150 — datafusion/common/src/utils/mod.rs:150-161 | datafusion/common/src/utils/mod.rs:200-211 — These two members are one piece of code written twice and then edited apart: 12 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.
  • Edited copy of a member (12 corresponding lines) datafusion/expr/src/logical_plan/information_schema.rs:79 — datafusion/expr/src/logical_plan/information_schema.rs:79-90 | datafusion/expr/src/logical_plan/information_schema.rs:149-160 — These two members are one piece of code written twice and then edited apart: 12 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.
  • Edited copy of a member (12 corresponding lines) datafusion/physical-plan/src/projection.rs:1141 — datafusion/physical-plan/src/projection.rs:1141-1152 | datafusion/physical-plan/src/projection.rs:1159-1170 — These two members are one piece of code written twice and then edited apart: 12 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.
  • Edited copy of a member (12 corresponding lines) datafusion/functions/src/string/split_part.rs:415 — datafusion/functions/src/string/split_part.rs:415-426 | datafusion/functions/src/unicode/substrindex.rs:553-567 — These two members are one piece of code written twice and then edited apart: 12 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.
  • Edited copy of a member (12 corresponding lines) datafusion/physical-plan/src/filter.rs:276 — datafusion/physical-plan/src/filter.rs:276-290 | datafusion/physical-plan/src/filter.rs:971-982 — These two members are one piece of code written twice and then edited apart: 12 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.
  • Edited copy of a member (12 corresponding lines) datafusion/functions/src/string/split_part.rs:394 — datafusion/functions/src/string/split_part.rs:394-405 | datafusion/functions/src/unicode/substrindex.rs:531-545 — These two members are one piece of code written twice and then edited apart: 12 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.
  • Edited copy of a member (12 corresponding lines) datafusion/optimizer/src/push_down_filter.rs:1637 — datafusion/optimizer/src/push_down_filter.rs:1637-1648 | datafusion/optimizer/src/push_down_filter.rs:1659-1670 — These two members are one piece of code written twice and then edited apart: 12 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.
  • Edited copy of a member (12 corresponding lines) datafusion/physical-expr/src/physical_expr.rs:30 — datafusion/physical-expr/src/physical_expr.rs:30-41 | datafusion/physical-expr/src/utils/mod.rs:298-311 — These two members are one piece of code written twice and then edited apart: 12 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.
  • Edited copy of a member (12 corresponding lines) datafusion/common/src/dfschema.rs:155 — datafusion/common/src/dfschema.rs:155-169 | datafusion/common/src/dfschema.rs:175-186 — These two members are one piece of code written twice and then edited apart: 12 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.
  • Edited copy of a member (12 corresponding lines) datafusion/physical-plan/src/sorts/cursor.rs:639 — datafusion/physical-plan/src/sorts/cursor.rs:639-650 | datafusion/physical-plan/src/sorts/cursor.rs:653-665 — These two members are one piece of code written twice and then edited apart: 12 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.
  • Edited copy of a member (12 corresponding lines) datafusion/core/src/execution/context/mod.rs:975 — datafusion/core/src/execution/context/mod.rs:975-988 | datafusion/datasource/src/file_format.rs:42-53 — These two members are one piece of code written twice and then edited apart: 12 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.
  • Edited copy of a member (12 corresponding lines) datafusion/functions-aggregate-common/src/utils.rs:197 — datafusion/functions-aggregate-common/src/utils.rs:197-208 | datafusion/functions-aggregate/src/percentile_cont.rs:930-943 — These two members are one piece of code written twice and then edited apart: 12 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.
  • Edited copy of a member (12 corresponding lines) datafusion/physical-plan/src/coop.rs:271 — datafusion/physical-plan/src/coop.rs:271-282 | datafusion/physical-plan/src/union.rs:777-791 — These two members are one piece of code written twice and then edited apart: 12 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.
  • Edited copy of a member (12 corresponding lines) datafusion/functions-aggregate/src/bool_and_or.rs:150 — datafusion/functions-aggregate/src/bool_and_or.rs:150-161 | datafusion/functions-aggregate/src/bool_and_or.rs:284-296 — These two members are one piece of code written twice and then edited apart: 12 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.
  • Edited copy of a member (12 corresponding lines) datafusion/physical-plan/src/aggregates/group_values/multi_group_by/boolean.rs:158 — datafusion/physical-plan/src/aggregates/group_values/multi_group_by/boolean.rs:158-169 | datafusion/physical-plan/src/aggregates/group_values/multi_group_by/primitive.rs:255-270 — These two members are one piece of code written twice and then edited apart: 12 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.
  • Edited copy of a member (12 corresponding lines) datafusion/physical-expr-common/src/metrics/mod.rs:438 — datafusion/physical-expr-common/src/metrics/mod.rs:438-454 | datafusion/physical-expr-common/src/metrics/mod.rs:458-469 — These two members are one piece of code written twice and then edited apart: 12 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.
  • Edited copy of a member (12 corresponding lines) datafusion/optimizer/src/utils.rs:35 — datafusion/optimizer/src/utils.rs:35-48 | datafusion/optimizer/src/optimize_projections/mod.rs:936-947 — These two members are one piece of code written twice and then edited apart: 12 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.
  • Edited copy of a member (12 corresponding lines) datafusion/physical-expr/src/window/window_expr.rs:133 — datafusion/physical-expr/src/window/window_expr.rs:133-146 | datafusion/physical-expr/src/aggregate.rs:1039-1050 — These two members are one piece of code written twice and then edited apart: 12 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 (7 corresponding lines) · ×18
  • Edited copy of a member (7 corresponding lines) datafusion/functions-aggregate/src/first_last.rs:1526 — datafusion/functions-aggregate/src/first_last.rs:1526-1532 | datafusion/functions-aggregate/src/first_last.rs:1912-1918 — These two members are one piece of code written twice and then edited apart: 7 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.
  • Edited copy of a member (7 corresponding lines) datafusion/physical-plan/src/projection.rs:134 — datafusion/physical-plan/src/projection.rs:134-140 | datafusion/physical-plan/src/projection.rs:161-170 — These two members are one piece of code written twice and then edited apart: 7 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.
  • Edited copy of a member (7 corresponding lines) datafusion/functions-aggregate/src/bit_and_or_xor.rs:449 — datafusion/functions-aggregate/src/bit_and_or_xor.rs:449-455 | datafusion/functions-aggregate/src/bit_and_or_xor.rs:457-465 — These two members are one piece of code written twice and then edited apart: 7 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.
  • Edited copy of a member (7 corresponding lines) datafusion/functions-aggregate-common/src/aggregate/groups_accumulator/prim_op.rs:107 — datafusion/functions-aggregate-common/src/aggregate/groups_accumulator/prim_op.rs:107-113 | datafusion/functions-aggregate/src/first_last/state.rs:97-104 — These two members are one piece of code written twice and then edited apart: 7 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.
  • Edited copy of a member (7 corresponding lines) datafusion/functions-nested/src/min_max.rs:82 — datafusion/functions-nested/src/min_max.rs:82-88 | datafusion/functions-nested/src/min_max.rs:164-170 — These two members are one piece of code written twice and then edited apart: 7 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.
  • Edited copy of a member (7 corresponding lines) datafusion/ffi/src/physical_expr/mod.rs:530 — datafusion/ffi/src/physical_expr/mod.rs:530-536 | datafusion/ffi/src/physical_expr/mod.rs:553-559 — These two members are one piece of code written twice and then edited apart: 7 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.
  • Edited copy of a member (7 corresponding lines) datafusion/functions-aggregate/src/sum.rs:668 — datafusion/functions-aggregate/src/sum.rs:668-681 | datafusion/functions-aggregate/src/count.rs:528-534 — These two members are one piece of code written twice and then edited apart: 7 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.
  • Edited copy of a member (7 corresponding lines) datafusion/functions-aggregate/src/min_max/min_max_bytes.rs:285 — datafusion/functions-aggregate/src/min_max/min_max_bytes.rs:285-292 | datafusion/functions-aggregate/src/min_max/min_max_struct.rs:120-126 — These two members are one piece of code written twice and then edited apart: 7 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.
  • Edited copy of a member (7 corresponding lines) datafusion/physical-expr/src/expressions/cast.rs:643 — datafusion/physical-expr/src/expressions/cast.rs:643-650 | datafusion/physical-expr/src/expressions/try_cast.rs:192-198 — These two members are one piece of code written twice and then edited apart: 7 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.
  • Edited copy of a member (7 corresponding lines) datafusion/physical-plan/src/buffer.rs:322 — datafusion/physical-plan/src/buffer.rs:322-328 | datafusion/physical-plan/src/coalesce_batches.rs:299-308 — These two members are one piece of code written twice and then edited apart: 7 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.
  • Edited copy of a member (7 corresponding lines) datafusion/core/src/dataframe/mod.rs:1352 — datafusion/core/src/dataframe/mod.rs:1352-1358 | datafusion/expr/src/logical_plan/builder.rs:964-970 — These two members are one piece of code written twice and then edited apart: 7 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.
  • Edited copy of a member (7 corresponding lines) datafusion/functions-aggregate/src/covariance.rs:271 — datafusion/functions-aggregate/src/covariance.rs:271-278 | datafusion/functions-aggregate/src/variance.rs:348-354 — These two members are one piece of code written twice and then edited apart: 7 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.
  • Edited copy of a member (7 corresponding lines) datafusion/physical-expr/src/expressions/negative.rs:116 — datafusion/physical-expr/src/expressions/negative.rs:116-122 | datafusion/physical-expr/src/expressions/not.rs:109-115 — These two members are one piece of code written twice and then edited apart: 7 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.
  • Edited copy of a member (7 corresponding lines) REDACTED:503 — REDACTED:503-509 | datafusion/expr-common/src/signature.rs:888-894 — These two members are one piece of code written twice and then edited apart: 7 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.
  • Edited copy of a member (7 corresponding lines) datafusion/core/src/execution/session_state.rs:2285 — datafusion/core/src/execution/session_state.rs:2285-2291 | datafusion/execution/src/task.rs:170-176 — These two members are one piece of code written twice and then edited apart: 7 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.
  • Edited copy of a member (7 corresponding lines) datafusion/core/src/execution/session_state.rs:2304 — datafusion/core/src/execution/session_state.rs:2304-2310 | datafusion/execution/src/task.rs:188-194 — These two members are one piece of code written twice and then edited apart: 7 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.
  • Edited copy of a member (7 corresponding lines) datafusion/core/src/execution/session_state.rs:2312 — datafusion/core/src/execution/session_state.rs:2312-2318 | datafusion/execution/src/task.rs:178-186 — These two members are one piece of code written twice and then edited apart: 7 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.
  • Edited copy of a member (7 corresponding lines) datafusion/physical-expr/src/equivalence/properties/mod.rs:1945 — datafusion/physical-expr/src/equivalence/properties/mod.rs:1945-1951 | datafusion/physical-plan/src/joins/stream_join_utils.rs:245-251 — These two members are one piece of code written twice and then edited apart: 7 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.
D2 · Cognitive Complexity · SqlToRel · ×17
  • SqlToRel::sql_statement_to_plan_with_context_impl (cognitive 237) datafusion/sql/src/statement.rs:254 — SqlToRel::sql_statement_to_plan_with_context_impl has cognitive complexity 237 (threshold 15). Drivers by points: if/else 145 (183 pts), match/switch 23 (50 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:215 — 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::select_to_plan (cognitive 47) datafusion/sql/src/select.rs:89 — SqlToRel::select_to_plan has cognitive complexity 47 (threshold 15). Drivers by points: if/else 25 (30 pts), match/switch 7 (8 pts), loops 4 (5 pts), boolean chains 4 (nesting depth added 7). 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_compound_identifier_to_expr (cognitive 39) datafusion/sql/src/expr/identifier.rs:103 — 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:2586 — 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::insert_to_plan (cognitive 30) datafusion/sql/src/statement.rs:2728 — 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::convert_simple_data_type (cognitive 28) datafusion/sql/src/planner.rs:705 — SqlToRel::convert_simple_data_type has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 5 (10 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.
  • SqlToRel::sql_identifier_to_expr (cognitive 23) datafusion/sql/src/expr/identifier.rs:21 — 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::try_process_group_by_unnest (cognitive 23) datafusion/sql/src/select.rs:910 — 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::sql_compound_field_access_to_expr (cognitive 21) datafusion/sql/src/expr/mod.rs:1382 — SqlToRel::sql_compound_field_access_to_expr has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 5 (9 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.
  • SqlToRel::explain_to_plan (cognitive 21) datafusion/sql/src/statement.rs:2080 — 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:1334 — 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::set_statement_to_plan (cognitive 18) datafusion/sql/src/statement.rs:2199 — 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:143 — 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:761 — 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::sql_expr_to_logical_expr_internal (cognitive 16) datafusion/sql/src/expr/mod.rs:385 — SqlToRel::sql_expr_to_logical_expr_internal has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 6 (10 pts), if/else 2 (4 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.
  • SqlToRel::validate_schema_satisfies_exprs (cognitive 16) datafusion/sql/src/planner.rs:592 — 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.
D2 · Cognitive Complexity · datafusion_optimizer · ×17
  • datafusion_optimizer::decorrelate_predicate_subquery::build_join (cognitive 60) datafusion/optimizer/src/decorrelate_predicate_subquery.rs:870 — datafusion_optimizer::decorrelate_predicate_subquery::build_join has cognitive complexity 60 (threshold 15). Drivers by points: if/else 21 (29 pts), boolean chains 17, match/switch 6 (9 pts), loops 2 (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_optimizer::decorrelate_lateral_join::rewrite_internal (cognitive 40) datafusion/optimizer/src/decorrelate_lateral_join.rs:60 — datafusion_optimizer::decorrelate_lateral_join::rewrite_internal has cognitive complexity 40 (threshold 15). Drivers by points: if/else 24 (30 pts), boolean chains 6, 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::extract_leaf_expressions::split_and_push_projection (cognitive 35) datafusion/optimizer/src/extract_leaf_expressions.rs:1002 — datafusion_optimizer::extract_leaf_expressions::split_and_push_projection has cognitive complexity 35 (threshold 15). Drivers by points: if/else 15 (23 pts), boolean chains 4, loops 2 (4 pts), match/switch 3 (4 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::optimize_projections::optimize_projections (cognitive 34) datafusion/optimizer/src/optimize_projections/mod.rs:123 — 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:699 — datafusion_optimizer::extract_leaf_expressions::build_extraction_projection_impl has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 4 (8 pts), boolean chains 2 (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_optimizer::simplify_expressions::simplify_predicates::find_most_restrictive_predicate (cognitive 30) datafusion/optimizer/src/simplify_expressions/simplify_predicates.rs:433 — 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::extract_leaf_expressions::try_push_into_inputs (cognitive 29) datafusion/optimizer/src/extract_leaf_expressions.rs:1405 — datafusion_optimizer::extract_leaf_expressions::try_push_into_inputs has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (21 pts), loops 3 (5 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.
  • datafusion_optimizer::push_down_filter::push_down_all_join (cognitive 29) datafusion/optimizer/src/push_down_filter.rs:412 — 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::rewrite_limit (cognitive 26) datafusion/optimizer/src/push_down_limit.rs:76 — datafusion_optimizer::push_down_limit::rewrite_limit has cognitive complexity 26 (threshold 15). Drivers by points: if/else 16 (24 pts), boolean chains 1, 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.
  • datafusion_optimizer::push_down_limit::topk_through_join::push_topk_through_join (cognitive 26) datafusion/optimizer/src/push_down_limit/topk_through_join.rs:79 — 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::single_distinct_to_groupby::is_single_distinct_agg (cognitive 24) datafusion/optimizer/src/single_distinct_to_groupby.rs:114 — datafusion_optimizer::single_distinct_to_groupby::is_single_distinct_agg has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 5, loops 2 (5 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_optimizer::decorrelate::filter_exprs_evaluation_result_on_empty_batch (cognitive 20) datafusion/optimizer/src/decorrelate.rs:1362 — datafusion_optimizer::decorrelate::filter_exprs_evaluation_result_on_empty_batch has cognitive complexity 20 (threshold 15). Drivers by points: loops 4 (11 pts), if/else 6 (7 pts), match/switch 1 (2 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.
  • datafusion_optimizer::simplify_expressions::linear_aggregates::rewrite_multiple_linear_aggregates (cognitive 20) datafusion/optimizer/src/simplify_expressions/linear_aggregates.rs:42 — 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:289 — 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:767 — 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::analyzer::type_coercion::coerce_window_frame (cognitive 17) datafusion/optimizer/src/analyzer/type_coercion.rs:1351 — 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::eliminate_cross_join::find_inner_join (cognitive 16) datafusion/optimizer/src/eliminate_cross_join.rs:311 — datafusion_optimizer::eliminate_cross_join::find_inner_join has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 3 (6 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.
D4 · Code Duplication · Duplicated block (14 lines × 2) · ×17
  • Duplicated block (14 lines × 2) datafusion-cli/src/object_storage/instrumented.rs:320 — datafusion-cli/src/object_storage/instrumented.rs:320-333 | datafusion-cli/src/object_storage/instrumented.rs:343-356 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion-cli/src/object_storage/instrumented.rs:320` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) datafusion/functions-nested/src/position.rs:239 — datafusion/functions-nested/src/position.rs:239-252 | datafusion/functions-nested/src/position.rs:535-548 — 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/encoding/inner.rs:77 — datafusion/functions/src/encoding/inner.rs:77-90 | datafusion/functions/src/encoding/inner.rs:150-163 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (14 lines × 2) datafusion/physical-expr-common/src/binary_map.rs:483 — datafusion/physical-expr-common/src/binary_map.rs:483-496 | datafusion/physical-expr-common/src/binary_map.rs:524-537 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-expr-common/src/binary_map.rs:483` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) datafusion/physical-expr/src/expressions/case.rs:898 — datafusion/physical-expr/src/expressions/case.rs:898-911 | datafusion/physical-expr/src/expressions/case.rs:984-997 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-expr/src/expressions/case.rs:898` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `datafusion/physical-expr/src/expressions/case.rs:897` calls `filter_array` and `datafusion/physical-expr/src/expressions/case.rs:983` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (14 lines × 2) datafusion/physical-plan/src/display.rs:590 — datafusion/physical-plan/src/display.rs:590-603 | datafusion/physical-plan/src/display.rs:698-711 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/display.rs:590` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) datafusion/physical-plan/src/joins/hash_join/exec.rs:1502 — datafusion/physical-plan/src/joins/hash_join/exec.rs:1502-1515 | datafusion/physical-plan/src/joins/sort_merge_join/exec.rs:551-564 — `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 34 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/joins/hash_join/exec.rs:1502` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (14 lines × 2) datafusion/physical-plan/src/joins/sort_merge_join/bitwise_stream.rs:411 — datafusion/physical-plan/src/joins/sort_merge_join/bitwise_stream.rs:411-424 | datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs:683-696 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/joins/sort_merge_join/bitwise_stream.rs:411` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs:680` calls `clone`, `baseline_metrics` and `datafusion/physical-plan/src/joins/sort_merge_join/bitwise_stream.rs:409` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (14 lines × 2) datafusion/proto/src/logical_plan/from_proto.rs:348 — datafusion/proto/src/logical_plan/from_proto.rs:348-361 | datafusion/proto/src/logical_plan/from_proto.rs:382-395 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/proto/src/logical_plan/from_proto.rs:348` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) datafusion/sql/src/expr/function.rs:1035 — datafusion/sql/src/expr/function.rs:1035-1048 | datafusion/sql/src/expr/function.rs:1091-1104 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/sql/src/expr/function.rs:1035` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (14 lines × 2) datafusion/sql/src/unparser/plan.rs:383 — datafusion/sql/src/unparser/plan.rs:383-396 | datafusion/sql/src/unparser/plan.rs:1374-1387 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/sql/src/unparser/plan.rs:383` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) datafusion/sqllogictest/src/engines/datafusion_engine/runner.rs:76 — datafusion/sqllogictest/src/engines/datafusion_engine/runner.rs:76-89 | datafusion/sqllogictest/src/engines/datafusion_substrait_roundtrip_engine/runner.rs:66-79 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (14 lines × 2) datafusion/functions/src/crypto/basic.rs:118 — datafusion/functions/src/crypto/basic.rs:118-131 | datafusion/functions/src/crypto/basic.rs:149-162 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/functions/src/crypto/basic.rs:118` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) datafusion/expr/src/logical_plan/builder.rs:1371 — datafusion/expr/src/logical_plan/builder.rs:1371-1384 | datafusion/expr/src/logical_plan/builder.rs:1386-1399 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (14 lines × 2) datafusion/functions/src/string/split_part.rs:248 — datafusion/functions/src/string/split_part.rs:248-262 | datafusion/functions/src/unicode/substrindex.rs:190-203 — 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:204 — datafusion/physical-plan/src/empty.rs:204-217 | datafusion/physical-plan/src/placeholder_row.rs:204-217 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/empty.rs:204` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) datafusion/functions-aggregate/src/first_last.rs:348 — datafusion/functions-aggregate/src/first_last.rs:348-361 | datafusion/functions-aggregate/src/first_last.rs:1675-1688 — 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 · Edited copy of a member (18 corresponding lines) · ×16
  • Edited copy of a member (18 corresponding lines) datafusion/common/src/config.rs:2443 — datafusion/common/src/config.rs:2443-2475 | datafusion/common/src/config.rs:2481-2505 — 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.
  • Edited copy of a member (18 corresponding lines) datafusion/expr-common/src/type_coercion/binary.rs:971 — datafusion/expr-common/src/type_coercion/binary.rs:971-988 | datafusion/expr-common/src/type_coercion/binary.rs:1021-1040 — 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.
  • Edited copy of a member (18 corresponding lines) datafusion/expr/src/logical_plan/information_schema.rs:721 — datafusion/expr/src/logical_plan/information_schema.rs:721-740 | datafusion/expr/src/logical_plan/information_schema.rs:833-850 — 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.
  • Edited copy of a member (18 corresponding lines) datafusion/physical-expr/src/intervals/cp_solver.rs:629 — datafusion/physical-expr/src/intervals/cp_solver.rs:629-646 | datafusion/physical-expr/src/statistics/stats_solver.rs:128-145 — 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.
  • Edited copy of a member (18 corresponding lines) datafusion/common/src/float_semantics.rs:192 — datafusion/common/src/float_semantics.rs:192-209 | datafusion/physical-plan/src/sorts/sort.rs:1347-1369 — 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.
  • Edited copy of a member (18 corresponding lines) datafusion/functions-aggregate/src/correlation.rs:105 — datafusion/functions-aggregate/src/correlation.rs:105-122 | datafusion/functions-aggregate/src/regr.rs:480-516 — 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.
  • Edited copy of a member (18 corresponding lines) datafusion/physical-expr-common/src/physical_expr.rs:870 — datafusion/physical-expr-common/src/physical_expr.rs:870-896 | datafusion/physical-expr-common/src/sort_expr.rs:379-396 — 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.
  • Edited copy of a member (18 corresponding lines) datafusion/ffi/src/catalog_provider.rs:312 — datafusion/ffi/src/catalog_provider.rs:312-329 | datafusion/ffi/src/schema_provider.rs:334-353 — 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.
  • Edited copy of a member (18 corresponding lines) datafusion/common/src/rounding.rs:161 — datafusion/common/src/rounding.rs:161-178 | datafusion/common/src/rounding.rs:196-213 — 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.
  • Edited copy of a member (18 corresponding lines) datafusion/sql/src/unparser/plan.rs:433 — datafusion/sql/src/unparser/plan.rs:433-450 | datafusion/sql/src/unparser/plan.rs:557-574 — 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.
  • Edited copy of a member (18 corresponding lines) datafusion/functions-aggregate-common/src/aggregate/count_distinct/bytes.rs:65 — datafusion/functions-aggregate-common/src/aggregate/count_distinct/bytes.rs:65-82 | datafusion/functions-aggregate-common/src/aggregate/count_distinct/bytes.rs:128-145 — 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.
  • Edited copy of a member (18 corresponding lines) datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:71 — datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:71-88 | datafusion/functions-aggregate-common/src/utils.rs:211-231 — 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.
  • Edited copy of a member (18 corresponding lines) datafusion/functions-aggregate/src/approx_percentile_cont.rs:45 — datafusion/functions-aggregate/src/approx_percentile_cont.rs:45-62 | datafusion/functions-aggregate/src/approx_percentile_cont_with_weight.rs:39-56 — 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.
  • Edited copy of a member (18 corresponding lines) datafusion/expr-common/src/statistics.rs:362 — datafusion/expr-common/src/statistics.rs:362-387 | datafusion/expr-common/src/statistics.rs:445-462 — 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.
  • Edited copy of a member (18 corresponding lines) datafusion/functions-aggregate/src/approx_percentile_cont.rs:293 — datafusion/functions-aggregate/src/approx_percentile_cont.rs:293-310 | datafusion/functions-aggregate/src/approx_percentile_cont_with_weight.rs:178-200 — 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.
  • Edited copy of a member (18 corresponding lines) datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs:305 — datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs:305-322 | datafusion/physical-plan/src/windows/window_agg_exec.rs:118-135 — 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 · Edited copy of a member (16 corresponding lines) · ×16
  • Edited copy of a member (16 corresponding lines) datafusion/functions-aggregate/src/correlation.rs:172 — datafusion/functions-aggregate/src/correlation.rs:172-192 | datafusion/functions-aggregate/src/correlation.rs:270-285 — These two members are one piece of code written twice and then edited apart: 16 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.
  • Edited copy of a member (16 corresponding lines) datafusion/functions-aggregate/src/average.rs:876 — datafusion/functions-aggregate/src/average.rs:876-892 | datafusion/functions-aggregate/src/average.rs:957-972 — These two members are one piece of code written twice and then edited apart: 16 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.
  • Edited copy of a member (16 corresponding lines) datafusion/expr-common/src/interval_arithmetic.rs:1524 — datafusion/expr-common/src/interval_arithmetic.rs:1524-1539 | datafusion/expr-common/src/interval_arithmetic.rs:1636-1651 — These two members are one piece of code written twice and then edited apart: 16 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.
  • Edited copy of a member (16 corresponding lines) datafusion/functions/src/core/overlay.rs:59 — datafusion/functions/src/core/overlay.rs:59-74 | datafusion/functions/src/regex/regexpmatch.rs:62-80 — These two members are one piece of code written twice and then edited apart: 16 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.
  • Edited copy of a member (16 corresponding lines) datafusion/proto-common/src/to_proto/mod.rs:751 — datafusion/proto-common/src/to_proto/mod.rs:751-770 | datafusion/proto-common/src/to_proto/mod.rs:774-789 — These two members are one piece of code written twice and then edited apart: 16 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.
  • Edited copy of a member (16 corresponding lines) datafusion/functions-nested/src/remove.rs:382 — datafusion/functions-nested/src/remove.rs:382-397 | datafusion/functions-nested/src/remove.rs:405-420 — These two members are one piece of code written twice and then edited apart: 16 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.
  • Edited copy of a member (16 corresponding lines) datafusion/substrait/src/logical_plan/consumer/substrait_consumer.rs:586 — datafusion/substrait/src/logical_plan/consumer/substrait_consumer.rs:586-602 | datafusion/substrait/src/logical_plan/consumer/substrait_consumer.rs:608-623 — These two members are one piece of code written twice and then edited apart: 16 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.
  • Edited copy of a member (16 corresponding lines) datafusion/expr-common/src/sort_properties.rs:52 — datafusion/expr-common/src/sort_properties.rs:52-71 | datafusion/expr-common/src/sort_properties.rs:73-88 — These two members are one piece of code written twice and then edited apart: 16 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.
  • Edited copy of a member (16 corresponding lines) datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs:341 — datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs:341-356 | datafusion/physical-plan/src/windows/window_agg_exec.rs:321-337 — These two members are one piece of code written twice and then edited apart: 16 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.
  • Edited copy of a member (16 corresponding lines) datafusion/optimizer/src/push_down_filter.rs:181 — datafusion/optimizer/src/push_down_filter.rs:181-198 | datafusion/physical-plan/src/joins/hash_join/exec.rs:2809-2824 — These two members are one piece of code written twice and then edited apart: 16 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.
  • Edited copy of a member (16 corresponding lines) datafusion/physical-plan/src/union.rs:596 — datafusion/physical-plan/src/union.rs:596-611 | datafusion/physical-plan/src/union.rs:929-944 — These two members are one piece of code written twice and then edited apart: 16 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.
  • Edited copy of a member (16 corresponding lines) datafusion/functions-aggregate/src/approx_distinct.rs:327 — datafusion/functions-aggregate/src/approx_distinct.rs:327-342 | datafusion/functions-aggregate/src/approx_distinct.rs:380-396 — These two members are one piece of code written twice and then edited apart: 16 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.
  • Edited copy of a member (16 corresponding lines) datafusion/pruning/src/pruning_predicate.rs:2111 — datafusion/pruning/src/pruning_predicate.rs:2111-2126 | datafusion/pruning/src/pruning_predicate.rs:2130-2145 — These two members are one piece of code written twice and then edited apart: 16 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.
  • Edited copy of a member (16 corresponding lines) datafusion/physical-plan/src/joins/hash_join/stream.rs:763 — datafusion/physical-plan/src/joins/hash_join/stream.rs:763-782 | datafusion/physical-plan/src/joins/piecewise_merge_join/existence_join.rs:194-209 — These two members are one piece of code written twice and then edited apart: 16 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.
  • Edited copy of a member (16 corresponding lines) datafusion/physical-plan/src/limit.rs:231 — datafusion/physical-plan/src/limit.rs:231-255 | datafusion/physical-plan/src/limit.rs:520-535 — These two members are one piece of code written twice and then edited apart: 16 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.
  • Edited copy of a member (16 corresponding lines) datafusion/expr-common/src/casts.rs:631 — datafusion/expr-common/src/casts.rs:631-649 | datafusion/expr/src/type_coercion/mod.rs:31-46 — These two members are one piece of code written twice and then edited apart: 16 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 · Duplicated block (13 lines × 2) · ×16
  • Duplicated block (13 lines × 2) datafusion/catalog/src/async.rs:197 — datafusion/catalog/src/async.rs:197-209 | datafusion/catalog/src/async.rs:262-274 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/catalog/src/async.rs:197` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) datafusion/datasource-csv/src/source.rs:795 — datafusion/datasource-csv/src/source.rs:795-807 | datafusion/datasource-json/src/source.rs:391-403 — before extracting anything, compare `datafusion/datasource-csv/src/source.rs` and `datafusion/datasource-json/src/source.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 57 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/datasource-csv/src/source.rs:795` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) datafusion/datasource-csv/src/source.rs:924 — datafusion/datasource-csv/src/source.rs:924-936 | datafusion/datasource-json/src/source.rs:594-606 — before extracting anything, compare `datafusion/datasource-csv/src/source.rs` and `datafusion/datasource-json/src/source.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 57 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/datasource-csv/src/source.rs:924` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) datafusion/expr/src/logical_plan/builder.rs:371 — datafusion/expr/src/logical_plan/builder.rs:371-383 | datafusion/expr/src/logical_plan/builder.rs:406-418 — 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-aggregate/src/nth_value.rs:287 — datafusion/functions-aggregate/src/nth_value.rs:287-299 | datafusion/functions-aggregate/src/nth_value.rs:498-510 — 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:255 — datafusion/functions-nested/src/position.rs:255-267 | datafusion/functions-nested/src/position.rs:554-566 — 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:368 — datafusion/functions-nested/src/range.rs:368-380 | datafusion/functions-nested/src/range.rs:449-461 — 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:724 — datafusion/functions/src/regex/regexpreplace.rs:724-736 | datafusion/functions/src/utils.rs:120-132 — 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/common.rs:400 — datafusion/functions/src/string/common.rs:400-412 | datafusion/functions/src/string/common.rs:421-433 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (13 lines × 2) datafusion/functions/src/string/ends_with.rs:81 — datafusion/functions/src/string/ends_with.rs:81-93 | datafusion/functions/src/string/starts_with.rs:77-89 — 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 69 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:88 — datafusion/functions/src/string/ltrim.rs:88-100 | datafusion/functions/src/string/rtrim.rs:88-100 — 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 39 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/optimizer/src/simplify_expressions/expr_simplifier.rs:899 — datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:899-911 | datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:913-926 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:899` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) datafusion/physical-expr/src/window/sliding_aggregate.rs:182 — datafusion/physical-expr/src/window/sliding_aggregate.rs:182-194 | datafusion/physical-expr/src/window/sliding_aggregate.rs:216-228 — 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/piecewise_merge_join/classic_join.rs:382 — datafusion/physical-plan/src/joins/piecewise_merge_join/classic_join.rs:382-394 | datafusion/physical-plan/src/joins/piecewise_merge_join/existence_join.rs:370-382 — 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/physical-plan/src/joins/symmetric_hash_join.rs:1132 — datafusion/physical-plan/src/joins/symmetric_hash_join.rs:1132-1144 | datafusion/physical-plan/src/joins/symmetric_hash_join.rs:1146-1158 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (13 lines × 2) datafusion/expr-common/src/casts.rs:289 — datafusion/expr-common/src/casts.rs:289-301 | datafusion/physical-plan/src/joins/array_map.rs:104-116 — 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.
D2 · Cognitive Complexity · datafusion_functions_nested · ×15
  • datafusion_functions_nested::string::compute_array_to_string (cognitive 47) datafusion/functions-nested/src/string.rs:579 — 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:389 — 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:334 — 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:148 — 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:422 — 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:324 — 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::cosine_distance::general_cosine_distance (cognitive 24) datafusion/functions-nested/src/cosine_distance.rs:148 — 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::remove::general_remove (cognitive 24) datafusion/functions-nested/src/remove.rs:439 — datafusion_functions_nested::remove::general_remove has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (19 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::range::generate_range_values (cognitive 22) datafusion/functions-nested/src/range.rs:560 — 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::array_normalize::general_array_normalize (cognitive 21) datafusion/functions-nested/src/array_normalize.rs:130 — 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::resize::general_list_resize (cognitive 21) datafusion/functions-nested/src/resize.rs:184 — 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::extract::compute_slice_plan (cognitive 18) datafusion/functions-nested/src/extract.rs:504 — 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:228 — 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:435 — 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 16) datafusion/functions-nested/src/remove.rs:539 — datafusion_functions_nested::remove::general_remove_with_scalar has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 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 32) datafusion/common/src/hash_utils.rs:555 — datafusion_common::hash_utils::hash_dictionary_scatter has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 4 (12 pts), boolean chains 2 (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_common::functional_dependencies::aggregate_functional_dependencies_with_computed_inputs (cognitive 28) datafusion/common/src/functional_dependencies.rs:480 — datafusion_common::functional_dependencies::aggregate_functional_dependencies_with_computed_inputs has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 2 (5 pts), boolean chains 3 (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_common::hash_utils::hash_sparse_union_array (cognitive 22) datafusion/common/src/hash_utils.rs:987 — datafusion_common::hash_utils::hash_sparse_union_array has cognitive complexity 22 (threshold 15). Drivers by points: loops 4 (11 pts), if/else 5 (9 pts), boolean chains 2 (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.
  • datafusion_common::nested_struct::compact_list_view_values (cognitive 20) datafusion/common/src/nested_struct.rs:385 — 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:215 — 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:837 — 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::metadata::coerced_fields_metadata (cognitive 17) datafusion/common/src/metadata.rs:131 — datafusion_common::metadata::coerced_fields_metadata has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 2 (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::hash_array (cognitive 16) datafusion/common/src/hash_utils.rs:378 — 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.
  • datafusion_common::hash_utils::hash_map_array (cognitive 16) datafusion/common/src/hash_utils.rs:787 — 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:836 — 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:882 — 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:1074 — 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.
  • datafusion_common::hash_utils::build_hasher::hash_array_primitive_with_hasher (cognitive 16) datafusion/common/src/hash_utils/build_hasher.rs:192 — 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:234 — 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.
D4 · Code Duplication · Edited copy of a member (23 corresponding lines) · ×14
  • Edited copy of a member (23 corresponding lines) datafusion/physical-plan/src/topk/mod.rs:1855 — datafusion/physical-plan/src/topk/mod.rs:1855-1892 | datafusion/physical-plan/src/topk/mod.rs:2829-2862 — These two members are one piece of code written twice and then edited apart: 23 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.
  • Edited copy of a member (23 corresponding lines) datafusion/functions-aggregate/src/nth_value.rs:237 — datafusion/functions-aggregate/src/nth_value.rs:237-259 | datafusion/functions-aggregate/src/nth_value.rs:409-435 — These two members are one piece of code written twice and then edited apart: 23 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.
  • Edited copy of a member (23 corresponding lines) datafusion/ffi/src/physical_expr/mod.rs:263 — datafusion/ffi/src/physical_expr/mod.rs:263-287 | datafusion/ffi/src/physical_expr/mod.rs:313-335 — These two members are one piece of code written twice and then edited apart: 23 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.
  • Edited copy of a member (23 corresponding lines) datafusion/functions/src/strings.rs:957 — datafusion/functions/src/strings.rs:957-982 | datafusion/functions/src/strings.rs:985-1007 — These two members are one piece of code written twice and then edited apart: 23 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.
  • Edited copy of a member (23 corresponding lines) datafusion/functions/src/unicode/strpos.rs:215 — datafusion/functions/src/unicode/strpos.rs:215-239 | datafusion/functions/src/unicode/strpos.rs:296-318 — These two members are one piece of code written twice and then edited apart: 23 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.
  • Edited copy of a member (23 corresponding lines) REDACTED:607 — REDACTED:607-629 | REDACTED:813-843 — These two members are one piece of code written twice and then edited apart: 23 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.
  • Edited copy of a member (23 corresponding lines) datafusion/ffi/src/udaf/accumulator.rs:193 — datafusion/ffi/src/udaf/accumulator.rs:193-216 | datafusion/ffi/src/udaf/groups_accumulator.rs:226-248 — These two members are one piece of code written twice and then edited apart: 23 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.
  • Edited copy of a member (23 corresponding lines) datafusion/functions-aggregate/src/first_last.rs:1373 — datafusion/functions-aggregate/src/first_last.rs:1373-1397 | datafusion/functions-aggregate/src/first_last.rs:1765-1787 — These two members are one piece of code written twice and then edited apart: 23 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.
  • Edited copy of a member (23 corresponding lines) datafusion/ffi/src/udf/return_type_args.rs:29 — datafusion/ffi/src/udf/return_type_args.rs:29-55 | datafusion/ffi/src/udf/return_type_args.rs:74-96 — These two members are one piece of code written twice and then edited apart: 23 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.
  • Edited copy of a member (23 corresponding lines) datafusion/physical-plan/src/aggregates/aggregate_hash_table/common.rs:200 — datafusion/physical-plan/src/aggregates/aggregate_hash_table/common.rs:200-224 | datafusion/physical-plan/src/aggregates/aggregate_hash_table/common_clustered.rs:234-256 — These two members are one piece of code written twice and then edited apart: 23 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.
  • Edited copy of a member (23 corresponding lines) datafusion/expr/src/logical_plan/plan.rs:4096 — datafusion/expr/src/logical_plan/plan.rs:4096-4118 | datafusion/expr/src/logical_plan/plan.rs:4121-4143 — These two members are one piece of code written twice and then edited apart: 23 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.
  • Edited copy of a member (23 corresponding lines) datafusion/expr/src/logical_plan/tree_node.rs:1013 — datafusion/expr/src/logical_plan/tree_node.rs:1013-1035 | datafusion/optimizer/src/optimizer.rs:595-627 — These two members are one piece of code written twice and then edited apart: 23 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.
  • Edited copy of a member (23 corresponding lines) datafusion/functions-aggregate/src/average.rs:87 — datafusion/functions-aggregate/src/average.rs:87-109 | datafusion/functions-aggregate/src/median.rs:69-91 — These two members are one piece of code written twice and then edited apart: 23 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.
  • Edited copy of a member (23 corresponding lines) datafusion/physical-plan/src/joins/cross_join.rs:138 — datafusion/physical-plan/src/joins/cross_join.rs:138-168 | datafusion/physical-plan/src/joins/symmetric_hash_join.rs:256-278 — These two members are one piece of code written twice and then edited apart: 23 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 (21 corresponding lines) · ×14
  • Edited copy of a member (21 corresponding lines) datafusion/common/src/stats.rs:890 — datafusion/common/src/stats.rs:890-910 | datafusion/common/src/stats.rs:918-938 — These two members are one piece of code written twice and then edited apart: 21 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.
  • Edited copy of a member (21 corresponding lines) datafusion/functions/src/core/arrow_cast.rs:116 — datafusion/functions/src/core/arrow_cast.rs:116-136 | datafusion/functions/src/core/arrow_try_cast.rs:88-109 — These two members are one piece of code written twice and then edited apart: 21 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.
  • Edited copy of a member (21 corresponding lines) datafusion/functions-nested/src/remove.rs:105 — datafusion/functions-nested/src/remove.rs:105-125 | datafusion/functions-nested/src/remove.rs:344-367 — These two members are one piece of code written twice and then edited apart: 21 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.
  • Edited copy of a member (21 corresponding lines) datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:2263 — datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:2263-2283 | datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:2285-2307 — These two members are one piece of code written twice and then edited apart: 21 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.
  • Edited copy of a member (21 corresponding lines) datafusion/sql/src/unparser/expr.rs:676 — datafusion/sql/src/unparser/expr.rs:676-696 | datafusion/sql/src/unparser/expr.rs:1817-1838 — These two members are one piece of code written twice and then edited apart: 21 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.
  • Edited copy of a member (21 corresponding lines) datafusion/physical-plan/src/spill/in_progress_spill_file.rs:173 — datafusion/physical-plan/src/spill/in_progress_spill_file.rs:173-193 | datafusion/physical-plan/src/spill/in_progress_spill_file.rs:196-216 — These two members are one piece of code written twice and then edited apart: 21 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.
  • Edited copy of a member (21 corresponding lines) datafusion/physical-plan/src/empty.rs:235 — datafusion/physical-plan/src/empty.rs:235-255 | datafusion/physical-plan/src/placeholder_row.rs:235-258 — These two members are one piece of code written twice and then edited apart: 21 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.
  • Edited copy of a member (21 corresponding lines) datafusion/functions/src/encoding/inner.rs:199 — datafusion/functions/src/encoding/inner.rs:199-219 | datafusion/functions/src/encoding/inner.rs:238-260 — These two members are one piece of code written twice and then edited apart: 21 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.
  • Edited copy of a member (21 corresponding lines) datafusion/physical-expr/src/intervals/cp_solver.rs:741 — datafusion/physical-expr/src/intervals/cp_solver.rs:741-763 | datafusion/physical-expr/src/intervals/cp_solver.rs:777-797 — These two members are one piece of code written twice and then edited apart: 21 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.
  • Edited copy of a member (21 corresponding lines) datafusion/common/src/config.rs:2542 — datafusion/common/src/config.rs:2542-2566 | datafusion/execution/src/runtime_env.rs:552-572 — These two members are one piece of code written twice and then edited apart: 21 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.
  • Edited copy of a member (21 corresponding lines) datafusion/functions/src/datetime/make_date.rs:166 — datafusion/functions/src/datetime/make_date.rs:166-189 | datafusion/functions/src/datetime/make_time.rs:174-194 — These two members are one piece of code written twice and then edited apart: 21 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.
  • Edited copy of a member (21 corresponding lines) datafusion/datasource-csv/src/file_format.rs:901 — datafusion/datasource-csv/src/file_format.rs:901-921 | datafusion/datasource-json/src/file_format.rs:533-554 — These two members are one piece of code written twice and then edited apart: 21 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.
  • Edited copy of a member (21 corresponding lines) datafusion/physical-plan/src/joins/hash_join/exec.rs:1570 — datafusion/physical-plan/src/joins/hash_join/exec.rs:1570-1592 | datafusion/physical-plan/src/joins/symmetric_hash_join.rs:414-434 — These two members are one piece of code written twice and then edited apart: 21 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.
  • Edited copy of a member (21 corresponding lines) datafusion/physical-expr/src/expressions/dynamic_filters/mod.rs:546 — datafusion/physical-expr/src/expressions/dynamic_filters/mod.rs:546-567 | datafusion/physical-expr/src/expressions/dynamic_filters/mod.rs:569-589 — These two members are one piece of code written twice and then edited apart: 21 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 (17 corresponding lines) · ×13
  • Edited copy of a member (17 corresponding lines) datafusion/expr-common/src/interval_arithmetic.rs:978 — datafusion/expr-common/src/interval_arithmetic.rs:978-1000 | datafusion/expr-common/src/interval_arithmetic.rs:1015-1031 — These two members are one piece of code written twice and then edited apart: 17 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.
  • Edited copy of a member (17 corresponding lines) datafusion/functions/src/strings.rs:1256 — datafusion/functions/src/strings.rs:1256-1272 | datafusion/functions/src/strings.rs:1275-1291 — These two members are one piece of code written twice and then edited apart: 17 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.
  • Edited copy of a member (17 corresponding lines) datafusion/physical-expr-common/src/binary_view_map.rs:408 — datafusion/physical-expr-common/src/binary_view_map.rs:408-424 | datafusion/physical-plan/src/aggregates/group_values/multi_group_by/bytes_view.rs:320-336 — These two members are one piece of code written twice and then edited apart: 17 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.
  • Edited copy of a member (17 corresponding lines) datafusion/physical-plan/src/sorts/sort.rs:2065 — datafusion/physical-plan/src/sorts/sort.rs:2065-2081 | datafusion/physical-plan/src/sorts/sort_preserving_merge.rs:432-450 — These two members are one piece of code written twice and then edited apart: 17 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.
  • Edited copy of a member (17 corresponding lines) datafusion/functions-aggregate/src/nth_value.rs:286 — datafusion/functions-aggregate/src/nth_value.rs:286-302 | datafusion/functions-aggregate/src/nth_value.rs:497-513 — These two members are one piece of code written twice and then edited apart: 17 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.
  • Edited copy of a member (17 corresponding lines) datafusion/common/src/hash_utils.rs:1054 — datafusion/common/src/hash_utils.rs:1054-1071 | datafusion/physical-plan/src/joins/hash_join/partitioned_hash_eval.rs:481-497 — These two members are one piece of code written twice and then edited apart: 17 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.
  • Edited copy of a member (17 corresponding lines) datafusion/expr/src/logical_plan/tree_node.rs:917 — datafusion/expr/src/logical_plan/tree_node.rs:917-934 | datafusion/expr/src/logical_plan/tree_node.rs:942-958 — These two members are one piece of code written twice and then edited apart: 17 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.
  • Edited copy of a member (17 corresponding lines) datafusion/expr/src/utils.rs:1516 — datafusion/expr/src/utils.rs:1516-1532 | datafusion/optimizer/src/decorrelate.rs:1206-1223 — These two members are one piece of code written twice and then edited apart: 17 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.
  • Edited copy of a member (17 corresponding lines) datafusion/pruning/src/pruning_predicate.rs:2169 — datafusion/pruning/src/pruning_predicate.rs:2169-2185 | datafusion/pruning/src/pruning_predicate.rs:2189-2205 — These two members are one piece of code written twice and then edited apart: 17 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.
  • Edited copy of a member (17 corresponding lines) datafusion/physical-plan/src/operator_statistics/mod.rs:509 — datafusion/physical-plan/src/operator_statistics/mod.rs:509-532 | datafusion/physical-plan/src/operator_statistics/mod.rs:548-564 — These two members are one piece of code written twice and then edited apart: 17 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.
  • Edited copy of a member (17 corresponding lines) datafusion/proto/src/physical_plan/from_proto.rs:521 — datafusion/proto/src/physical_plan/from_proto.rs:521-537 | datafusion/proto/src/physical_plan/mod.rs:2008-2024 — These two members are one piece of code written twice and then edited apart: 17 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.
  • Edited copy of a member (17 corresponding lines) datafusion/physical-plan/src/empty.rs:142 — datafusion/physical-plan/src/empty.rs:142-162 | datafusion/physical-plan/src/placeholder_row.rs:158-174 — These two members are one piece of code written twice and then edited apart: 17 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.
  • Edited copy of a member (17 corresponding lines) datafusion/physical-plan/src/joins/piecewise_merge_join/existence_join.rs:151 — datafusion/physical-plan/src/joins/piecewise_merge_join/existence_join.rs:151-168 | datafusion/physical-plan/src/joins/piecewise_merge_join/right_existence_join.rs:159-175 — These two members are one piece of code written twice and then edited apart: 17 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.
D2 · Cognitive Complexity · datafusion_physical_optimizer · ×12
  • datafusion_physical_optimizer::ensure_requirements::enforce_distribution::enforce_distribution_relationships (cognitive 63) datafusion/physical-optimizer/src/ensure_requirements/enforce_distribution.rs:1408 — 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_distribution::ensure_distribution_with_stats (cognitive 56) datafusion/physical-optimizer/src/ensure_requirements/enforce_distribution.rs:1653 — datafusion_physical_optimizer::ensure_requirements::enforce_distribution::ensure_distribution_with_stats has cognitive complexity 56 (threshold 15). Drivers by points: if/else 19 (33 pts), boolean chains 13, match/switch 4 (10 pts) (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_physical_optimizer::ensure_requirements::enforce_sorting::sort_pushdown::pushdown_sorts_helper (cognitive 41) datafusion/physical-optimizer/src/ensure_requirements/enforce_sorting/sort_pushdown.rs:215 — datafusion_physical_optimizer::ensure_requirements::enforce_sorting::sort_pushdown::pushdown_sorts_helper has cognitive complexity 41 (threshold 15). Drivers by points: if/else 21 (31 pts), loops 3 (6 pts), boolean chains 4 (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:845 — 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::ensure_requirements::enforce_sorting::sort_pushdown::pushdown_requirement_to_children (cognitive 33) datafusion/physical-optimizer/src/ensure_requirements/enforce_sorting/sort_pushdown.rs:442 — datafusion_physical_optimizer::ensure_requirements::enforce_sorting::sort_pushdown::pushdown_requirement_to_children has cognitive complexity 33 (threshold 15). Drivers by points: if/else 18 (25 pts), boolean chains 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_physical_optimizer::ensure_requirements::enforce_distribution::adjust_input_keys_ordering (cognitive 26) datafusion/physical-optimizer/src/ensure_requirements/enforce_distribution.rs:123 — 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:280 — datafusion_physical_optimizer::join_selection::statistical_join_selection_subrule has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (20 pts), match/switch 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.
  • datafusion_physical_optimizer::ensure_requirements::enforce_sorting::sort_pushdown::is_custom_sort_pushdown_valid (cognitive 21) datafusion/physical-optimizer/src/ensure_requirements/enforce_sorting/sort_pushdown.rs:1017 — datafusion_physical_optimizer::ensure_requirements::enforce_sorting::sort_pushdown::is_custom_sort_pushdown_valid has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (18 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_optimizer::ensure_requirements::enforce_sorting::remove_corresponding_sort_from_sub_plan (cognitive 18) datafusion/physical-optimizer/src/ensure_requirements/enforce_sorting/mod.rs:719 — 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::join_selection::hash_join_convert_symmetric_subrule (cognitive 18) datafusion/physical-optimizer/src/join_selection.rs:375 — datafusion_physical_optimizer::join_selection::hash_join_convert_symmetric_subrule has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 2 (4 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_optimizer::ensure_requirements::enforce_sorting::remove_bottleneck_in_subplan_impl (cognitive 17) datafusion/physical-optimizer/src/ensure_requirements/enforce_sorting/mod.rs:624 — 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.
  • datafusion_physical_optimizer::ensure_requirements::enforce_sorting::ensure_sorting (cognitive 16) datafusion/physical-optimizer/src/ensure_requirements/enforce_sorting/mod.rs:395 — datafusion_physical_optimizer::ensure_requirements::enforce_sorting::ensure_sorting has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 2, 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.
D1 · Cyclomatic Complexity · ScalarValue · ×11
  • ScalarValue::deserialize (cyclomatic 136) datafusion/proto-common/src/generated/pbjson.rs:8916 — 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:534 — 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:669 — 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:3103 — 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:3745 — 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:4832 — 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:4333 — 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:307 — 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:385 — 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:5858 — 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:2951 — 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.
D4 · Code Duplication · Edited copy of a member (25 corresponding lines) · ×11
  • Edited copy of a member (25 corresponding lines) datafusion/expr-common/src/interval_arithmetic.rs:1995 — datafusion/expr-common/src/interval_arithmetic.rs:1995-2019 | datafusion/expr-common/src/interval_arithmetic.rs:2035-2059 — These two members are one piece of code written twice and then edited apart: 25 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.
  • Edited copy of a member (25 corresponding lines) datafusion/core/src/execution/context/mod.rs:1356 — datafusion/core/src/execution/context/mod.rs:1356-1380 | datafusion/core/src/execution/context/mod.rs:1398-1431 — These two members are one piece of code written twice and then edited apart: 25 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.
  • Edited copy of a member (25 corresponding lines) datafusion/functions-aggregate/src/variance.rs:86 — datafusion/functions-aggregate/src/variance.rs:86-110 | datafusion/functions-aggregate/src/variance.rs:189-215 — These two members are one piece of code written twice and then edited apart: 25 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.
  • Edited copy of a member (25 corresponding lines) datafusion/functions/src/core/greatest.rs:84 — datafusion/functions/src/core/greatest.rs:84-108 | datafusion/functions/src/core/least.rs:97-121 — These two members are one piece of code written twice and then edited apart: 25 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.
  • Edited copy of a member (25 corresponding lines) datafusion/ffi/src/udaf/groups_accumulator.rs:297 — datafusion/ffi/src/udaf/groups_accumulator.rs:297-321 | datafusion/ffi/src/udaf/groups_accumulator.rs:380-407 — These two members are one piece of code written twice and then edited apart: 25 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.
  • Edited copy of a member (25 corresponding lines) datafusion/functions-nested/src/extract.rs:425 — datafusion/functions-nested/src/extract.rs:425-458 | datafusion/functions-nested/src/extract.rs:463-487 — These two members are one piece of code written twice and then edited apart: 25 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.
  • Edited copy of a member (25 corresponding lines) datafusion/physical-plan/src/aggregates/aggregate_stream.rs:562 — datafusion/physical-plan/src/aggregates/aggregate_stream.rs:562-589 | datafusion/physical-plan/src/aggregates/mod.rs:3150-3174 — These two members are one piece of code written twice and then edited apart: 25 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.
  • Edited copy of a member (25 corresponding lines) datafusion/functions/src/regex/regexpcount.rs:120 — datafusion/functions/src/regex/regexpcount.rs:120-144 | datafusion/functions/src/regex/regexpinstr.rs:138-164 — These two members are one piece of code written twice and then edited apart: 25 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.
  • Edited copy of a member (25 corresponding lines) datafusion/substrait/src/logical_plan/producer/expr/subquery.rs:36 — datafusion/substrait/src/logical_plan/producer/expr/subquery.rs:36-66 | datafusion/substrait/src/logical_plan/producer/expr/subquery.rs:150-174 — These two members are one piece of code written twice and then edited apart: 25 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.
  • Edited copy of a member (25 corresponding lines) datafusion/physical-plan/src/empty.rs:202 — datafusion/physical-plan/src/empty.rs:202-226 | datafusion/physical-plan/src/placeholder_row.rs:202-226 — These two members are one piece of code written twice and then edited apart: 25 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.
  • Edited copy of a member (25 corresponding lines) datafusion/datasource-avro/src/source.rs:175 — datafusion/datasource-avro/src/source.rs:175-199 | datafusion/datasource-json/src/source.rs:275-307 — These two members are one piece of code written twice and then edited apart: 25 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 (22 corresponding lines) · ×11
  • Edited copy of a member (22 corresponding lines) datafusion/functions/src/encoding/inner.rs:453 — datafusion/functions/src/encoding/inner.rs:453-476 | datafusion/functions/src/encoding/inner.rs:487-508 — These two members are one piece of code written twice and then edited apart: 22 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.
  • Edited copy of a member (22 corresponding lines) datafusion/sql/src/expr/mod.rs:1154 — datafusion/sql/src/expr/mod.rs:1154-1178 | datafusion/sql/src/expr/mod.rs:1188-1209 — These two members are one piece of code written twice and then edited apart: 22 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.
  • Edited copy of a member (22 corresponding lines) datafusion/expr-common/src/interval_arithmetic.rs:581 — datafusion/expr-common/src/interval_arithmetic.rs:581-602 | datafusion/expr-common/src/interval_arithmetic.rs:606-627 — These two members are one piece of code written twice and then edited apart: 22 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.
  • Edited copy of a member (22 corresponding lines) datafusion/ffi/src/physical_expr/mod.rs:613 — datafusion/ffi/src/physical_expr/mod.rs:613-634 | datafusion/ffi/src/physical_expr/mod.rs:655-677 — These two members are one piece of code written twice and then edited apart: 22 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.
  • Edited copy of a member (22 corresponding lines) datafusion/common/src/config.rs:3666 — datafusion/common/src/config.rs:3666-3689 | datafusion/common/src/config.rs:3846-3867 — These two members are one piece of code written twice and then edited apart: 22 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.
  • Edited copy of a member (22 corresponding lines) datafusion/functions-aggregate-common/src/aggregate/groups_accumulator/prim_op.rs:84 — datafusion/functions-aggregate-common/src/aggregate/groups_accumulator/prim_op.rs:84-105 | datafusion/functions-aggregate/src/average.rs:1109-1132 — These two members are one piece of code written twice and then edited apart: 22 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.
  • Edited copy of a member (22 corresponding lines) datafusion/expr/src/logical_plan/builder.rs:366 — datafusion/expr/src/logical_plan/builder.rs:366-387 | datafusion/expr/src/logical_plan/builder.rs:401-422 — These two members are one piece of code written twice and then edited apart: 22 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.
  • Edited copy of a member (22 corresponding lines) datafusion/functions-nested/src/map.rs:485 — datafusion/functions-nested/src/map.rs:485-506 | datafusion/functions-nested/src/map.rs:513-534 — These two members are one piece of code written twice and then edited apart: 22 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.
  • Edited copy of a member (22 corresponding lines) datafusion/sql/src/unparser/utils.rs:33 — datafusion/sql/src/unparser/utils.rs:33-61 | datafusion/sql/src/unparser/utils.rs:87-108 — These two members are one piece of code written twice and then edited apart: 22 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.
  • Edited copy of a member (22 corresponding lines) datafusion/physical-expr/src/intervals/test_utils.rs:28 — datafusion/physical-expr/src/intervals/test_utils.rs:28-49 | datafusion/physical-expr/src/intervals/test_utils.rs:67-89 — These two members are one piece of code written twice and then edited apart: 22 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.
  • Edited copy of a member (22 corresponding lines) test-utils/src/array_gen/string.rs:29 — test-utils/src/array_gen/string.rs:29-51 | test-utils/src/array_gen/string.rs:54-75 — These two members are one piece of code written twice and then edited apart: 22 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 (14 corresponding lines) · ×10
  • Edited copy of a member (14 corresponding lines) datafusion/ffi/src/table_provider.rs:718 — datafusion/ffi/src/table_provider.rs:718-733 | datafusion/ffi/src/table_provider.rs:739-752 — These two members are one piece of code written twice and then edited apart: 14 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.
  • Edited copy of a member (14 corresponding lines) datafusion/functions/src/core/cast_to_type.rs:112 — datafusion/functions/src/core/cast_to_type.rs:112-128 | datafusion/functions/src/core/try_cast_to_type.rs:99-112 — These two members are one piece of code written twice and then edited apart: 14 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.
  • Edited copy of a member (14 corresponding lines) datafusion/functions-aggregate/src/array_agg.rs:915 — datafusion/functions-aggregate/src/array_agg.rs:915-928 | datafusion/functions-aggregate/src/array_agg.rs:1331-1348 — These two members are one piece of code written twice and then edited apart: 14 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.
  • Edited copy of a member (14 corresponding lines) datafusion/functions/src/core/greatest.rs:67 — datafusion/functions/src/core/greatest.rs:67-80 | datafusion/functions/src/core/least.rs:67-93 — These two members are one piece of code written twice and then edited apart: 14 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.
  • Edited copy of a member (14 corresponding lines) datafusion/common/src/types/canonical_extensions/bool8.rs:55 — datafusion/common/src/types/canonical_extensions/bool8.rs:55-68 | datafusion/common/src/types/canonical_extensions/uuid.rs:55-68 — These two members are one piece of code written twice and then edited apart: 14 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.
  • Edited copy of a member (14 corresponding lines) datafusion/physical-plan/src/aggregates/aggregate_hash_table/mod.rs:24 — datafusion/physical-plan/src/aggregates/aggregate_hash_table/mod.rs:24-48 | datafusion/physical-plan/src/aggregates/aggregate_stream.rs:543-556 — These two members are one piece of code written twice and then edited apart: 14 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.
  • Edited copy of a member (14 corresponding lines) datafusion/common/src/utils/memory.rs:202 — datafusion/common/src/utils/memory.rs:202-215 | datafusion/common/src/utils/memory.rs:293-308 — These two members are one piece of code written twice and then edited apart: 14 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.
  • Edited copy of a member (14 corresponding lines) datafusion/physical-expr-common/src/physical_expr.rs:933 — datafusion/physical-expr-common/src/physical_expr.rs:933-946 | datafusion/physical-plan/src/render_tree.rs:152-165 — These two members are one piece of code written twice and then edited apart: 14 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.
  • Edited copy of a member (14 corresponding lines) datafusion/physical-optimizer/src/topk_aggregation.rs:186 — datafusion/physical-optimizer/src/topk_aggregation.rs:186-199 | datafusion/physical-optimizer/src/window_topn.rs:315-330 — These two members are one piece of code written twice and then edited apart: 14 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.
  • Edited copy of a member (14 corresponding lines) datafusion/functions/src/unicode/character_length.rs:52 — datafusion/functions/src/unicode/character_length.rs:52-67 | datafusion/functions/src/unicode/reverse.rs:50-63 — These two members are one piece of code written twice and then edited apart: 14 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.
D1 · Cyclomatic Complexity · SqlToRel · ×9
  • SqlToRel::sql_statement_to_plan_with_context_impl (cyclomatic 214) datafusion/sql/src/statement.rs:254 — SqlToRel::sql_statement_to_plan_with_context_impl has cyclomatic complexity 214 (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:215 — 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 64) datafusion/sql/src/expr/mod.rs:385 — SqlToRel::sql_expr_to_logical_expr_internal 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.
  • SqlToRel::convert_simple_data_type (cyclomatic 37) datafusion/sql/src/planner.rs:705 — SqlToRel::convert_simple_data_type 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.
  • SqlToRel::select_to_plan (cyclomatic 34) datafusion/sql/src/select.rs:89 — SqlToRel::select_to_plan has cyclomatic complexity 34 (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:2586 — 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:2728 — 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:103 — 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:2080 — 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_optimizer · ×9
  • datafusion_optimizer::decorrelate_predicate_subquery::build_join (cyclomatic 46) datafusion/optimizer/src/decorrelate_predicate_subquery.rs:870 — datafusion_optimizer::decorrelate_predicate_subquery::build_join has cyclomatic complexity 46 (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_optimizer::optimize_projections::optimize_projections (cyclomatic 29) datafusion/optimizer/src/optimize_projections/mod.rs:123 — datafusion_optimizer::optimize_projections::optimize_projections 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_optimizer::decorrelate_lateral_join::rewrite_internal (cyclomatic 26) datafusion/optimizer/src/decorrelate_lateral_join.rs:60 — datafusion_optimizer::decorrelate_lateral_join::rewrite_internal has cyclomatic complexity 26 (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_filter::push_down_all_join (cyclomatic 25) datafusion/optimizer/src/push_down_filter.rs:412 — 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:79 — 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::extract_leaf_expressions::split_and_push_projection (cyclomatic 21) datafusion/optimizer/src/extract_leaf_expressions.rs:1002 — datafusion_optimizer::extract_leaf_expressions::split_and_push_projection 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.
  • datafusion_optimizer::optimizer::map_children_mut (cyclomatic 21) datafusion/optimizer/src/optimizer.rs:414 — datafusion_optimizer::optimizer::map_children_mut 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_optimizer::push_down_limit::rewrite_limit (cyclomatic 21) datafusion/optimizer/src/push_down_limit.rs:76 — datafusion_optimizer::push_down_limit::rewrite_limit 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.
  • datafusion_optimizer::single_distinct_to_groupby::is_single_distinct_agg (cyclomatic 16) datafusion/optimizer/src/single_distinct_to_groupby.rs:114 — datafusion_optimizer::single_distinct_to_groupby::is_single_distinct_agg 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.
D4 · Code Duplication · Edited copy of a member (19 corresponding lines) · ×9
  • Edited copy of a member (19 corresponding lines) datafusion/functions/src/unicode/find_in_set.rs:264 — datafusion/functions/src/unicode/find_in_set.rs:264-285 | datafusion/functions/src/unicode/find_in_set.rs:292-312 — 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.
  • Edited copy of a member (19 corresponding lines) datafusion/physical-plan/src/aggregates/topk/hash_table.rs:588 — datafusion/physical-plan/src/aggregates/topk/hash_table.rs:588-606 | datafusion/physical-plan/src/aggregates/topk/heap.rs:595-613 — 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.
  • Edited copy of a member (19 corresponding lines) datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:392 — datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:392-410 | datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:486-504 — 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.
  • Edited copy of a member (19 corresponding lines) datafusion/functions-aggregate/src/min_max/min_max_bytes.rs:509 — datafusion/functions-aggregate/src/min_max/min_max_bytes.rs:509-531 | datafusion/functions-aggregate/src/min_max/min_max_struct.rs:297-315 — 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.
  • Edited copy of a member (19 corresponding lines) datafusion/datasource-arrow/src/source.rs:330 — datafusion/datasource-arrow/src/source.rs:330-367 | datafusion/datasource/src/file.rs:179-197 — 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.
  • Edited copy of a member (19 corresponding lines) datafusion/physical-expr/src/expressions/in_list/primitive_filter.rs:301 — datafusion/physical-expr/src/expressions/in_list/primitive_filter.rs:301-319 | datafusion/physical-expr/src/expressions/in_list/primitive_filter.rs:421-439 — 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.
  • Edited copy of a member (19 corresponding lines) datafusion/ffi/src/physical_optimizer.rs:209 — datafusion/ffi/src/physical_optimizer.rs:209-227 | datafusion/ffi/src/table_provider_factory.rs:218-237 — 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.
  • Edited copy of a member (19 corresponding lines) datafusion/datasource/src/mod.rs:173 — datafusion/datasource/src/mod.rs:173-191 | datafusion/datasource/src/mod.rs:209-228 — 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.
  • Edited copy of a member (19 corresponding lines) datafusion/proto-common/src/from_proto/mod.rs:55 — datafusion/proto-common/src/from_proto/mod.rs:55-73 | datafusion/proto-common/src/to_proto/mod.rs:52-71 — 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 · Members sharing a duplicated core (4 members, 50+ identical tokens) · ×9
  • Members sharing a duplicated core (4 members, 50+ identical tokens) datafusion/catalog-listing/src/helpers.rs:45 — datafusion/catalog-listing/src/helpers.rs:45-127 | datafusion/expr/src/utils.rs:261-312 | datafusion/optimizer/src/push_down_filter.rs:247-289 | datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:622-699 — 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/common/src/scalar/mod.rs:4735 — datafusion/common/src/scalar/mod.rs:4735-4746 | datafusion/common/src/scalar/mod.rs:4754-4765 | datafusion/common/src/scalar/mod.rs:4773-4784 | datafusion/common/src/scalar/mod.rs:4792-4803 — 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:93 — datafusion/ffi/src/udaf/accumulator.rs:93-105 | datafusion/ffi/src/udaf/accumulator.rs:167-179 | datafusion/ffi/src/udwf/partition_evaluator.rs:100-119 | datafusion/ffi/src/udwf/partition_evaluator.rs:125-144 — 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:202 — datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:202-217 | datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:282-297 | datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:375-390 | datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:469-484 — 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:280 — datafusion/functions-aggregate/src/covariance.rs:280-303 | datafusion/functions-aggregate/src/covariance.rs:305-336 | datafusion/functions-aggregate/src/regr.rs:607-632 | datafusion/functions-aggregate/src/regr.rs:638-671 — 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:563 — datafusion/physical-plan/src/filter.rs:563-619 | datafusion/physical-plan/src/joins/asof_join.rs:257-293 | datafusion/physical-plan/src/joins/hash_join/exec.rs:1303-1360 | datafusion/physical-plan/src/joins/nested_loop_join.rs:381-438 — 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:473 — datafusion/physical-plan/src/joins/asof_join.rs:473-530 | datafusion/physical-plan/src/joins/asof_join.rs:544-571 | datafusion/physical-plan/src/joins/hash_join/exec.rs:1688-1854 | datafusion/physical-plan/src/joins/nested_loop_join.rs:671-778 — 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:576 — datafusion/physical-plan/src/joins/asof_join.rs:576-650 | datafusion/physical-plan/src/joins/hash_join/exec.rs:2124-2237 | datafusion/physical-plan/src/joins/sort_merge_join/exec.rs:854-938 | datafusion/physical-plan/src/joins/symmetric_hash_join.rs:661-778 — 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.
D4 · Code Duplication · Edited copy of a member (20 corresponding lines) · ×9
  • Edited copy of a member (20 corresponding lines) datafusion/expr-common/src/type_coercion/binary.rs:2116 — datafusion/expr-common/src/type_coercion/binary.rs:2116-2135 | datafusion/expr-common/src/type_coercion/binary.rs:2153-2182 — These two members are one piece of code written twice and then edited apart: 20 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.
  • Edited copy of a member (20 corresponding lines) datafusion/functions-aggregate/src/first_last.rs:321 — datafusion/functions-aggregate/src/first_last.rs:321-340 | datafusion/functions-aggregate/src/first_last.rs:1648-1667 — These two members are one piece of code written twice and then edited apart: 20 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.
  • Edited copy of a member (20 corresponding lines) datafusion/functions/src/string/ascii.rs:166 — datafusion/functions/src/string/ascii.rs:166-185 | datafusion/functions/src/unicode/character_length.rs:101-120 — These two members are one piece of code written twice and then edited apart: 20 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.
  • Edited copy of a member (20 corresponding lines) datafusion/expr/src/logical_plan/invariants.rs:61 — datafusion/expr/src/logical_plan/invariants.rs:61-83 | datafusion/expr/src/logical_plan/invariants.rs:117-136 — These two members are one piece of code written twice and then edited apart: 20 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.
  • Edited copy of a member (20 corresponding lines) datafusion/expr/src/utils.rs:1292 — datafusion/expr/src/utils.rs:1292-1311 | datafusion/expr/src/utils.rs:1316-1335 — These two members are one piece of code written twice and then edited apart: 20 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.
  • Edited copy of a member (20 corresponding lines) datafusion/physical-expr/src/higher_order_function.rs:234 — datafusion/physical-expr/src/higher_order_function.rs:234-256 | datafusion/physical-expr/src/scalar_function.rs:194-213 — These two members are one piece of code written twice and then edited apart: 20 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.
  • Edited copy of a member (20 corresponding lines) datafusion/expr/src/type_coercion/functions.rs:1066 — datafusion/expr/src/type_coercion/functions.rs:1066-1086 | datafusion/expr/src/type_coercion/functions.rs:1094-1113 — These two members are one piece of code written twice and then edited apart: 20 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.
  • Edited copy of a member (20 corresponding lines) datafusion/functions-aggregate/src/first_last.rs:342 — datafusion/functions-aggregate/src/first_last.rs:342-361 | datafusion/functions-aggregate/src/first_last.rs:1669-1688 — These two members are one piece of code written twice and then edited apart: 20 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.
  • Edited copy of a member (20 corresponding lines) datafusion/catalog/src/information_schema.rs:541 — datafusion/catalog/src/information_schema.rs:541-560 | datafusion/catalog/src/information_schema.rs:577-601 — These two members are one piece of code written twice and then edited apart: 20 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.
D17 · Explicit Debt · FixmeComment · ×8
  • FixmeComment datafusion/substrait/src/physical_plan/producer.rs:71 — // 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:84 — // 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:104 — // 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.
  • FixmeComment datafusion/sql/tests/sql_integration.rs:1340 — // 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:3661 — /// 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:3764 — /// 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/sql/src/expr/value.rs:128 — // 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/expr/src/utils.rs:1782 — // 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.
D17 · Explicit Debt · HackComment · ×8
  • HackComment datafusion/sqllogictest/src/engines/postgres_engine/mod.rs:160 — // 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.
  • HackComment datafusion/physical-plan/src/joins/nested_loop_join.rs:3295 — // 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:4190 — // 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:4270 — // 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/physical-plan/src/aggregates/clustered_final_stream.rs:109 — // HACK: Full group clustering uses a non-spilling execution — 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:1880 — // 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/functions/src/unicode/substr.rs:297 — // 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/core/tests/fuzz_cases/sort_query_fuzz.rs:305 — /// 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.
D2 · Cognitive Complexity · Unparser · ×8
  • Unparser::select_to_sql_recursively (cognitive 270) datafusion/sql/src/unparser/plan.rs:837 — Unparser::select_to_sql_recursively has cognitive complexity 270 (threshold 15). Drivers by points: if/else 94 (224 pts), match/switch 9 (23 pts), boolean chains 16, loops 3 (7 pts) (nesting depth added 148). 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 48) datafusion/sql/src/unparser/plan.rs:2530 — Unparser::unparse_table_scan_pushdown has cognitive complexity 48 (threshold 15). Drivers by points: if/else 19 (39 pts), boolean chains 6, match/switch 2 (3 pts) (nesting depth added 21). 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::expr_to_sql_inner (cognitive 40) datafusion/sql/src/unparser/expr.rs:150 — Unparser::expr_to_sql_inner has cognitive complexity 40 (threshold 15). Drivers by points: if/else 18 (31 pts), match/switch 5 (9 pts) (nesting depth added 17). 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:1941 — 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:1695 — 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:2089 — 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:307 — 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:56 — 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:82 — 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::logical_plan::consumer::rel::read_rel::from_read_rel (cognitive 35) datafusion/substrait/src/logical_plan/consumer/rel/read_rel.rs:25 — 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::physical_plan::consumer::from_substrait_rel (cognitive 35) datafusion/substrait/src/physical_plan/consumer.rs:36 — 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::aggregate_rel::from_aggregate_rel (cognitive 24) datafusion/substrait/src/logical_plan/consumer/rel/aggregate_rel.rs:18 — 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:126 — 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:32 — 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:32 — 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 · Edited copy of a member (6 corresponding lines) · ×8
  • Edited copy of a member (6 corresponding lines) datafusion/common/src/utils/mod.rs:713 — datafusion/common/src/utils/mod.rs:713-720 | datafusion/common/src/utils/mod.rs:728-733 — These two members are one piece of code written twice and then edited apart: 6 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.
  • Edited copy of a member (6 corresponding lines) datafusion/functions/src/core/cast_to_type.rs:92 — datafusion/functions/src/core/cast_to_type.rs:92-102 | datafusion/functions/src/core/try_cast_to_type.rs:84-89 — These two members are one piece of code written twice and then edited apart: 6 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.
  • Edited copy of a member (6 corresponding lines) datafusion/pruning/src/primitive_in_list.rs:272 — datafusion/pruning/src/primitive_in_list.rs:272-278 | datafusion/pruning/src/string_in_list.rs:115-120 — These two members are one piece of code written twice and then edited apart: 6 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.
  • Edited copy of a member (6 corresponding lines) datafusion/physical-expr/src/intervals/cp_solver.rs:572 — datafusion/physical-expr/src/intervals/cp_solver.rs:572-577 | datafusion/physical-expr/src/statistics/stats_solver.rs:119-124 — These two members are one piece of code written twice and then edited apart: 6 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.
  • Edited copy of a member (6 corresponding lines) datafusion/pruning/src/primitive_in_list.rs:290 — datafusion/pruning/src/primitive_in_list.rs:290-296 | datafusion/pruning/src/string_in_list.rs:124-129 — These two members are one piece of code written twice and then edited apart: 6 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.
  • Edited copy of a member (6 corresponding lines) datafusion/functions-nested/src/array_has.rs:1048 — datafusion/functions-nested/src/array_has.rs:1048-1053 | datafusion/functions-nested/src/dimension.rs:132-137 — These two members are one piece of code written twice and then edited apart: 6 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.
  • Edited copy of a member (6 corresponding lines) datafusion/common/src/functional_dependencies.rs:845 — datafusion/common/src/functional_dependencies.rs:845-850 | datafusion/physical-expr/src/utils/mod.rs:195-200 — These two members are one piece of code written twice and then edited apart: 6 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.
  • Edited copy of a member (6 corresponding lines) datafusion/functions-nested/src/dimension.rs:67 — datafusion/functions-nested/src/dimension.rs:67-72 | datafusion/functions-nested/src/empty.rs:60-65 — These two members are one piece of code written twice and then edited apart: 6 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.
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:56 — 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:82 — 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:42 — 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:29 — 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:25 — 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:36 — 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:32 — 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.
D4 · Code Duplication · Edited copy of a member (29 corresponding lines) · ×7
  • Edited copy of a member (29 corresponding lines) datafusion/functions/src/unicode/substr.rs:327 — datafusion/functions/src/unicode/substr.rs:327-371 | datafusion/functions/src/unicode/substr.rs:376-404 — These two members are one piece of code written twice and then edited apart: 29 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.
  • Edited copy of a member (29 corresponding lines) datafusion/physical-plan/src/joins/asof_join.rs:1135 — datafusion/physical-plan/src/joins/asof_join.rs:1135-1163 | datafusion/physical-plan/src/joins/asof_join.rs:1165-1196 — These two members are one piece of code written twice and then edited apart: 29 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.
  • Edited copy of a member (29 corresponding lines) datafusion/functions-aggregate/src/approx_median.rs:77 — datafusion/functions-aggregate/src/approx_median.rs:77-105 | datafusion/functions-aggregate/src/approx_percentile_cont.rs:237-278 — These two members are one piece of code written twice and then edited apart: 29 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.
  • Edited copy of a member (29 corresponding lines) datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs:364 — datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs:364-400 | datafusion/physical-plan/src/windows/window_agg_exec.rs:160-188 — These two members are one piece of code written twice and then edited apart: 29 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.
  • Edited copy of a member (29 corresponding lines) datafusion/functions-aggregate/src/min_max.rs:252 — datafusion/functions-aggregate/src/min_max.rs:252-280 | datafusion/functions-aggregate/src/min_max.rs:485-513 — These two members are one piece of code written twice and then edited apart: 29 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.
  • Edited copy of a member (29 corresponding lines) datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs:1151 — datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs:1151-1186 | datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs:1352-1380 — These two members are one piece of code written twice and then edited apart: 29 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.
  • Edited copy of a member (29 corresponding lines) datafusion/physical-plan/src/coalesce_partitions.rs:392 — datafusion/physical-plan/src/coalesce_partitions.rs:392-420 | datafusion/physical-plan/src/scalar_subquery.rs:272-308 — These two members are one piece of code written twice and then edited apart: 29 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 · Duplicated block (16 lines × 2) · ×7
  • Duplicated block (16 lines × 2) datafusion/expr/src/udaf.rs:1157 — datafusion/expr/src/udaf.rs:1157-1172 | datafusion/expr/src/udaf.rs:1346-1361 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/expr/src/udaf.rs:1157` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 2) datafusion/functions-aggregate-common/src/aggregate/count_distinct/bytes.rs:67 — datafusion/functions-aggregate-common/src/aggregate/count_distinct/bytes.rs:67-82 | datafusion/functions-aggregate-common/src/aggregate/count_distinct/bytes.rs:130-145 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/functions-aggregate-common/src/aggregate/count_distinct/bytes.rs:67` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 2) datafusion/functions-aggregate/src/array_agg.rs:1359 — datafusion/functions-aggregate/src/array_agg.rs:1359-1374 | datafusion/functions-aggregate/src/array_agg.rs:1549-1564 — 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:160 — datafusion/functions-nested/src/reverse.rs:160-175 | datafusion/functions-nested/src/reverse.rs:226-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 (16 lines × 2) datafusion/functions/src/regex/regexpcount.rs:443 — datafusion/functions/src/regex/regexpcount.rs:443-458 | datafusion/functions/src/regex/regexpcount.rs:479-494 — 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:38 — datafusion/optimizer/src/analyzer/function_rewrite.rs:38-53 | datafusion/optimizer/src/analyzer/type_coercion.rs:213-228 — 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:566 — datafusion/physical-plan/src/aggregates/hash_stream.rs:566-581 | datafusion/physical-plan/src/aggregates/single_stream.rs:177-192 — 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 × 2) · ×7
  • Duplicated block (9–10 lines × 2) datafusion/expr/src/expr.rs:1972 — datafusion/expr/src/expr.rs:1972-1980 | datafusion/optimizer/src/optimize_projections/mod.rs:719-728 — 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–10 lines × 2) datafusion/functions/src/core/overlay.rs:270 — datafusion/functions/src/core/overlay.rs:270-278 | datafusion/functions/src/core/overlay.rs:282-291 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/functions/src/core/overlay.rs:270` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9–10 lines × 2) datafusion/functions/src/string/chr.rs:39 — datafusion/functions/src/string/chr.rs:39-47 | datafusion/functions/src/string/chr.rs:51-60 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/functions/src/string/chr.rs:39` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9–10 lines × 2) datafusion/functions/src/string/repeat.rs:326 — datafusion/functions/src/string/repeat.rs:326-334 | datafusion/functions/src/string/split_part.rs:536-545 — 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:334 — datafusion/functions/src/string/repeat.rs:334-342 | datafusion/functions/src/string/repeat.rs:347-356 — 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-optimizer/src/projection_pushdown.rs:453 — datafusion/physical-optimizer/src/projection_pushdown.rs:453-461 | datafusion/physical-optimizer/src/projection_pushdown.rs:674-683 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-optimizer/src/projection_pushdown.rs:453` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9–10 lines × 2) datafusion/physical-plan/src/joins/asof_join.rs:733 — datafusion/physical-plan/src/joins/asof_join.rs:733-741 | datafusion/physical-plan/src/joins/sort_merge_join/exec.rs:1025-1034 — 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 51 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/joins/asof_join.rs:733` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D1 · Cyclomatic Complexity · datafusion_functions · ×6
  • datafusion_functions::datetime::date_bin::date_bin_impl (cyclomatic 37) datafusion/functions/src/datetime/date_bin.rs:630 — 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:248 — 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:460 — 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::string::concat::simplify_concat (cyclomatic 21) datafusion/functions/src/string/concat.rs:296 — 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:349 — 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:1281 — 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::constant_granularity_step (cyclomatic 29) 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_physical_plan · ×6
  • datafusion_physical_plan::joins::utils::compare_join_arrays (cyclomatic 36) datafusion/physical-plan/src/joins/utils.rs:2797 — 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:372 — 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::nested_loop_join::build_unmatched_batch (cyclomatic 19) datafusion/physical-plan/src/joins/nested_loop_join.rs:4149 — 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::joins::hash_join::exec::build_in_memory (cyclomatic 18) datafusion/physical-plan/src/joins/hash_join/exec.rs:3229 — datafusion_physical_plan::joins::hash_join::exec::build_in_memory 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.
  • datafusion_physical_plan::projection::try_pushdown_through_join_with_column_indices (cyclomatic 18) datafusion/physical-plan/src/projection.rs:940 — 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.
  • datafusion_physical_plan::joins::hash_join::not_in::mark_null_candidates_for_probe_batch (cyclomatic 17) datafusion/physical-plan/src/joins/hash_join/not_in.rs:826 — datafusion_physical_plan::joins::hash_join::not_in::mark_null_candidates_for_probe_batch 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.
D2 · Cognitive Complexity · ScalarValue · ×6
  • ScalarValue::deserialize (cognitive 139) datafusion/proto-common/src/generated/pbjson.rs:8916 — 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:3103 — 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:3745 — 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:669 — 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:307 — 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:385 — 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:571 — 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::invariants::check_subquery_expr (cognitive 38) datafusion/expr/src/logical_plan/invariants.rs:145 — datafusion_expr::logical_plan::invariants::check_subquery_expr has cognitive complexity 38 (threshold 15). Drivers by points: if/else 12 (25 pts), match/switch 4 (11 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:1202 — 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::expr_rewriter::guarantees::rewrite_between (cognitive 20) datafusion/expr/src/expr_rewriter/guarantees.rs:117 — 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.
  • datafusion_expr::logical_plan::builder::recursive_type_can_be_coerced (cognitive 20) datafusion/expr/src/logical_plan/builder.rs:81 — datafusion_expr::logical_plan::builder::recursive_type_can_be_coerced has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 6, match/switch 2 (3 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.
  • datafusion_expr::type_coercion::functions::value_fields_with_higher_order_udf (cognitive 20) datafusion/expr/src/type_coercion/functions.rs:156 — 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.
D4 · Code Duplication · Edited copy of a member (26 corresponding lines) · ×6
  • Edited copy of a member (26 corresponding lines) datafusion/physical-expr/src/simplifier/const_evaluator.rs:37 — datafusion/physical-expr/src/simplifier/const_evaluator.rs:37-68 | datafusion/physical-expr/src/simplifier/const_evaluator.rs:83-142 — 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.
  • Edited copy of a member (26 corresponding lines) datafusion/functions/src/math/round.rs:645 — datafusion/functions/src/math/round.rs:645-674 | datafusion/functions/src/math/round.rs:683-708 — 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.
  • Edited copy of a member (26 corresponding lines) datafusion/datasource-avro/src/source.rs:208 — datafusion/datasource-avro/src/source.rs:208-233 | datafusion/datasource-json/src/source.rs:319-355 — 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.
  • Edited copy of a member (26 corresponding lines) datafusion/physical-expr/src/expressions/cast.rs:689 — datafusion/physical-expr/src/expressions/cast.rs:689-717 | datafusion/physical-expr/src/expressions/try_cast.rs:210-235 — 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.
  • Edited copy of a member (26 corresponding lines) datafusion/ffi/src/udaf/accumulator_args.rs:40 — datafusion/ffi/src/udaf/accumulator_args.rs:40-71 | datafusion/ffi/src/udaf/accumulator_args.rs:93-118 — 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.
  • Edited copy of a member (26 corresponding lines) datafusion/expr-common/src/interval_arithmetic.rs:464 — datafusion/expr-common/src/interval_arithmetic.rs:464-489 | datafusion/expr-common/src/interval_arithmetic.rs:498-523 — 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) · ×6
  • Edited copy of a member (33 corresponding lines) datafusion/expr-common/src/interval_arithmetic.rs:1576 — datafusion/expr-common/src/interval_arithmetic.rs:1576-1608 | datafusion/expr-common/src/interval_arithmetic.rs:1689-1721 — 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.
  • Edited copy of a member (33 corresponding lines) datafusion/physical-plan/src/aggregates/clustered_final_stream.rs:268 — datafusion/physical-plan/src/aggregates/clustered_final_stream.rs:268-300 | datafusion/physical-plan/src/aggregates/single_stream.rs:263-295 — 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.
  • Edited copy of a member (33 corresponding lines) datafusion/sqllogictest/src/engines/datafusion_engine/runner.rs:133 — datafusion/sqllogictest/src/engines/datafusion_engine/runner.rs:133-165 | datafusion/sqllogictest/src/engines/datafusion_substrait_roundtrip_engine/runner.rs:87-124 — 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.
  • Edited copy of a member (33 corresponding lines) datafusion/common/src/hash_utils.rs:149 — datafusion/common/src/hash_utils.rs:149-181 | datafusion/common/src/hash_utils/build_hasher.rs:45-80 — 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.
  • Edited copy of a member (33 corresponding lines) datafusion/functions/src/core/arrow_cast.rs:146 — datafusion/functions/src/core/arrow_cast.rs:146-181 | datafusion/functions/src/core/arrow_try_cast.rs:119-151 — 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.
  • Edited copy of a member (33 corresponding lines) datafusion/physical-expr/src/expressions/cast.rs:302 — datafusion/physical-expr/src/expressions/cast.rs:302-339 | datafusion/physical-expr/src/expressions/try_cast.rs:151-183 — 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 (30 corresponding lines) · ×6
  • Edited copy of a member (30 corresponding lines) datafusion/common/src/hash_utils.rs:791 — datafusion/common/src/hash_utils.rs:791-833 | datafusion/common/src/hash_utils.rs:889-918 — These two members are one piece of code written twice and then edited apart: 30 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.
  • Edited copy of a member (30 corresponding lines) datafusion/ffi/src/proto/logical_extension_codec.rs:300 — datafusion/ffi/src/proto/logical_extension_codec.rs:300-329 | datafusion/ffi/src/proto/physical_extension_codec.rs:286-315 — These two members are one piece of code written twice and then edited apart: 30 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.
  • Edited copy of a member (30 corresponding lines) datafusion/proto-common/src/from_proto/mod.rs:801 — datafusion/proto-common/src/from_proto/mod.rs:801-836 | datafusion/proto-common/src/from_proto/mod.rs:840-869 — These two members are one piece of code written twice and then edited apart: 30 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.
  • Edited copy of a member (30 corresponding lines) datafusion/physical-plan/src/aggregates/hash_stream.rs:469 — datafusion/physical-plan/src/aggregates/hash_stream.rs:469-498 | datafusion/physical-plan/src/aggregates/partial_reduce_stream.rs:299-330 — These two members are one piece of code written twice and then edited apart: 30 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.
  • Edited copy of a member (30 corresponding lines) datafusion/physical-plan/src/async_func.rs:271 — datafusion/physical-plan/src/async_func.rs:271-300 | datafusion/physical-plan/src/windows/window_agg_exec.rs:347-396 — These two members are one piece of code written twice and then edited apart: 30 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.
  • Edited copy of a member (30 corresponding lines) datafusion/physical-plan/src/joins/sort_merge_join/bitwise_stream.rs:897 — datafusion/physical-plan/src/joins/sort_merge_join/bitwise_stream.rs:897-929 | datafusion/physical-plan/src/joins/sort_merge_join/bitwise_stream.rs:936-965 — These two members are one piece of code written twice and then edited apart: 30 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 copies of one member (3 members, 9+ corresponding lines) · ×6
  • Edited copies of one member (3 members, 9+ corresponding lines) datafusion/expr-common/src/interval_arithmetic.rs:1886 — datafusion/expr-common/src/interval_arithmetic.rs:1886-1894 | datafusion/expr-common/src/interval_arithmetic.rs:1904-1912 | datafusion/expr-common/src/interval_arithmetic.rs:1922-1930 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 9+ corresponding lines) datafusion/functions-aggregate/src/average.rs:615 — datafusion/functions-aggregate/src/average.rs:615-623 | datafusion/functions-aggregate/src/average.rs:798-807 | datafusion/functions-aggregate/src/average.rs:851-859 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 9+ corresponding lines) datafusion/common/src/scalar/mod.rs:3619 — datafusion/common/src/scalar/mod.rs:3619-3631 | datafusion/common/src/scalar/mod.rs:3682-3694 | datafusion/common/src/scalar/mod.rs:3726-3734 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 9+ corresponding lines) datafusion/core/src/bin/print_functions_docs.rs:44 — datafusion/core/src/bin/print_functions_docs.rs:44-52 | datafusion/core/src/bin/print_functions_docs.rs:54-66 | datafusion/core/src/bin/print_functions_docs.rs:68-76 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 9+ corresponding lines) datafusion/datasource-arrow/src/file_format.rs:261 — datafusion/datasource-arrow/src/file_format.rs:261-269 | datafusion/datasource-avro/src/file_format.rs:167-175 | datafusion/datasource-json/src/file_format.rs:350-360 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 9+ corresponding lines) datafusion/functions-nested/src/array_filter.rs:70 — datafusion/functions-nested/src/array_filter.rs:70-78 | datafusion/functions-nested/src/array_first.rs:68-76 | datafusion/functions-nested/src/array_transform.rs:71-79 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (11 lines × 3) · ×6
  • Duplicated block (11 lines × 3) datafusion/catalog/src/information_schema.rs:638 — datafusion/catalog/src/information_schema.rs:638-648 | datafusion/catalog/src/information_schema.rs:658-668 | datafusion/catalog/src/information_schema.rs:678-688 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/catalog/src/information_schema.rs:638` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 3) datafusion/functions-aggregate/src/first_last/state.rs:214 — datafusion/functions-aggregate/src/first_last/state.rs:214-224 | datafusion/functions-aggregate/src/first_last/state.rs:228-238 | datafusion/functions-aggregate/src/first_last/state.rs:241-251 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/functions-aggregate/src/first_last/state.rs:214` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 3) datafusion/functions/src/regex/regexpcount.rs:406 — datafusion/functions/src/regex/regexpcount.rs:406-416 | datafusion/functions/src/regex/regexpcount.rs:443-453 | datafusion/functions/src/regex/regexpcount.rs:479-489 — 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:83 — datafusion/functions/src/string/btrim.rs:83-93 | datafusion/functions/src/string/ltrim.rs:88-98 | datafusion/functions/src/string/rtrim.rs:88-98 — 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 39 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/physical-plan/src/joins/hash_join/exec.rs:1505 — datafusion/physical-plan/src/joins/hash_join/exec.rs:1505-1515 | datafusion/physical-plan/src/joins/sort_merge_join/exec.rs:554-564 | datafusion/physical-plan/src/joins/symmetric_hash_join.rs:379-389 — `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 34 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/joins/hash_join/exec.rs:1505` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 3) datafusion/functions-aggregate/src/correlation.rs:112 — datafusion/functions-aggregate/src/correlation.rs:112-122 | datafusion/functions-aggregate/src/covariance.rs:96-106 | datafusion/functions-aggregate/src/covariance.rs:186-196 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `datafusion/functions-aggregate/src/correlation.rs:140` calls `corr` and `datafusion/functions-aggregate/src/covariance.rs:124` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (9 lines × 3) · ×6
  • Duplicated block (9 lines × 3) datafusion/datasource/src/boundary_stream.rs:228 — datafusion/datasource/src/boundary_stream.rs:228-236 | datafusion/datasource/src/boundary_stream.rs:269-277 | datafusion/datasource/src/boundary_stream.rs:366-374 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/datasource/src/boundary_stream.rs:228` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (9 lines × 3) 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 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/ffi/src/catalog_provider.rs:185` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `datafusion/ffi/src/schema_provider.rs:204` calls `clone` and `datafusion/ffi/src/catalog_provider.rs:196` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9 lines × 3) datafusion/functions-nested/src/except.rs:209 — datafusion/functions-nested/src/except.rs:209-217 | datafusion/functions-nested/src/set_ops.rs:480-488 | datafusion/functions-nested/src/set_ops.rs:591-599 — 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/physical-plan/src/buffer.rs:291 — datafusion/physical-plan/src/buffer.rs:291-299 | datafusion/physical-plan/src/coalesce_batches.rs:268-276 | datafusion/physical-plan/src/coop.rs:340-348 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/buffer.rs:291` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 3) datafusion/physical-plan/src/joins/asof_join.rs:682 — datafusion/physical-plan/src/joins/asof_join.rs:682-690 | datafusion/physical-plan/src/joins/sort_merge_join/exec.rs:977-985 | datafusion/physical-plan/src/joins/symmetric_hash_join.rs:820-829 — 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 51 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/joins/asof_join.rs:682` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 3) datafusion/sqllogictest/src/test_context/range_partitioning.rs:119 — datafusion/sqllogictest/src/test_context/range_partitioning.rs:119-127 | datafusion/sqllogictest/src/test_context/range_partitioning.rs:144-152 | datafusion/sqllogictest/src/test_context/range_partitioning.rs:167-175 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/sqllogictest/src/test_context/range_partitioning.rs:119` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `datafusion/sqllogictest/src/test_context/range_partitioning.rs:117` calls `Int32`, `Some` and `datafusion/sqllogictest/src/test_context/range_partitioning.rs:142` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8 lines × 3) · ×6
  • Duplicated block (8 lines × 3) datafusion/common/src/scalar/mod.rs:2827 — datafusion/common/src/scalar/mod.rs:2827-2834 | datafusion/common/src/scalar/mod.rs:5088-5095 | datafusion/common/src/scalar/mod.rs:5223-5230 — 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:289 — datafusion/functions-aggregate/src/average.rs:289-296 | datafusion/functions-aggregate/src/average.rs:311-318 | datafusion/functions-aggregate/src/average.rs:414-421 — 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:341 — datafusion/functions-aggregate/src/covariance.rs:341-348 | datafusion/functions-aggregate/src/regr.rs:678-685 | datafusion/functions-aggregate/src/variance.rs:378-385 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/functions-aggregate/src/variance.rs:378` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 3) datafusion/functions-table/src/generate_series.rs:918 — datafusion/functions-table/src/generate_series.rs:918-925 | datafusion/functions-table/src/generate_series.rs:944-951 | datafusion/functions-table/src/generate_series.rs:972-979 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/functions-table/src/generate_series.rs:918` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 3) datafusion/functions/src/string/levenshtein.rs:245 — datafusion/functions/src/string/levenshtein.rs:245-252 | datafusion/functions/src/string/levenshtein.rs:265-272 | datafusion/functions/src/string/levenshtein.rs:285-292 — 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/common/src/scalar/mod.rs:1761 — datafusion/common/src/scalar/mod.rs:1761-1768 | datafusion/common/src/scalar/mod.rs:2003-2010 | datafusion/common/src/scalar/mod.rs:2154-2161 — 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) · ×6
  • Duplicated block (7 lines × 3) datafusion/datasource-avro/src/source.rs:135 — datafusion/datasource-avro/src/source.rs:135-141 | datafusion/datasource-csv/src/source.rs:640-646 | datafusion/datasource-json/src/source.rs:240-246 — before extracting anything, compare `datafusion/datasource-csv/src/source.rs` and `datafusion/datasource-json/src/source.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 57 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (7 lines × 3) datafusion/functions-aggregate/src/first_last.rs:326 — datafusion/functions-aggregate/src/first_last.rs:326-332 | datafusion/functions-aggregate/src/first_last.rs:1653-1659 | datafusion/functions-aggregate/src/nth_value.rs:146-152 — 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 (7 lines × 3) datafusion/functions-nested/src/arrays_zip.rs:172 — datafusion/functions-nested/src/arrays_zip.rs:172-178 | datafusion/functions-nested/src/arrays_zip.rs:184-190 | datafusion/functions-nested/src/arrays_zip.rs:195-201 — 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/functions/src/string/btrim.rs:23 — datafusion/functions/src/string/btrim.rs:23-29 | datafusion/functions/src/string/ltrim.rs:24-30 | datafusion/functions/src/string/rtrim.rs:24-30 — 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 39 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/functions/src/string/btrim.rs:23` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 3) datafusion/ffi/src/execution/task_ctx.rs:140 — datafusion/ffi/src/execution/task_ctx.rs:140-146 | datafusion/ffi/src/execution/task_ctx_provider.rs:97-103 | datafusion/ffi/src/session/mod.rs:361-367 — 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:111 — datafusion/sqllogictest/src/test_context/range_partitioning.rs:111-117 | datafusion/sqllogictest/src/test_context/range_partitioning.rs:134-143 | datafusion/sqllogictest/src/test_context/range_partitioning.rs:159-165 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/sqllogictest/src/test_context/range_partitioning.rs:111` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `datafusion/sqllogictest/src/test_context/range_partitioning.rs:119` calls `Int32`, `Some` and `datafusion/sqllogictest/src/test_context/range_partitioning.rs:145` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D1 · Cyclomatic Complexity · datafusion_expr · ×5
  • datafusion_expr::type_coercion::functions::get_valid_types (cyclomatic 66) datafusion/expr/src/type_coercion/functions.rs:571 — 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::logical_plan::builder::recursive_type_can_be_coerced (cyclomatic 23) datafusion/expr/src/logical_plan/builder.rs:81 — datafusion_expr::logical_plan::builder::recursive_type_can_be_coerced has cyclomatic complexity 23 (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::higher_order_function::resolve_higher_order_function (cyclomatic 19) datafusion/expr/src/higher_order_function.rs:1202 — 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 18) datafusion/expr/src/logical_plan/invariants.rs:145 — datafusion_expr::logical_plan::invariants::check_subquery_expr 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_expr::type_coercion::functions::value_fields_with_higher_order_udf (cyclomatic 16) datafusion/expr/src/type_coercion/functions.rs:156 — 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.
D1 · Cyclomatic Complexity · LogicalPlan · ×5
  • LogicalPlan::display (cyclomatic 65) datafusion/expr/src/logical_plan/plan.rs:2173 — LogicalPlan::display 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.
  • LogicalPlan::with_new_exprs (cyclomatic 42) datafusion/expr/src/logical_plan/plan.rs:910 — LogicalPlan::with_new_exprs has cyclomatic complexity 42 (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:1533 — 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 24) datafusion/expr/src/logical_plan/tree_node.rs:550 — LogicalPlan::map_expressions 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. This is NOT this file's highest cyclomatic complexity: LogicalPlan::map_children (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.
  • LogicalPlan::head_output_expr (cyclomatic 18) datafusion/expr/src/logical_plan/plan.rs:612 — LogicalPlan::head_output_expr 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. This is NOT this file's highest cyclomatic complexity: LogicalPlan::schema (cyclomatic 29) 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_physical_optimizer · ×5
  • datafusion_physical_optimizer::ensure_requirements::enforce_distribution::ensure_distribution_with_stats (cyclomatic 34) datafusion/physical-optimizer/src/ensure_requirements/enforce_distribution.rs:1653 — datafusion_physical_optimizer::ensure_requirements::enforce_distribution::ensure_distribution_with_stats 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.
  • datafusion_physical_optimizer::ensure_requirements::enforce_distribution::enforce_distribution_relationships (cyclomatic 27) datafusion/physical-optimizer/src/ensure_requirements/enforce_distribution.rs:1408 — 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_requirement_to_children (cyclomatic 25) datafusion/physical-optimizer/src/ensure_requirements/enforce_sorting/sort_pushdown.rs:442 — datafusion_physical_optimizer::ensure_requirements::enforce_sorting::sort_pushdown::pushdown_requirement_to_children 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.
  • datafusion_physical_optimizer::ensure_requirements::enforce_sorting::sort_pushdown::pushdown_sorts_helper (cyclomatic 22) datafusion/physical-optimizer/src/ensure_requirements/enforce_sorting/sort_pushdown.rs:215 — datafusion_physical_optimizer::ensure_requirements::enforce_sorting::sort_pushdown::pushdown_sorts_helper 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.
  • datafusion_physical_optimizer::ensure_requirements::enforce_distribution::adjust_input_keys_ordering (cyclomatic 17) datafusion/physical-optimizer/src/ensure_requirements/enforce_distribution.rs:123 — 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 · datafusion_expr_common · ×5
  • datafusion_expr_common::type_coercion::binary::try_type_union_resolution_with_struct (cognitive 32) datafusion/expr-common/src/type_coercion/binary.rs:887 — 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:700 — 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:709 — 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:1395 — 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.
  • datafusion_expr_common::casts::is_exact_cast_safe (cognitive 17) datafusion/expr-common/src/casts.rs:220 — datafusion_expr_common::casts::is_exact_cast_safe has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 5, 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.
D4 · Code Duplication · Edited copies of one member (3 members, 13+ corresponding lines) · ×5
  • Edited copies of one member (3 members, 13+ corresponding lines) datafusion/expr-common/src/interval_arithmetic.rs:1063 — datafusion/expr-common/src/interval_arithmetic.rs:1063-1075 | datafusion/expr-common/src/interval_arithmetic.rs:1088-1100 | datafusion/expr-common/src/interval_arithmetic.rs:1113-1125 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 13+ corresponding lines) datafusion/functions/src/math/monotonicity.rs:14 — datafusion/functions/src/math/monotonicity.rs:14-26 | datafusion/functions/src/math/monotonicity.rs:93-105 | datafusion/functions/src/math/monotonicity.rs:190-202 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 13+ corresponding lines) datafusion/functions/src/unicode/find_in_set.rs:54 — datafusion/functions/src/unicode/find_in_set.rs:54-66 | datafusion/functions/src/unicode/substrindex.rs:72-85 | datafusion/functions/src/unicode/translate.rs:56-68 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 13+ corresponding lines) datafusion/ffi/src/physical_expr/mod.rs:243 — datafusion/ffi/src/physical_expr/mod.rs:243-257 | datafusion/ffi/src/physical_expr/mod.rs:293-306 | datafusion/ffi/src/physical_expr/mod.rs:340-352 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 13+ corresponding lines) datafusion/expr/src/utils.rs:795 — datafusion/expr/src/utils.rs:795-807 | datafusion/expr/src/utils.rs:892-908 | datafusion/physical-expr/src/simplifier/const_evaluator.rs:234-246 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 14+ corresponding lines) · ×5
  • Edited copies of one member (3 members, 14+ corresponding lines) datafusion/functions/src/math/log.rs:124 — datafusion/functions/src/math/log.rs:124-137 | datafusion/functions/src/math/log.rs:142-155 | datafusion/functions/src/math/log.rs:160-173 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 14+ corresponding lines) datafusion/functions/src/utils.rs:298 — datafusion/functions/src/utils.rs:298-311 | datafusion/functions/src/utils.rs:313-326 | datafusion/functions/src/utils.rs:328-341 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 14+ corresponding lines) datafusion/ffi/src/schema_provider.rs:115 — datafusion/ffi/src/schema_provider.rs:115-132 | datafusion/ffi/src/schema_provider.rs:138-153 | datafusion/ffi/src/schema_provider.rs:158-171 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 14+ corresponding lines) datafusion/functions-nested/src/extract.rs:825 — datafusion/functions-nested/src/extract.rs:825-838 | datafusion/functions-nested/src/extract.rs:915-932 | datafusion/functions-nested/src/extract.rs:1013-1027 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 14+ corresponding lines) datafusion/functions/src/datetime/date_bin.rs:262 — datafusion/functions/src/datetime/date_bin.rs:262-277 | datafusion/functions/src/math/round.rs:440-453 | datafusion/functions/src/math/trunc.rs:251-264 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (21 lines × 2) · ×5
  • Duplicated block (21 lines × 2) datafusion/functions-aggregate/src/percentile_cont.rs:306 — datafusion/functions-aggregate/src/percentile_cont.rs:306-326 | datafusion/functions-aggregate/src/percentile_cont.rs:339-359 — 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/src/math/ceil.rs:98 — datafusion/functions/src/math/ceil.rs:98-118 | datafusion/functions/src/math/floor.rs:144-164 — 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:447 — datafusion/functions/src/regex/regexpreplace.rs:447-467 | datafusion/functions/src/regex/regexpreplace.rs:517-537 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/functions/src/regex/regexpreplace.rs:447` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (21 lines × 2) datafusion/physical-expr-common/src/binary_map.rs:579 — datafusion/physical-expr-common/src/binary_map.rs:579-599 | datafusion/physical-plan/src/aggregates/group_values/multi_group_by/bytes.rs:354-374 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-expr-common/src/binary_map.rs:579` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (21 lines × 2) datafusion/functions/src/string/ends_with.rs:95 — datafusion/functions/src/string/ends_with.rs:95-115 | datafusion/functions/src/string/starts_with.rs:91-111 — 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 69 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 lines × 2) · ×5
  • Duplicated block (17 lines × 2) datafusion/expr/src/logical_plan/tree_node.rs:1016 — datafusion/expr/src/logical_plan/tree_node.rs:1016-1032 | datafusion/optimizer/src/optimizer.rs:602-618 — 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 (17 lines × 2) datafusion/functions-aggregate/src/stddev.rs:87 — datafusion/functions-aggregate/src/stddev.rs:87-103 | datafusion/functions-aggregate/src/stddev.rs:195-211 — 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/regex/regexpcount.rs:305 — datafusion/functions/src/regex/regexpcount.rs:305-321 | datafusion/functions/src/regex/regexpcount.rs:380-396 — 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:377 — datafusion/physical-expr/src/higher_order_function.rs:377-393 | datafusion/physical-expr/src/scalar_function.rs:267-283 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-expr/src/higher_order_function.rs:377` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17 lines × 2) datafusion/physical-plan/src/aggregates/clustered_single_stream.rs:187 — datafusion/physical-plan/src/aggregates/clustered_single_stream.rs:187-203 | datafusion/physical-plan/src/aggregates/hash_stream.rs:577-593 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/aggregates/clustered_single_stream.rs:187` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (12–13 lines × 2) · ×5
  • Duplicated block (12–13 lines × 2) datafusion/functions-aggregate/src/first_last.rs:1502 — datafusion/functions-aggregate/src/first_last.rs:1502-1514 | datafusion/functions-aggregate/src/first_last.rs:1889-1900 — 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/functions/src/core/overlay.rs:261 — datafusion/functions/src/core/overlay.rs:261-272 | datafusion/functions/src/unicode/translate.rs:192-204 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/functions/src/core/overlay.rs:261` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12–13 lines × 2) datafusion/functions/src/math/abs.rs:164 — datafusion/functions/src/math/abs.rs:164-175 | datafusion/functions/src/math/monotonicity.rs:332-344 — 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/bytes.rs:114 — datafusion/physical-plan/src/aggregates/group_values/multi_group_by/bytes.rs:114-125 | datafusion/physical-plan/src/aggregates/group_values/multi_group_by/fixed_size_binary.rs:139-151 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/aggregates/group_values/multi_group_by/bytes.rs:114` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12–13 lines × 2) datafusion/physical-plan/src/display.rs:280 — datafusion/physical-plan/src/display.rs:280-291 | datafusion/physical-plan/src/display.rs:473-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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/display.rs:280` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (12 lines × 3) · ×5
  • Duplicated block (12 lines × 3) datafusion/datasource-csv/src/file_format.rs:954 — datafusion/datasource-csv/src/file_format.rs:954-965 | datafusion/datasource-json/src/file_format.rs:589-600 | datafusion/datasource-parquet/src/sink.rs:571-582 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/datasource-csv/src/file_format.rs:954` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 3) datafusion/functions-aggregate-common/src/aggregate/count_distinct/bytes.rs:66 — datafusion/functions-aggregate-common/src/aggregate/count_distinct/bytes.rs:66-77 | datafusion/functions-aggregate-common/src/aggregate/count_distinct/bytes.rs:129-140 | datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:91-102 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/functions-aggregate-common/src/aggregate/count_distinct/bytes.rs:66` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 3) datafusion/sql/src/unparser/dialect.rs:497 — datafusion/sql/src/unparser/dialect.rs:497-508 | datafusion/sql/src/unparser/expr.rs:685-696 | datafusion/sql/src/unparser/expr.rs:1827-1838 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/sql/src/unparser/dialect.rs:497` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 3) datafusion/expr-common/src/signature.rs:789 — datafusion/expr-common/src/signature.rs:789-800 | datafusion/expr-common/src/signature.rs:803-814 | datafusion/expr-common/src/signature.rs:817-828 — 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:1070 — datafusion/sql/src/parser.rs:1070-1081 | datafusion/sql/src/parser.rs:1457-1468 | datafusion/sql/src/parser.rs:1492-1503 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/sql/src/parser.rs:1070` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6 lines × 3) · ×5
  • Duplicated block (6 lines × 3) datafusion/execution/src/disk_manager.rs:108 — datafusion/execution/src/disk_manager.rs:108-113 | datafusion/execution/src/disk_manager.rs:120-125 | datafusion/execution/src/disk_manager.rs:129-134 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/execution/src/disk_manager.rs:108` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 3) datafusion/functions/src/unicode/find_in_set.rs:269 — datafusion/functions/src/unicode/find_in_set.rs:269-274 | datafusion/functions/src/unicode/find_in_set.rs:297-302 | datafusion/functions/src/unicode/find_in_set.rs:347-352 — 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/physical-plan/src/aggregates/clustered_partial_stream.rs:144 — datafusion/physical-plan/src/aggregates/clustered_partial_stream.rs:144-149 | datafusion/physical-plan/src/aggregates/hash_stream.rs:212-217 | datafusion/physical-plan/src/aggregates/partial_reduce_stream.rs:104-109 — before extracting anything, compare `datafusion/physical-plan/src/aggregates/hash_stream.rs` and `datafusion/physical-plan/src/aggregates/partial_reduce_stream.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 59 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `datafusion/physical-plan/src/aggregates/hash_stream.rs:218` calls `with_type`, `ratio_metrics` and `datafusion/physical-plan/src/aggregates/partial_reduce_stream.rs:109` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (6 lines × 3) datafusion/functions-aggregate/src/array_agg.rs:158 — datafusion/functions-aggregate/src/array_agg.rs:158-163 | datafusion/functions-aggregate/src/first_last.rs:377-382 | datafusion/functions-aggregate/src/first_last.rs:1693-1698 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/functions-aggregate/src/array_agg.rs:158` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 3) datafusion/sqllogictest/src/test_context/range_partitioning.rs:78 — datafusion/sqllogictest/src/test_context/range_partitioning.rs:78-83 | datafusion/sqllogictest/src/test_context/range_partitioning.rs:118-123 | datafusion/sqllogictest/src/test_context/range_partitioning.rs:166-171 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/sqllogictest/src/test_context/range_partitioning.rs:78` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `datafusion/sqllogictest/src/test_context/range_partitioning.rs:86` calls `join` and `datafusion/sqllogictest/src/test_context/range_partitioning.rs:125` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D1 · Cyclomatic Complexity · Expr · ×4
  • Expr::fmt (cyclomatic 60) datafusion/expr/src/expr.rs:3620 — 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:2426 — 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 40) datafusion/expr/src/expr_schema.rs:299 — Expr::nullable 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.
  • Expr::to_field (cyclomatic 26) datafusion/expr/src/expr_schema.rs:545 — Expr::to_field 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.
D1 · Cyclomatic Complexity · datafusion_functions_nested · ×4
  • datafusion_functions_nested::string::compute_array_to_string (cyclomatic 38) datafusion/functions-nested/src/string.rs:579 — 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:148 — 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:389 — 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:184 — 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:1144 — 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:1343 — 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:1285 — 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:1088 — 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 33) datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs:1640 — MaterializingSortMergeJoinStream::freeze_streamed_matched has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (21 pts), loops 2 (7 pts), match/switch 1 (5 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.
  • MaterializingSortMergeJoinStream::join (cognitive 25) datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs:703 — 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:1384 — 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:1780 — 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 · NestedLoopJoinStream · ×4
  • NestedLoopJoinStream::poll_next (cognitive 27) datafusion/physical-plan/src/joins/nested_loop_join.rs:2271 — 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:3197 — 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::process_left_range_join (cognitive 20) datafusion/physical-plan/src/joins/nested_loop_join.rs:3438 — NestedLoopJoinStream::process_left_range_join has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 2, loops 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.
  • NestedLoopJoinStream::handle_emit_left_unmatched_memory_limited (cognitive 17) datafusion/physical-plan/src/joins/nested_loop_join.rs:3108 — 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.
D3 · God Classes · TooManyFields · ×4
  • TooManyFields: PreparedParquetOpen datafusion/datasource-parquet/src/opener/mod.rs:429 — TooManyFields — 44 stored fields beside 2 methods. The bar is 30 stored fields; this is 14 over it, 1.47× 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:239 — TooManyFields — 33 stored fields beside 32 methods. The bar is 30 stored fields; this is 3 over it, 1.10× 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: MaterializingSortMergeJoinStream datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs:340 — TooManyFields — 31 stored fields beside 42 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.
  • TooManyFields: ParquetMorselizer datafusion/datasource-parquet/src/opener/mod.rs:233 — TooManyFields — 31 stored fields beside 2 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.
D4 · Code Duplication · Edited copy of a member (34 corresponding lines) · ×4
  • Edited copy of a member (34 corresponding lines) datafusion/expr/src/logical_plan/plan.rs:1707 — datafusion/expr/src/logical_plan/plan.rs:1707-1741 | datafusion/expr/src/logical_plan/plan.rs:1748-1781 — These two members are one piece of code written twice and then edited apart: 34 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.
  • Edited copy of a member (34 corresponding lines) datafusion/sql/src/unparser/dialect.rs:914 — datafusion/sql/src/unparser/dialect.rs:914-947 | datafusion/sql/src/unparser/dialect.rs:1137-1170 — These two members are one piece of code written twice and then edited apart: 34 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.
  • Edited copy of a member (34 corresponding lines) datafusion/physical-plan/src/aggregates/mod.rs:2588 — datafusion/physical-plan/src/aggregates/mod.rs:2588-2625 | datafusion/proto/src/physical_plan/to_proto.rs:34-67 — These two members are one piece of code written twice and then edited apart: 34 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.
  • Edited copy of a member (34 corresponding lines) datafusion/functions/src/core/overlay.rs:254 — datafusion/functions/src/core/overlay.rs:254-293 | datafusion/functions/src/unicode/translate.rs:185-218 — These two members are one piece of code written twice and then edited apart: 34 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 (39 corresponding lines) · ×4
  • Edited copy of a member (39 corresponding lines) datafusion/physical-plan/src/aggregates/clustered_final_stream.rs:419 — datafusion/physical-plan/src/aggregates/clustered_final_stream.rs:419-457 | datafusion/physical-plan/src/aggregates/clustered_partial_stream.rs:372-416 — These two members are one piece of code written twice and then edited apart: 39 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.
  • Edited copy of a member (39 corresponding lines) datafusion/functions-aggregate/src/first_last.rs:1482 — datafusion/functions-aggregate/src/first_last.rs:1482-1522 | datafusion/functions-aggregate/src/first_last.rs:1870-1908 — These two members are one piece of code written twice and then edited apart: 39 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.
  • Edited copy of a member (39 corresponding lines) datafusion/common/src/hash_utils.rs:437 — datafusion/common/src/hash_utils.rs:437-482 | datafusion/common/src/hash_utils/build_hasher.rs:290-328 — These two members are one piece of code written twice and then edited apart: 39 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.
  • Edited copy of a member (39 corresponding lines) datafusion/physical-expr/src/expressions/cast.rs:745 — datafusion/physical-expr/src/expressions/cast.rs:745-790 | datafusion/physical-expr/src/expressions/try_cast.rs:244-282 — These two members are one piece of code written twice and then edited apart: 39 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 (27 corresponding lines) · ×4
  • Edited copy of a member (27 corresponding lines) datafusion/datasource/src/file_compression_type.rs:115 — datafusion/datasource/src/file_compression_type.rs:115-141 | datafusion/datasource/src/file_compression_type.rs:210-241 — These two members are one piece of code written twice and then edited apart: 27 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.
  • Edited copy of a member (27 corresponding lines) datafusion/core/src/execution/context/mod.rs:1178 — datafusion/core/src/execution/context/mod.rs:1178-1209 | datafusion/core/src/execution/context/mod.rs:1211-1237 — These two members are one piece of code written twice and then edited apart: 27 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.
  • Edited copy of a member (27 corresponding lines) datafusion/physical-plan/src/unnest.rs:283 — datafusion/physical-plan/src/unnest.rs:283-313 | datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs:510-536 — These two members are one piece of code written twice and then edited apart: 27 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.
  • Edited copy of a member (27 corresponding lines) datafusion/physical-plan/src/coalesce_partitions.rs:73 — datafusion/physical-plan/src/coalesce_partitions.rs:73-99 | datafusion/physical-plan/src/sorts/sort_preserving_merge.rs:151-179 — These two members are one piece of code written twice and then edited apart: 27 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 · Duplicated block (25 lines × 2) · ×4
  • Duplicated block (25 lines × 2) datafusion/expr/src/higher_order_function.rs:893 — datafusion/expr/src/higher_order_function.rs:893-917 | datafusion/expr/src/udf.rs:82-106 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (25 lines × 2) datafusion/ffi/src/config/mod.rs:33 — datafusion/ffi/src/config/mod.rs:33-57 | datafusion/ffi/src/config/mod.rs:123-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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit. Note first that the copies are not typed on the same thing: the declarations holding them bind `options` to `&ConfigOptions` in one and `&TableOptions` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (25 lines × 2) datafusion/physical-expr/src/simplifier/const_evaluator.rs:44 — datafusion/physical-expr/src/simplifier/const_evaluator.rs:44-68 | datafusion/physical-expr/src/simplifier/const_evaluator.rs:118-142 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-expr/src/simplifier/const_evaluator.rs:44` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (25 lines × 2) datafusion/physical-plan/src/aggregates/group_values/single_group_by/bytes.rs:40 — datafusion/physical-plan/src/aggregates/group_values/single_group_by/bytes.rs:40-64 | datafusion/physical-plan/src/aggregates/group_values/single_group_by/bytes_view.rs:42-66 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (20 lines × 2) · ×4
  • Duplicated block (20 lines × 2) datafusion/common/src/scalar/mod.rs:3119 — datafusion/common/src/scalar/mod.rs:3119-3138 | datafusion/common/src/scalar/mod.rs:3162-3181 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (20 lines × 2) datafusion/physical-plan/src/spill/mod.rs:554 — datafusion/physical-plan/src/spill/mod.rs:554-573 | datafusion/physical-plan/src/spill/mod.rs:579-598 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/spill/mod.rs:554` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (20 lines × 2) datafusion/core/src/test_util/mod.rs:81 — datafusion/core/src/test_util/mod.rs:81-100 | datafusion/physical-plan/src/test.rs:421-440 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (20 lines × 2) test-utils/src/array_gen/string.rs:32 — test-utils/src/array_gen/string.rs:32-51 | test-utils/src/array_gen/string.rs:56-75 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `test-utils/src/array_gen/string.rs:32` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (11–12 lines × 2) · ×4
  • Duplicated block (11–12 lines × 2) datafusion/expr/src/logical_plan/display.rs:542 — datafusion/expr/src/logical_plan/display.rs:542-552 | datafusion/expr/src/logical_plan/plan.rs:2367-2378 — 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 52 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/expr/src/logical_plan/display.rs:542` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (11–12 lines × 2) datafusion/functions/src/regex/regexplike.rs:303 — datafusion/functions/src/regex/regexplike.rs:303-314 | datafusion/functions/src/regex/regexplike.rs:317-327 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/functions/src/regex/regexplike.rs:303` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11–12 lines × 2) datafusion/physical-plan/src/coalesce_partitions.rs:74 — datafusion/physical-plan/src/coalesce_partitions.rs:74-85 | datafusion/physical-plan/src/sorts/sort_preserving_merge.rs:152-162 — 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 (11–12 lines × 2) datafusion/sql/src/unparser/plan.rs:2541 — datafusion/sql/src/unparser/plan.rs:2541-2551 | datafusion/sql/src/unparser/utils.rs:379-390 — 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–12 lines × 2) · ×4
  • Duplicated block (9–12 lines × 2) datafusion/functions/src/unicode/substr.rs:328 — datafusion/functions/src/unicode/substr.rs:328-339 | datafusion/functions/src/unicode/substr.rs:377-385 — 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:243 — datafusion/physical-plan/src/joins/piecewise_merge_join/classic_join.rs:243-251 | datafusion/physical-plan/src/joins/piecewise_merge_join/existence_join.rs:233-244 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/joins/piecewise_merge_join/classic_join.rs:243` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (9–12 lines × 2) datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs:1355 — datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs:1355-1363 | datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs:1407-1418 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/joins/sort_merge_join/materializing_stream.rs:1355` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9–12 lines × 2) datafusion/physical-plan/src/topk/mod.rs:2105 — datafusion/physical-plan/src/topk/mod.rs:2105-2116 | datafusion/physical-plan/src/topk/mod.rs:2497-2505 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/topk/mod.rs:2105` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (10 lines × 4) · ×4
  • Duplicated block (10 lines × 4) datafusion/catalog-listing/src/helpers.rs:60 — datafusion/catalog-listing/src/helpers.rs:60-69 | datafusion/expr/src/utils.rs:279-288 | datafusion/optimizer/src/push_down_filter.rs:263-272 | datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:681-690 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `datafusion/optimizer/src/push_down_filter.rs:273` calls `Between`, `Case` and `datafusion/catalog-listing/src/helpers.rs:70` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 4) datafusion/common/src/scalar/mod.rs:4737 — datafusion/common/src/scalar/mod.rs:4737-4746 | datafusion/common/src/scalar/mod.rs:4756-4765 | datafusion/common/src/scalar/mod.rs:4775-4784 | datafusion/common/src/scalar/mod.rs:4794-4803 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/common/src/scalar/mod.rs:4737` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 4) datafusion/physical-plan/src/filter.rs:606 — datafusion/physical-plan/src/filter.rs:606-615 | datafusion/physical-plan/src/joins/asof_join.rs:280-289 | datafusion/physical-plan/src/joins/hash_join/exec.rs:1347-1356 | datafusion/physical-plan/src/joins/nested_loop_join.rs:425-434 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/filter.rs:606` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `projection` to `Option<&[usize]>` in one and `Option<Vec<usize>>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (10 lines × 4) datafusion/proto-common/src/to_proto/mod.rs:425 — datafusion/proto-common/src/to_proto/mod.rs:425-434 | datafusion/proto-common/src/to_proto/mod.rs:441-450 | datafusion/proto-common/src/to_proto/mod.rs:457-466 | datafusion/proto-common/src/to_proto/mod.rs:473-482 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/proto-common/src/to_proto/mod.rs:425` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (5 lines × 3) · ×4
  • Duplicated block (5 lines × 3) datafusion/common/src/stats.rs:135 — datafusion/common/src/stats.rs:135-139 | datafusion/common/src/stats.rs:153-157 | datafusion/common/src/stats.rs:171-175 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/common/src/stats.rs:135` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 3) datafusion/functions-aggregate/src/variance.rs:609 — datafusion/functions-aggregate/src/variance.rs:609-613 | datafusion/functions-aggregate/src/variance.rs:643-647 | datafusion/functions-aggregate/src/variance.rs:669-673 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/functions-aggregate/src/variance.rs:609` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 3) datafusion/physical-plan/src/joins/asof_join.rs:732 — datafusion/physical-plan/src/joins/asof_join.rs:732-736 | datafusion/physical-plan/src/joins/nested_loop_join.rs:1027-1031 | datafusion/physical-plan/src/joins/sort_merge_join/exec.rs:1024-1028 — 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 51 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 (5 lines × 3) datafusion/physical-plan/src/aggregates/hash_stream.rs:276 — datafusion/physical-plan/src/aggregates/hash_stream.rs:276-280 | datafusion/physical-plan/src/aggregates/hash_stream.rs:600-604 | datafusion/physical-plan/src/aggregates/partial_reduce_stream.rs:146-150 — before extracting anything, compare `datafusion/physical-plan/src/aggregates/hash_stream.rs` and `datafusion/physical-plan/src/aggregates/partial_reduce_stream.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 59 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.
D1 · Cyclomatic Complexity · Unparser · ×3
  • Unparser::select_to_sql_recursively (cyclomatic 125) datafusion/sql/src/unparser/plan.rs:837 — Unparser::select_to_sql_recursively has cyclomatic complexity 125 (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 57) datafusion/sql/src/unparser/expr.rs:150 — Unparser::expr_to_sql_inner 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. 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 26) datafusion/sql/src/unparser/plan.rs:2530 — Unparser::unparse_table_scan_pushdown 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.
D1 · Cyclomatic Complexity · DefaultPhysicalPlanner · ×3
  • DefaultPhysicalPlanner::map_logical_node_to_physical (cyclomatic 115) REDACTED:786 — DefaultPhysicalPlanner::map_logical_node_to_physical has cyclomatic complexity 115 (threshold 15). Of this number, 111 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:3229 — 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.
  • DefaultPhysicalPlanner::plan_aggregate (cyclomatic 18) REDACTED:2110 — DefaultPhysicalPlanner::plan_aggregate 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 · CsvOptions · ×3
  • CsvOptions::deserialize (cyclomatic 70) datafusion/proto-common/src/generated/pbjson.rs:1866 — CsvOptions::deserialize has cyclomatic complexity 70 (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 47) datafusion/proto-common/src/generated/pbjson.rs:1686 — CsvOptions::serialize has cyclomatic complexity 47 (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.
  • CsvOptions::try_from (cyclomatic 26) datafusion/proto-models/src/from_proto.rs:183 — CsvOptions::try_from has cyclomatic complexity 26 (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:2423 — 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:2303 — 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:986 — 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_proto · ×3
  • datafusion_proto::logical_plan::from_proto::parse_expr (cyclomatic 48) datafusion/proto/src/logical_plan/from_proto.rs:157 — 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:40 — 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.
  • datafusion_proto::physical_plan::from_proto::parse_physical_expr_with_converter (cyclomatic 31) datafusion/proto/src/physical_plan/from_proto.rs:232 — datafusion_proto::physical_plan::from_proto::parse_physical_expr_with_converter 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.
D2 · Cognitive Complexity · DefaultPhysicalPlanner · ×3
  • DefaultPhysicalPlanner::map_logical_node_to_physical (cognitive 163) REDACTED:786 — DefaultPhysicalPlanner::map_logical_node_to_physical has cognitive complexity 163 (threshold 15). Drivers by points: if/else 50 (100 pts), match/switch 17 (44 pts), boolean chains 11, loops 3 (8 pts) (nesting depth added 82). Of this number, 159 points are the body's own statements and 4 belong to one function item inside it that branches. 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.
  • DefaultPhysicalPlanner::handle_explain (cognitive 38) REDACTED:3229 — 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.
  • DefaultPhysicalPlanner::plan_aggregate (cognitive 27) REDACTED:2110 — DefaultPhysicalPlanner::plan_aggregate has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 3, loops 2 (3 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 · CsvOptions · ×3
  • CsvOptions::deserialize (cognitive 73) datafusion/proto-common/src/generated/pbjson.rs:1866 — CsvOptions::deserialize has cognitive complexity 73 (threshold 15). Drivers by points: if/else 23 (69 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 47). To reduce it, split the body into named stages: move each independent 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 46) datafusion/proto-common/src/generated/pbjson.rs:1686 — CsvOptions::serialize has cognitive complexity 46 (threshold 15). Drivers by points: if/else 46. 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 36) datafusion/proto-models/src/from_proto.rs:183 — CsvOptions::try_from has cognitive complexity 36 (threshold 15). Drivers by points: if/else 34, 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 62) datafusion/expr/src/logical_plan/plan.rs:2173 — LogicalPlan::display has cognitive complexity 62 (threshold 15). Drivers by points: if/else 17 (35 pts), match/switch 10 (21 pts), loops 2 (4 pts), boolean chains 2 (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.
  • LogicalPlan::with_new_exprs (cognitive 29) datafusion/expr/src/logical_plan/plan.rs:910 — 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:1533 — 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:2423 — 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:2303 — 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:986 — 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:111 — 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::object_storage::get_s3_object_store_builder_inner (cognitive 18) datafusion-cli/src/object_storage.rs:73 — 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.
  • datafusion_cli::main_inner (cognitive 17) datafusion-cli/src/main.rs:179 — datafusion_cli::main_inner has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (14 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.
D2 · Cognitive Complexity · Expr · ×3
  • Expr::fmt (cognitive 45) datafusion/expr/src/expr.rs:3620 — 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:2426 — 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 35) datafusion/expr/src/expr_schema.rs:299 — Expr::nullable has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (16 pts), match/switch 7 (13 pts), boolean chains 3, loops 1 (3 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.
D2 · Cognitive Complexity · datafusion_physical_expr · ×3
  • datafusion_physical_expr::planner::create_physical_expr (cognitive 42) datafusion/physical-expr/src/planner.rs:120 — 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 26) datafusion/physical-expr/src/expressions/binary.rs:1262 — datafusion_physical_expr::expressions::binary::check_short_circuit has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (25 pts), match/switch 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.
  • datafusion_physical_expr::expressions::binary::pre_selection_scatter (cognitive 16) datafusion/physical-expr/src/expressions/binary.rs:1338 — datafusion_physical_expr::expressions::binary::pre_selection_scatter has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (15 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 · MultiLevelMergeBuilder · ×3
  • MultiLevelMergeBuilder::get_sorted_spill_files_to_merge (cognitive 38) datafusion/physical-plan/src/sorts/multi_level_merge.rs:601 — MultiLevelMergeBuilder::get_sorted_spill_files_to_merge has cognitive complexity 38 (threshold 15). Drivers by points: if/else 9 (23 pts), match/switch 3 (8 pts), boolean chains 6, 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.
  • MultiLevelMergeBuilder::split_spill_file_in_half (cognitive 29) datafusion/physical-plan/src/sorts/multi_level_merge.rs:770 — 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:355 — 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 · AggregateExec · ×3
  • AggregateExec::fmt_as (cognitive 29) datafusion/physical-plan/src/aggregates/mod.rs:1964 — 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::try_optimize_topk (cognitive 24) datafusion/physical-plan/src/aggregates/optimizations.rs:449 — AggregateExec::try_optimize_topk has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 7, 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.
  • AggregateExec::estimate_num_rows (cognitive 19) datafusion/physical-plan/src/aggregates/mod.rs:1765 — 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 · DictionaryGroupValuesColumn · ×3
  • DictionaryGroupValuesColumn::vectorized_append (cognitive 28) datafusion/physical-plan/src/aggregates/group_values/multi_group_by/dictionary.rs:500 — 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 27) datafusion/physical-plan/src/aggregates/group_values/multi_group_by/dictionary.rs:413 — DictionaryGroupValuesColumn::vectorized_equal_to has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 2 (4 pts), match/switch 2 (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.
  • DictionaryGroupValuesColumn::take_n (cognitive 19) datafusion/physical-plan/src/aggregates/group_values/multi_group_by/dictionary.rs:603 — DictionaryGroupValuesColumn::take_n has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 3 (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 · datafusion_sqllogictest · ×3
  • datafusion_sqllogictest::bin::sqllogictests::run_tests (cognitive 28) datafusion/sqllogictest/bin/sqllogictests.rs:120 — datafusion_sqllogictest::bin::sqllogictests::run_tests has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 5, loops 2 (4 pts), match/switch 3 (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.
  • datafusion_sqllogictest::util::df_value_validator (cognitive 19) datafusion/sqllogictest/src/util.rs:67 — 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:733 — 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 · 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:344 — 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:208 — 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:173 — 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:359 — 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:126 — 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_datasource_parquet · ×3
  • datafusion_datasource_parquet::schema_coercion::uniform_dict_schemas (cognitive 25) datafusion/datasource-parquet/src/schema_coercion.rs:359 — datafusion_datasource_parquet::schema_coercion::uniform_dict_schemas has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 4 (6 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_datasource_parquet::projection_read_plan::build_read_plan_with_cast_clipping (cognitive 20) datafusion/datasource-parquet/src/projection_read_plan.rs:663 — 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:511 — 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 · FilterExec · ×3
  • FilterExec::statistics_helper (cognitive 23) datafusion/physical-plan/src/filter.rs:357 — FilterExec::statistics_helper has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 1 (3 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.
  • FilterExec::statistics_under_fetch (cognitive 23) datafusion/physical-plan/src/filter.rs:491 — FilterExec::statistics_under_fetch has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (19 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.
  • FilterExec::handle_child_pushdown_result (cognitive 18) datafusion/physical-plan/src/filter.rs:837 — 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 · GroupValuesColumn · ×3
  • GroupValuesColumn::emit (cognitive 22) datafusion/physical-plan/src/aggregates/group_values/multi_group_by/mod.rs:1205 — 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:928 — 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:443 — 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.
D2 · Cognitive Complexity · BitwiseSortMergeJoinStream · ×3
  • BitwiseSortMergeJoinStream::buffer_inner_key_group (cognitive 17) datafusion/physical-plan/src/joins/sort_merge_join/bitwise_stream.rs:713 — BitwiseSortMergeJoinStream::buffer_inner_key_group has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 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.
  • BitwiseSortMergeJoinStream::process_key_match_with_filter (cognitive 17) datafusion/physical-plan/src/joins/sort_merge_join/bitwise_stream.rs:787 — 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.
  • BitwiseSortMergeJoinStream::join (cognitive 16) datafusion/physical-plan/src/joins/sort_merge_join/bitwise_stream.rs:1192 — BitwiseSortMergeJoinStream::join has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), match/switch 2 (3 pts), boolean chains 2, 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.
D3 · God Classes · TooManyFunctions · ×3
  • TooManyFunctions: datafusion_common::cast datafusion/common/src/cast.rs:35 — 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:14 — 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:383 — 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.
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 · Edited copy of a member (24 corresponding lines) · ×3
  • Edited copy of a member (24 corresponding lines) datafusion/physical-expr/src/expressions/case.rs:121 — datafusion/physical-expr/src/expressions/case.rs:121-217 | datafusion/physical-expr/src/expressions/lambda.rs:65-132 — These two members are one piece of code written twice and then edited apart: 24 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.
  • Edited copy of a member (24 corresponding lines) datafusion/physical-plan/src/aggregates/group_values/multi_group_by/boolean.rs:75 — datafusion/physical-plan/src/aggregates/group_values/multi_group_by/boolean.rs:75-100 | datafusion/physical-plan/src/aggregates/group_values/multi_group_by/primitive.rs:112-135 — These two members are one piece of code written twice and then edited apart: 24 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.
  • Edited copy of a member (24 corresponding lines) datafusion/functions/src/datetime/current_date.rs:98 — datafusion/functions/src/datetime/current_date.rs:98-121 | datafusion/functions/src/datetime/current_time.rs:95-119 — These two members are one piece of code written twice and then edited apart: 24 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 (6 members, 50+ identical tokens) · ×3
  • Members sharing a duplicated core (6 members, 50+ identical tokens) datafusion/ffi/src/catalog_provider.rs:223 — datafusion/ffi/src/catalog_provider.rs:223-233 | datafusion/ffi/src/catalog_provider_list.rs:187-197 | datafusion/ffi/src/schema_provider.rs:233-243 | datafusion/ffi/src/table_provider.rs:538-553 | datafusion/ffi/src/table_provider_factory.rs:91-101 | datafusion/ffi/src/udtf.rs:191-202 — 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:191 — datafusion/functions-nested/src/string.rs:191-209 | datafusion/functions/src/crypto/digest.rs:58-74 | datafusion/functions/src/regex/regexplike.rs:69-86 | datafusion/functions/src/string/btrim.rs:77-96 | datafusion/functions/src/string/ltrim.rs:82-100 | datafusion/functions/src/string/rtrim.rs:82-100 — 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:162 — datafusion/functions/src/math/abs.rs:162-175 | datafusion/functions/src/math/monotonicity.rs:331-344 | datafusion/functions/src/math/monotonicity.rs:434-445 | datafusion/functions/src/math/monotonicity.rs:472-483 | datafusion/functions/src/math/monotonicity.rs:510-521 | datafusion/functions/src/math/monotonicity.rs:637-648 — 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 · Edited copy of a member (47 corresponding lines) · ×3
  • Edited copy of a member (47 corresponding lines) datafusion/functions-nested/src/reverse.rs:136 — datafusion/functions-nested/src/reverse.rs:136-182 | datafusion/functions-nested/src/reverse.rs:192-249 — These two members are one piece of code written twice and then edited apart: 47 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.
  • Edited copy of a member (47 corresponding lines) datafusion/catalog/src/async.rs:258 — datafusion/catalog/src/async.rs:258-304 | datafusion/catalog/src/async.rs:330-397 — These two members are one piece of code written twice and then edited apart: 47 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.
  • Edited copy of a member (47 corresponding lines) datafusion/physical-plan/src/aggregates/group_values/multi_group_by/boolean.rs:102 — datafusion/physical-plan/src/aggregates/group_values/multi_group_by/boolean.rs:102-148 | datafusion/physical-plan/src/aggregates/group_values/multi_group_by/primitive.rs:196-243 — These two members are one piece of code written twice and then edited apart: 47 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 (32 corresponding lines) · ×3
  • Edited copy of a member (32 corresponding lines) datafusion/core/src/execution/session_state.rs:238 — datafusion/core/src/execution/session_state.rs:238-272 | datafusion/core/src/execution/session_state.rs:2066-2097 — These two members are one piece of code written twice and then edited apart: 32 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.
  • Edited copy of a member (32 corresponding lines) datafusion/physical-plan/src/joins/sort_merge_join/bitwise_stream.rs:532 — datafusion/physical-plan/src/joins/sort_merge_join/bitwise_stream.rs:532-565 | datafusion/physical-plan/src/joins/sort_merge_join/bitwise_stream.rs:568-599 — These two members are one piece of code written twice and then edited apart: 32 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.
  • Edited copy of a member (32 corresponding lines) datafusion/sqllogictest/src/test_context/range_partitioning.rs:272 — datafusion/sqllogictest/src/test_context/range_partitioning.rs:272-303 | datafusion/sqllogictest/src/test_context/range_partitioning.rs:308-345 — These two members are one piece of code written twice and then edited apart: 32 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 (42 corresponding lines) · ×3
  • Edited copy of a member (42 corresponding lines) datafusion/functions-nested/src/position.rs:130 — datafusion/functions-nested/src/position.rs:130-178 | datafusion/functions-nested/src/position.rs:432-473 — These two members are one piece of code written twice and then edited apart: 42 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.
  • Edited copy of a member (42 corresponding lines) datafusion/physical-plan/src/aggregates/clustered_partial_stream.rs:138 — datafusion/physical-plan/src/aggregates/clustered_partial_stream.rs:138-179 | datafusion/physical-plan/src/aggregates/partial_reduce_stream.rs:98-139 — These two members are one piece of code written twice and then edited apart: 42 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.
  • Edited copy of a member (42 corresponding lines) datafusion/physical-plan/src/spill/in_progress_spill_file.rs:59 — datafusion/physical-plan/src/spill/in_progress_spill_file.rs:59-100 | datafusion/physical-plan/src/spill/in_progress_spill_file.rs:103-152 — These two members are one piece of code written twice and then edited apart: 42 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 (28 corresponding lines) · ×3
  • Edited copy of a member (28 corresponding lines) datafusion/functions-aggregate/src/percentile_cont.rs:287 — datafusion/functions-aggregate/src/percentile_cont.rs:287-326 | datafusion/functions-aggregate/src/percentile_cont.rs:332-359 — These two members are one piece of code written twice and then edited apart: 28 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.
  • Edited copy of a member (28 corresponding lines) datafusion/sql/src/parser.rs:1055 — datafusion/sql/src/parser.rs:1055-1082 | datafusion/sql/src/parser.rs:1130-1164 — These two members are one piece of code written twice and then edited apart: 28 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.
  • Edited copy of a member (28 corresponding lines) datafusion/physical-plan/src/joins/sort_merge_join/exec.rs:650 — datafusion/physical-plan/src/joins/sort_merge_join/exec.rs:650-680 | datafusion/physical-plan/src/joins/symmetric_hash_join.rs:464-491 — These two members are one piece of code written twice and then edited apart: 28 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 copies of one member (3 members, 24+ corresponding lines) · ×3
  • Edited copies of one member (3 members, 24+ corresponding lines) datafusion/datasource-csv/src/file_format.rs:855 — datafusion/datasource-csv/src/file_format.rs:855-878 | datafusion/datasource-json/src/file_format.rs:486-509 | datafusion/datasource-parquet/src/sink.rs:417-445 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 24 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 24+ corresponding lines) datafusion/ffi/src/catalog_provider.rs:184 — datafusion/ffi/src/catalog_provider.rs:184-208 | datafusion/ffi/src/catalog_provider_list.rs:149-172 | datafusion/ffi/src/schema_provider.rs:192-218 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 24 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 24+ corresponding lines) datafusion/functions/src/string/split_part.rs:362 — datafusion/functions/src/string/split_part.rs:362-385 | datafusion/functions/src/unicode/reverse.rs:134-160 | datafusion/functions/src/unicode/translate.rs:382-406 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 24 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 16+ corresponding lines) · ×3
  • Edited copies of one member (3 members, 16+ corresponding lines) datafusion/functions/src/crypto/basic.rs:94 — datafusion/functions/src/crypto/basic.rs:94-109 | datafusion/functions/src/crypto/basic.rs:117-140 | datafusion/functions/src/crypto/basic.rs:148-171 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 16+ corresponding lines) datafusion/expr/src/logical_plan/plan.rs:2010 — datafusion/expr/src/logical_plan/plan.rs:2010-2025 | datafusion/expr/src/logical_plan/plan.rs:2056-2071 | datafusion/expr/src/logical_plan/plan.rs:2076-2091 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 16+ corresponding lines) datafusion/functions-nested/src/repeat.rs:83 — datafusion/functions-nested/src/repeat.rs:83-98 | datafusion/functions/src/string/repeat.rs:61-76 | datafusion/functions/src/string/split_part.rs:59-74 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 8+ corresponding lines) · ×3
  • Edited copies of one member (3 members, 8+ corresponding lines) datafusion/functions-aggregate/src/average.rs:1141 — datafusion/functions-aggregate/src/average.rs:1141-1148 | datafusion/functions-aggregate/src/average.rs:1165-1172 | datafusion/functions-aggregate/src/variance.rs:514-521 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 8+ corresponding lines) datafusion/datasource-avro/src/source.rs:134 — datafusion/datasource-avro/src/source.rs:134-141 | datafusion/datasource-csv/src/source.rs:639-646 | datafusion/datasource-json/src/source.rs:239-246 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 8+ corresponding lines) datafusion/pruning/src/key_range_bitmap_expr.rs:78 — datafusion/pruning/src/key_range_bitmap_expr.rs:78-85 | datafusion/pruning/src/primitive_in_list.rs:353-362 | datafusion/pruning/src/string_in_list.rs:246-254 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (22 lines × 2) · ×3
  • Duplicated block (22 lines × 2) datafusion/ffi/src/physical_expr/mod.rs:418 — datafusion/ffi/src/physical_expr/mod.rs:418-439 | datafusion/ffi/src/physical_expr/mod.rs:462-483 — 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 (22 lines × 2) datafusion/physical-plan/src/aggregates/clustered_final_stream.rs:279 — datafusion/physical-plan/src/aggregates/clustered_final_stream.rs:279-300 | datafusion/physical-plan/src/aggregates/single_stream.rs:274-295 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/aggregates/clustered_final_stream.rs:279` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (22 lines × 2) datafusion/functions/src/math/gcd.rs:77 — datafusion/functions/src/math/gcd.rs:77-98 | datafusion/functions/src/math/lcm.rs:73-94 — 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 (20–21 lines × 2) · ×3
  • Duplicated block (20–21 lines × 2) REDACTED:646 — REDACTED:646-666 | REDACTED:868-887 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:646` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (20–21 lines × 2) datafusion/physical-plan/src/joins/hash_join/exec.rs:1340 — datafusion/physical-plan/src/joins/hash_join/exec.rs:1340-1360 | datafusion/physical-plan/src/joins/nested_loop_join.rs:419-438 — 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 6 separate duplicated blocks between them, totalling at least 82 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/joins/hash_join/exec.rs:1340` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (20–21 lines × 2) datafusion/physical-plan/src/test.rs:322 — datafusion/physical-plan/src/test.rs:322-342 | datafusion/physical-plan/src/test.rs:369-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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/test.rs:322` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (19–20 lines × 2) · ×3
  • Duplicated block (19–20 lines × 2) datafusion/datasource-arrow/src/file_format.rs:317 — datafusion/datasource-arrow/src/file_format.rs:317-335 | datafusion/datasource-avro/src/file_format.rs:221-240 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/datasource-arrow/src/file_format.rs:317` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (19–20 lines × 2) datafusion/datasource-json/src/file_format.rs:268 — datafusion/datasource-json/src/file_format.rs:268-287 | datafusion/datasource-json/src/file_format.rs:291-309 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/datasource-json/src/file_format.rs:268` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (19–20 lines × 2) datafusion/functions/src/math/round.rs:646 — datafusion/functions/src/math/round.rs:646-664 | datafusion/functions/src/math/round.rs:684-703 — 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 lines × 2) · ×3
  • Duplicated block (18 lines × 2) datafusion/common/src/hash_utils/build_hasher.rs:214 — datafusion/common/src/hash_utils/build_hasher.rs:214-231 | datafusion/common/src/hash_utils/build_hasher.rs:259-276 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/common/src/hash_utils/build_hasher.rs:214` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18 lines × 2) datafusion/physical-plan/src/aggregates/aggregate_hash_table/common.rs:455 — datafusion/physical-plan/src/aggregates/aggregate_hash_table/common.rs:455-472 | datafusion/physical-plan/src/aggregates/grouped_hash_stream.rs:1115-1132 — 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/hash_stream.rs:308 — datafusion/physical-plan/src/aggregates/hash_stream.rs:308-325 | datafusion/physical-plan/src/aggregates/partial_reduce_stream.rs:172-189 — before extracting anything, compare `datafusion/physical-plan/src/aggregates/hash_stream.rs` and `datafusion/physical-plan/src/aggregates/partial_reduce_stream.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 59 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/aggregates/hash_stream.rs:308` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (15–16 lines × 2) · ×3
  • Duplicated block (15–16 lines × 2) datafusion/functions/src/core/arrow_cast.rs:148 — datafusion/functions/src/core/arrow_cast.rs:148-162 | datafusion/functions/src/core/arrow_try_cast.rs:120-135 — 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 39 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–16 lines × 2) datafusion/functions/src/regex/regexpcount.rs:315 — datafusion/functions/src/regex/regexpcount.rs:315-329 | datafusion/functions/src/regex/regexpcount.rs:360-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 (15–16 lines × 2) datafusion/functions/src/regex/regexpcount.rs:426 — datafusion/functions/src/regex/regexpcount.rs:426-441 | datafusion/functions/src/regex/regexpcount.rs:513-527 — 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 (10–12 lines × 2) · ×3
  • Duplicated block (10–12 lines × 2) datafusion/physical-plan/src/aggregates/group_values/multi_group_by/mod.rs:451 — datafusion/physical-plan/src/aggregates/group_values/multi_group_by/mod.rs:451-462 | datafusion/physical-plan/src/aggregates/group_values/row.rs:133-142 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/aggregates/group_values/multi_group_by/mod.rs:451` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (10–12 lines × 2) datafusion/physical-plan/src/joins/proto.rs:24 — datafusion/physical-plan/src/joins/proto.rs:24-35 | datafusion/physical-plan/src/joins/symmetric_hash_join.rs:700-709 — 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (10–12 lines × 2) datafusion/physical-plan/src/aggregates/mod.rs:2601 — datafusion/physical-plan/src/aggregates/mod.rs:2601-2612 | datafusion/proto/src/physical_plan/to_proto.rs:46-55 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/aggregates/mod.rs:2601` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. Note first that the copies are not typed on the same thing: the declarations holding them bind `aggr_expr` to `&Arc<AggregateFunctionExpr>` in one and `Arc<AggregateFunctionExpr>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (10–11 lines × 2) · ×3
  • Duplicated block (10–11 lines × 2) datafusion/expr/src/logical_plan/builder.rs:1468 — datafusion/expr/src/logical_plan/builder.rs:1468-1478 | datafusion/expr/src/logical_plan/builder.rs:1480-1489 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/expr/src/logical_plan/builder.rs:1468` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10–11 lines × 2) datafusion/physical-plan/src/aggregates/clustered_final_stream.rs:426 — datafusion/physical-plan/src/aggregates/clustered_final_stream.rs:426-435 | datafusion/physical-plan/src/aggregates/clustered_partial_stream.rs:379-389 — before extracting anything, compare `datafusion/physical-plan/src/aggregates/clustered_final_stream.rs` and `datafusion/physical-plan/src/aggregates/clustered_partial_stream.rs` as WHOLE FILES: this scan already matched 3 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/aggregates/clustered_final_stream.rs:426` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `datafusion/physical-plan/src/aggregates/clustered_partial_stream.rs:390` calls `add_part`, `num_rows` and `datafusion/physical-plan/src/aggregates/clustered_final_stream.rs:436` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10–11 lines × 2) datafusion/physical-plan/src/joins/nested_loop_join.rs:2856 — datafusion/physical-plan/src/joins/nested_loop_join.rs:2856-2866 | datafusion/physical-plan/src/joins/nested_loop_join.rs:3229-3238 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/joins/nested_loop_join.rs:2856` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (7–9 lines × 2) · ×3
  • Duplicated block (7–9 lines × 2) datafusion/common/src/hash_utils.rs:495 — datafusion/common/src/hash_utils.rs:495-503 | datafusion/common/src/hash_utils/build_hasher.rs:337-343 — 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 4 separate duplicated blocks between them, totalling at least 54 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/common/src/hash_utils.rs:495` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7–9 lines × 2) datafusion/physical-optimizer/src/topk_repartition.rs:73 — datafusion/physical-optimizer/src/topk_repartition.rs:73-81 | datafusion/sqllogictest/src/test_context/custom_sort_pushdown.rs:130-136 — 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–9 lines × 2) datafusion/physical-plan/src/joins/sort_merge_join/metrics.rs:30 — datafusion/physical-plan/src/joins/sort_merge_join/metrics.rs:30-36 | datafusion/physical-plan/src/joins/utils.rs:1990-1998 — 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (8 lines × 4) · ×3
  • Duplicated block (8 lines × 4) datafusion/ffi/src/udaf/accumulator.rs:94 — datafusion/ffi/src/udaf/accumulator.rs:94-101 | datafusion/ffi/src/udaf/accumulator.rs:168-175 | datafusion/ffi/src/udwf/partition_evaluator.rs:101-108 | datafusion/ffi/src/udwf/partition_evaluator.rs:126-133 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/ffi/src/udaf/accumulator.rs:94` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 4) datafusion/functions/src/math/monotonicity.rs:435 — datafusion/functions/src/math/monotonicity.rs:435-442 | datafusion/functions/src/math/monotonicity.rs:473-480 | datafusion/functions/src/math/monotonicity.rs:511-518 | datafusion/functions/src/math/monotonicity.rs:638-645 — 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:1086 — datafusion/expr/src/higher_order_function.rs:1086-1093 | datafusion/expr/src/udaf.rs:1553-1561 | datafusion/expr/src/udf.rs:1133-1140 | datafusion/expr/src/udwf.rs:493-501 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/expr/src/higher_order_function.rs:1086` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `inner` to `Arc<dyn HigherOrderUDFImpl>` in one and `Arc<dyn AggregateUDFImpl>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
R4 · Test Coverage · No test reaches this file · ×3
  • No test reaches this file ci/scripts/draft_inactive_prs.cjs:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file ci/scripts/release_version_labeler.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file datafusion/wasmtest/datafusion-wasm-app/index.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
D1 · Cyclomatic Complexity · ParquetOptions · ×2
  • ParquetOptions::deserialize (cyclomatic 121) datafusion/proto-common/src/generated/pbjson.rs:6796 — ParquetOptions::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.
  • ParquetOptions::serialize (cyclomatic 81) datafusion/proto-common/src/generated/pbjson.rs:6464 — ParquetOptions::serialize has cyclomatic complexity 81 (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_expr_common · ×2
  • datafusion_expr_common::casts::try_cast_numeric_literal (cyclomatic 64) datafusion/expr-common/src/casts.rs:700 — 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.
  • datafusion_expr_common::casts::is_exact_cast_safe (cyclomatic 18) datafusion/expr-common/src/casts.rs:220 — datafusion_expr_common::casts::is_exact_cast_safe 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 · PullUpCorrelatedExpr · ×2
  • PullUpCorrelatedExpr::f_up (cyclomatic 55) datafusion/optimizer/src/decorrelate.rs:395 — PullUpCorrelatedExpr::f_up has cyclomatic complexity 55 (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.
  • PullUpCorrelatedExpr::f_down (cyclomatic 20) datafusion/optimizer/src/decorrelate.rs:193 — PullUpCorrelatedExpr::f_down 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.
D1 · Cyclomatic Complexity · datafusion_physical_expr · ×2
  • datafusion_physical_expr::planner::create_physical_expr (cyclomatic 48) datafusion/physical-expr/src/planner.rs:120 — 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:71 — 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.
D1 · Cyclomatic Complexity · datafusion_pruning · ×2
  • datafusion_pruning::pruning_predicate::build_predicate_expression (cyclomatic 35) datafusion/pruning/src/pruning_predicate.rs:1764 — datafusion_pruning::pruning_predicate::build_predicate_expression 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_pruning::pruning_predicate::build_compact_in_list_expr (cyclomatic 16) datafusion/pruning/src/pruning_predicate.rs:1586 — datafusion_pruning::pruning_predicate::build_compact_in_list_expr 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 · ColumnarValueRef · ×2
  • ColumnarValueRef::write_bytes (cyclomatic 29) datafusion/functions/src/strings.rs:1305 — ColumnarValueRef::write_bytes has cyclomatic complexity 29 (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.
  • ColumnarValueRef::from_columnar_value (cyclomatic 22) datafusion/functions/src/strings.rs:1372 — 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 · FileSinkConfig · ×2
  • FileSinkConfig::deserialize (cyclomatic 28) datafusion/proto-models/src/generated/pbjson.rs:8109 — 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.
  • FileSinkConfig::serialize (cyclomatic 19) datafusion/proto-models/src/generated/pbjson.rs:8039 — 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.
D1 · Cyclomatic Complexity · BinaryExpr · ×2
  • BinaryExpr::evaluate (cyclomatic 26) datafusion/physical-expr/src/expressions/binary.rs:548 — BinaryExpr::evaluate 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.
  • BinaryExpr::propagate_constraints (cyclomatic 24) datafusion/physical-expr/src/expressions/binary.rs:721 — 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 · MultiLevelMergeBuilder · ×2
  • MultiLevelMergeBuilder::get_sorted_spill_files_to_merge (cyclomatic 19) datafusion/physical-plan/src/sorts/multi_level_merge.rs:601 — MultiLevelMergeBuilder::get_sorted_spill_files_to_merge 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.
  • MultiLevelMergeBuilder::split_spill_file_in_half (cyclomatic 18) datafusion/physical-plan/src/sorts/multi_level_merge.rs:770 — 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.
D2 · Cognitive Complexity · ParquetOptions · ×2
  • ParquetOptions::deserialize (cognitive 124) datafusion/proto-common/src/generated/pbjson.rs:6796 — ParquetOptions::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.
  • ParquetOptions::serialize (cognitive 106) datafusion/proto-common/src/generated/pbjson.rs:6464 — ParquetOptions::serialize has cognitive complexity 106 (threshold 15). Drivers by points: if/else 80, 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 · PullUpCorrelatedExpr · ×2
  • PullUpCorrelatedExpr::f_up (cognitive 98) datafusion/optimizer/src/decorrelate.rs:395 — PullUpCorrelatedExpr::f_up has cognitive complexity 98 (threshold 15). Drivers by points: if/else 35 (72 pts), boolean chains 9, match/switch 4 (9 pts), loops 4 (8 pts) (nesting depth added 46). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PullUpCorrelatedExpr::f_down (cognitive 21) datafusion/optimizer/src/decorrelate.rs:193 — PullUpCorrelatedExpr::f_down has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (17 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 · GroupedHashAggregateStream · ×2
  • GroupedHashAggregateStream::poll_next (cognitive 67) datafusion/physical-plan/src/aggregates/grouped_hash_stream.rs:652 — 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:856 — 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_datasource · ×2
  • datafusion_datasource::write::demux::compute_partition_keys_by_row (cognitive 59) datafusion/datasource/src/write/demux.rs:398 — datafusion_datasource::write::demux::compute_partition_keys_by_row has cognitive complexity 59 (threshold 15). Drivers by points: loops 18 (52 pts), if/else 2 (4 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 37). 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:496 — 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 · datafusion · ×2
  • datafusion::bin::print_functions_docs::print_docs (cognitive 57) datafusion/core/src/bin/print_functions_docs.rs:79 — 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:2949 — 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_pruning · ×2
  • datafusion_pruning::pruning_predicate::build_predicate_expression (cognitive 44) datafusion/pruning/src/pruning_predicate.rs:1764 — datafusion_pruning::pruning_predicate::build_predicate_expression has cognitive complexity 44 (threshold 15). Drivers by points: if/else 24 (34 pts), boolean chains 5, match/switch 3 (5 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_pruning::pruning_predicate::build_compact_in_list_expr (cognitive 19) datafusion/pruning/src/pruning_predicate.rs:1586 — datafusion_pruning::pruning_predicate::build_compact_in_list_expr has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (11 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 · ColumnarValueRef · ×2
  • ColumnarValueRef::from_columnar_value (cognitive 35) datafusion/functions/src/strings.rs:1372 — 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.
  • ColumnarValueRef::write_bytes (cognitive 25) datafusion/functions/src/strings.rs:1305 — ColumnarValueRef::write_bytes has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 7, 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 · BinaryExpr · ×2
  • BinaryExpr::propagate_constraints (cognitive 35) datafusion/physical-expr/src/expressions/binary.rs:721 — 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 29) datafusion/physical-expr/src/expressions/binary.rs:548 — BinaryExpr::evaluate has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (24 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 · PartitionedTopKDenseRank · ×2
  • PartitionedTopKDenseRank::insert_batch (cognitive 33) datafusion/physical-plan/src/topk/mod.rs:2868 — 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 21) datafusion/physical-plan/src/topk/mod.rs:3054 — PartitionedTopKDenseRank::emit has cognitive complexity 21 (threshold 15). Drivers by points: if/else 3 (11 pts), loops 4 (10 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 · FileSinkConfig · ×2
  • FileSinkConfig::deserialize (cognitive 31) datafusion/proto-models/src/generated/pbjson.rs:8109 — 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.
  • FileSinkConfig::serialize (cognitive 18) datafusion/proto-models/src/generated/pbjson.rs:8039 — 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.
D2 · Cognitive Complexity · ParquetColumnOptions · ×2
  • ParquetColumnOptions::serialize (cognitive 28) datafusion/proto-common/src/generated/pbjson.rs:6036 — 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:6120 — 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 · datafusion_proto · ×2
  • datafusion_proto::logical_plan::from_proto::parse_expr (cognitive 26) datafusion/proto/src/logical_plan/from_proto.rs:157 — 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:40 — 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 · FileScanConfig · ×2
  • FileScanConfig::fmt_as (cognitive 24) datafusion/datasource/src/file_scan_config/mod.rs:786 — 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.
  • FileScanConfig::rebuild_with_source (cognitive 20) datafusion/datasource/src/file_scan_config/sort_pushdown.rs:64 — FileScanConfig::rebuild_with_source has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 3, 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_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:578 — 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:99 — 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:2283 — 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:1950 — 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:689 — 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:553 — 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 · TypeCoercionRewriter · ×2
  • TypeCoercionRewriter::f_up (cognitive 23) datafusion/optimizer/src/analyzer/type_coercion.rs:698 — TypeCoercionRewriter::f_up has cognitive complexity 23 (threshold 15). Drivers by points: match/switch 6 (11 pts), if/else 5 (8 pts), boolean chains 4 (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.
  • TypeCoercionRewriter::coerce_dml (cognitive 19) datafusion/optimizer/src/analyzer/type_coercion.rs:318 — 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 · Range · ×2
  • Range::gen_range_timestamp (cognitive 22) datafusion/functions-nested/src/range.rs:419 — 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:355 — 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 · InformationSchemaConfig · ×2
  • InformationSchemaConfig::add_columns (cognitive 21) datafusion/catalog/src/information_schema.rs:573 — InformationSchemaConfig::add_columns has cognitive complexity 21 (threshold 15). Drivers by points: loops 3 (11 pts), if/else 3 (10 pts) (nesting depth added 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.
  • InformationSchemaConfig::add_tables (cognitive 18) datafusion/catalog/src/information_schema.rs:465 — InformationSchemaConfig::add_tables has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (11 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.
D2 · Cognitive Complexity · RowGroupsPrunedParquetOpen · ×2
  • RowGroupsPrunedParquetOpen::build_stream (cognitive 20) datafusion/datasource-parquet/src/opener/mod.rs:1650 — RowGroupsPrunedParquetOpen::build_stream has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (15 pts), match/switch 3, 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.
  • RowGroupsPrunedParquetOpen::should_load_page_index (cognitive 19) datafusion/datasource-parquet/src/opener/mod.rs:1388 — RowGroupsPrunedParquetOpen::should_load_page_index has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 5, match/switch 2 (3 pts) (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.
D2 · Cognitive Complexity · FirstLastGroupsAccumulator · ×2
  • FirstLastGroupsAccumulator::get_filtered_extreme_of_each_group (cognitive 18) datafusion/functions-aggregate/src/first_last.rs:600 — 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:710 — 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:134 — 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:161 — 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:801 — 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:840 — 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.
D29 · Static Analysis (SAST) · REDACTED · ×2
  • REDACTED
  • REDACTED
D30 · Dependency Vulnerabilities · Medium advisory (unmaintained) · ×2
  • REDACTED
  • REDACTED
D31 · IaC & Container Security · Medium IaC · ×2
  • REDACTED
  • REDACTED
D4 · Code Duplication · Members sharing a duplicated core (7 members, 50+ identical tokens) · ×2
  • Members sharing a duplicated core (7 members, 50+ identical tokens) datafusion/ffi/src/query_planner.rs:127 — datafusion/ffi/src/query_planner.rs:127-164 | datafusion/ffi/src/table_provider.rs:279-317 | datafusion/ffi/src/table_provider.rs:324-354 | datafusion/ffi/src/table_provider.rs:360-391 | datafusion/ffi/src/table_provider.rs:398-457 | datafusion/ffi/src/table_provider.rs:462-483 | datafusion/ffi/src/udtf.rs:123-156 — These 7 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 7 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 7 times.
  • Members sharing a duplicated core (7 members, 50+ identical tokens) datafusion/functions-nested/src/utils.rs:222 — datafusion/functions-nested/src/utils.rs:222-247 | datafusion/functions/src/regex/regexpcount.rs:88-113 | datafusion/functions/src/regex/regexpinstr.rs:106-131 | datafusion/functions/src/regex/regexpmatch.rs:99-131 | datafusion/functions/src/regex/regexpreplace.rs:157-219 | datafusion/functions/src/regex/regexpreplace.rs:678-813 | datafusion/functions/src/utils.rs:106-143 — These 7 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 7 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 7 times.
D4 · Code Duplication · Edited copy of a member (68 corresponding lines) · ×2
  • Edited copy of a member (68 corresponding lines) datafusion/physical-plan/src/aggregates/aggregate_hash_table/common.rs:438 — datafusion/physical-plan/src/aggregates/aggregate_hash_table/common.rs:438-505 | datafusion/physical-plan/src/aggregates/grouped_hash_stream.rs:1100-1218 — These two members are one piece of code written twice and then edited apart: 68 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.
  • Edited copy of a member (68 corresponding lines) datafusion/datasource/src/file_scan_config/mod.rs:1443 — datafusion/datasource/src/file_scan_config/mod.rs:1443-1513 | datafusion/datasource/src/file_scan_config/mod.rs:1522-1589 — These two members are one piece of code written twice and then edited apart: 68 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 (65 corresponding lines) · ×2
  • Edited copy of a member (65 corresponding lines) datafusion/physical-plan/src/aggregates/clustered_single_stream.rs:146 — datafusion/physical-plan/src/aggregates/clustered_single_stream.rs:146-210 | datafusion/physical-plan/src/aggregates/single_stream.rs:148-213 — These two members are one piece of code written twice and then edited apart: 65 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.
  • Edited copy of a member (65 corresponding lines) datafusion/functions/src/string/split_part.rs:235 — datafusion/functions/src/string/split_part.rs:235-303 | datafusion/functions/src/unicode/substrindex.rs:178-242 — These two members are one piece of code written twice and then edited apart: 65 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 (38 corresponding lines) · ×2
  • Edited copy of a member (38 corresponding lines) datafusion/physical-expr/src/equivalence/properties/mod.rs:1154 — datafusion/physical-expr/src/equivalence/properties/mod.rs:1154-1191 | datafusion/physical-expr/src/equivalence/properties/mod.rs:1198-1235 — These two members are one piece of code written twice and then edited apart: 38 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.
  • Edited copy of a member (38 corresponding lines) datafusion/functions/src/math/round.rs:171 — datafusion/functions/src/math/round.rs:171-209 | datafusion/functions/src/math/trunc.rs:67-104 — These two members are one piece of code written twice and then edited apart: 38 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 (35 corresponding lines) · ×2
  • Edited copy of a member (35 corresponding lines) datafusion/physical-plan/src/repartition/range.rs:396 — datafusion/physical-plan/src/repartition/range.rs:396-430 | datafusion/physical-plan/src/repartition/range.rs:452-494 — These two members are one piece of code written twice and then edited apart: 35 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.
  • Edited copy of a member (35 corresponding lines) datafusion/functions-aggregate/src/first_last.rs:1548 — datafusion/functions-aggregate/src/first_last.rs:1548-1582 | datafusion/functions-aggregate/src/first_last.rs:1935-1971 — These two members are one piece of code written twice and then edited apart: 35 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 (43 corresponding lines) · ×2
  • Edited copy of a member (43 corresponding lines) datafusion/functions/src/math/cot.rs:84 — datafusion/functions/src/math/cot.rs:84-126 | datafusion/functions/src/math/signum.rs:86-134 — These two members are one piece of code written twice and then edited apart: 43 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.
  • Edited copy of a member (43 corresponding lines) datafusion/core/src/dataframe/mod.rs:2321 — datafusion/core/src/dataframe/mod.rs:2321-2363 | datafusion/core/src/dataframe/mod.rs:2391-2433 — These two members are one piece of code written twice and then edited apart: 43 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 (52 corresponding lines) · ×2
  • Edited copy of a member (52 corresponding lines) datafusion/functions-aggregate-common/src/min_max.rs:735 — datafusion/functions-aggregate-common/src/min_max.rs:735-786 | datafusion/functions-aggregate-common/src/min_max.rs:813-864 — These two members are one piece of code written twice and then edited apart: 52 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.
  • Edited copy of a member (52 corresponding lines) datafusion/expr/src/udaf.rs:1242 — datafusion/expr/src/udaf.rs:1242-1297 | datafusion/expr/src/udaf.rs:1433-1484 — These two members are one piece of code written twice and then edited apart: 52 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 copies of one member (3 members, 32+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 32+ corresponding lines) datafusion/common/src/hash_utils.rs:386 — datafusion/common/src/hash_utils.rs:386-417 | datafusion/common/src/hash_utils/build_hasher.rs:200-231 | datafusion/common/src/hash_utils/build_hasher.rs:243-276 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 32 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 32+ corresponding lines) datafusion/functions-nested/src/replace.rs:119 — datafusion/functions-nested/src/replace.rs:119-150 | datafusion/functions-nested/src/replace.rs:227-270 | datafusion/functions-nested/src/replace.rs:345-376 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 32 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 19+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 19+ corresponding lines) datafusion/functions/src/string/btrim.rs:22 — datafusion/functions/src/string/btrim.rs:22-40 | datafusion/functions/src/string/ltrim.rs:23-41 | datafusion/functions/src/string/rtrim.rs:23-41 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 19 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 19+ corresponding lines) datafusion/ffi/src/catalog_provider.rs:239 — datafusion/ffi/src/catalog_provider.rs:239-258 | datafusion/ffi/src/catalog_provider_list.rs:202-220 | datafusion/ffi/src/udtf.rs:208-227 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 19 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (41 corresponding lines) · ×2
  • Edited copy of a member (41 corresponding lines) datafusion/physical-expr/src/expressions/cast.rs:835 — datafusion/physical-expr/src/expressions/cast.rs:835-891 | datafusion/physical-expr/src/expressions/try_cast.rs:316-356 — These two members are one piece of code written twice and then edited apart: 41 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.
  • Edited copy of a member (41 corresponding lines) datafusion/physical-plan/src/test.rs:315 — datafusion/physical-plan/src/test.rs:315-356 | datafusion/physical-plan/src/test.rs:362-402 — These two members are one piece of code written twice and then edited apart: 41 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 copies of one member (3 members, 25+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 25+ corresponding lines) datafusion/expr/src/expr.rs:802 — datafusion/expr/src/expr.rs:802-831 | datafusion/physical-expr/src/expressions/binary.rs:195-224 | datafusion/physical-expr/src/expressions/binary.rs:947-971 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 25 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 25+ corresponding lines) datafusion/physical-plan/src/buffer.rs:334 — datafusion/physical-plan/src/buffer.rs:334-358 | datafusion/physical-plan/src/joins/cross_join.rs:464-495 | datafusion/physical-plan/src/limit.rs:582-608 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 25 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 15+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 15+ corresponding lines) datafusion/ffi/src/udaf/mod.rs:341 — datafusion/ffi/src/udaf/mod.rs:341-359 | datafusion/ffi/src/udf/mod.rs:155-169 | datafusion/ffi/src/udwf/mod.rs:148-166 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 15+ corresponding lines) datafusion/physical-plan/src/buffer.rs:371 — datafusion/physical-plan/src/buffer.rs:371-385 | datafusion/physical-plan/src/coalesce_partitions.rs:435-458 | datafusion/physical-plan/src/joins/cross_join.rs:503-521 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 19+ corresponding lines) · ×2
  • Edited copies of one member (4 members, 19+ corresponding lines) datafusion/datasource-arrow/src/file_format.rs:91 — datafusion/datasource-arrow/src/file_format.rs:91-109 | datafusion/datasource-csv/src/file_format.rs:89-107 | datafusion/datasource-json/src/file_format.rs:78-96 | datafusion/datasource-parquet/src/file_format.rs:92-112 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 19 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 19+ corresponding lines) datafusion/common/src/scalar/mod.rs:3497 — datafusion/common/src/scalar/mod.rs:3497-3515 | datafusion/common/src/scalar/mod.rs:3521-3539 | datafusion/common/src/scalar/mod.rs:3545-3563 | datafusion/common/src/scalar/mod.rs:3569-3587 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 19 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 17+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 17+ corresponding lines) datafusion/catalog/src/information_schema.rs:1129 — datafusion/catalog/src/information_schema.rs:1129-1147 | datafusion/catalog/src/information_schema.rs:1170-1186 | datafusion/catalog/src/information_schema.rs:1209-1225 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 17+ corresponding lines) datafusion/proto/src/logical_plan/file_formats.rs:77 — datafusion/proto/src/logical_plan/file_formats.rs:77-93 | datafusion/proto/src/logical_plan/file_formats.rs:155-172 | datafusion/proto/src/logical_plan/file_formats.rs:243-263 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 10+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 10+ corresponding lines) datafusion/functions-nested/src/cosine_distance.rs:137 — datafusion/functions-nested/src/cosine_distance.rs:137-146 | datafusion/functions-nested/src/distance.rs:135-144 | datafusion/functions-nested/src/inner_product.rs:143-152 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 10+ corresponding lines) datafusion/ffi/src/udaf/accumulator.rs:181 — datafusion/ffi/src/udaf/accumulator.rs:181-190 | datafusion/ffi/src/udaf/groups_accumulator.rs:211-223 | datafusion/ffi/src/udwf/partition_evaluator.rs:182-194 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (1 corresponding lines) · ×2
  • Edited copy of a member (1 corresponding lines) datafusion/functions/src/unicode/mod.rs:37 — datafusion/functions/src/unicode/mod.rs:37-37 | datafusion/functions/src/unicode/mod.rs:38-38 — These two members are one piece of code written twice and then edited apart: 1 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.
  • Edited copy of a member (1 corresponding lines) datafusion/functions/src/encoding/mod.rs:11 — datafusion/functions/src/encoding/mod.rs:11-11 | datafusion/functions/src/encoding/mod.rs:12-12 — These two members are one piece of code written twice and then edited apart: 1 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 copies of one member (4 members, 11+ corresponding lines) · ×2
  • Edited copies of one member (4 members, 11+ corresponding lines) datafusion/expr/src/logical_plan/ddl.rs:784 — datafusion/expr/src/logical_plan/ddl.rs:784-794 | datafusion/expr/src/logical_plan/dml.rs:63-76 | datafusion/expr/src/logical_plan/dml.rs:214-224 | datafusion/expr/src/logical_plan/plan.rs:4484-4496 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 11 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 11+ corresponding lines) datafusion/physical-expr/src/equivalence/class.rs:989 — datafusion/physical-expr/src/equivalence/class.rs:989-999 | datafusion/physical-expr/src/equivalence/grouping.rs:168-178 | datafusion/physical-expr/src/equivalence/ordering.rs:286-296 | datafusion/physical-expr/src/equivalence/properties/dependency.rs:25-35 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 11 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 12+ corresponding lines) · ×2
  • Edited copies of one member (4 members, 12+ corresponding lines) datafusion/ffi/src/udaf/accumulator.rs:254 — datafusion/ffi/src/udaf/accumulator.rs:254-265 | datafusion/ffi/src/udaf/accumulator.rs:303-314 | datafusion/ffi/src/udaf/accumulator.rs:316-327 | datafusion/ffi/src/udaf/groups_accumulator.rs:359-374 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 12 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 12+ corresponding lines) datafusion/catalog/src/information_schema.rs:992 — datafusion/catalog/src/information_schema.rs:992-1003 | datafusion/catalog/src/information_schema.rs:1026-1037 | datafusion/catalog/src/information_schema.rs:1060-1072 | datafusion/catalog/src/information_schema.rs:1095-1106 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 12 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (6 members, 8+ corresponding lines) · ×2
  • Edited copies of one member (6 members, 8+ corresponding lines) datafusion/ffi/src/proto/logical_extension_codec.rs:436 — datafusion/ffi/src/proto/logical_extension_codec.rs:436-443 | datafusion/ffi/src/proto/logical_extension_codec.rs:454-461 | datafusion/ffi/src/proto/logical_extension_codec.rs:473-480 | datafusion/ffi/src/proto/physical_extension_codec.rs:377-384 | datafusion/ffi/src/proto/physical_extension_codec.rs:395-402 | datafusion/ffi/src/proto/physical_extension_codec.rs:414-421 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 8 lines, 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 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. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
  • Edited copies of one member (6 members, 8+ corresponding lines) datafusion/ffi/src/proto/logical_extension_codec.rs:445 — datafusion/ffi/src/proto/logical_extension_codec.rs:445-452 | datafusion/ffi/src/proto/logical_extension_codec.rs:463-471 | datafusion/ffi/src/proto/logical_extension_codec.rs:482-490 | datafusion/ffi/src/proto/physical_extension_codec.rs:386-393 | datafusion/ffi/src/proto/physical_extension_codec.rs:404-412 | datafusion/ffi/src/proto/physical_extension_codec.rs:423-431 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 8 lines, 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 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. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 13+ corresponding lines) · ×2
  • Edited copies of one member (5 members, 13+ corresponding lines) datafusion/physical-plan/src/aggregates/group_values/multi_group_by/bytes.rs:111 — datafusion/physical-plan/src/aggregates/group_values/multi_group_by/bytes.rs:111-125 | datafusion/physical-plan/src/aggregates/group_values/multi_group_by/bytes_view.rs:121-134 | datafusion/physical-plan/src/aggregates/group_values/multi_group_by/fixed_size_binary.rs:136-151 | datafusion/physical-plan/src/aggregates/group_values/multi_group_by/list.rs:148-160 | datafusion/physical-plan/src/aggregates/group_values/multi_group_by/row_backed.rs:247-263 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 13 lines, 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 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. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
  • Edited copies of one member (5 members, 13+ corresponding lines) datafusion/datasource-arrow/src/file_format.rs:385 — datafusion/datasource-arrow/src/file_format.rs:385-397 | datafusion/datasource-avro/src/file_format.rs:303-315 | datafusion/datasource-csv/src/file_format.rs:773-785 | datafusion/datasource-json/src/file_format.rs:410-422 | datafusion/datasource-parquet/src/sink.rs:86-98 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 13 lines, 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 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. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 7+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 7+ corresponding lines) datafusion/expr-common/src/statistics.rs:318 — datafusion/expr-common/src/statistics.rs:318-331 | datafusion/expr-common/src/statistics.rs:340-350 | datafusion/expr-common/src/statistics.rs:530-536 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 7+ corresponding lines) datafusion/datasource-arrow/src/file_format.rs:151 — datafusion/datasource-arrow/src/file_format.rs:151-159 | datafusion/datasource-avro/src/file_format.rs:106-112 | datafusion/datasource-parquet/src/file_format.rs:439-445 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (5 corresponding lines) · ×2
  • Edited copy of a member (5 corresponding lines) datafusion/physical-plan/src/joins/sort_merge_join/exec.rs:640 — datafusion/physical-plan/src/joins/sort_merge_join/exec.rs:640-644 | datafusion/physical-plan/src/joins/symmetric_hash_join.rs:454-458 — These two members are one piece of code written twice and then edited apart: 5 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.
  • Edited copy of a member (5 corresponding lines) datafusion/common/src/scalar/mod.rs:5193 — datafusion/common/src/scalar/mod.rs:5193-5197 | datafusion/functions-aggregate/src/count.rs:582-594 — These two members are one piece of code written twice and then edited apart: 5 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 (4 corresponding lines) · ×2
  • Edited copy of a member (4 corresponding lines) datafusion/physical-plan/src/aggregates/group_values/single_group_by/bytes.rs:117 — datafusion/physical-plan/src/aggregates/group_values/single_group_by/bytes.rs:117-120 | datafusion/physical-plan/src/aggregates/group_values/single_group_by/bytes_view.rs:119-122 — These two members are one piece of code written twice and then edited apart: 4 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.
  • Edited copy of a member (4 corresponding lines) datafusion/functions-nested/src/array_add.rs:86 — datafusion/functions-nested/src/array_add.rs:86-89 | datafusion/functions-nested/src/array_subtract.rs:85-88 — These two members are one piece of code written twice and then edited apart: 4 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 · Duplicated block (39 lines × 2) · ×2
  • Duplicated block (39 lines × 2) datafusion/functions-nested/src/cosine_distance.rs:88 — datafusion/functions-nested/src/cosine_distance.rs:88-126 | datafusion/functions-nested/src/inner_product.rs:90-128 — 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 4 separate duplicated blocks between them, totalling at least 91 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 (39 lines × 2) datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:1264 — datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:1264-1302 | datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:1314-1352 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:1264` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (31 lines × 2) · ×2
  • Duplicated block (31 lines × 2) datafusion/core/src/dataframe/mod.rs:2333 — datafusion/core/src/dataframe/mod.rs:2333-2363 | datafusion/core/src/dataframe/mod.rs:2403-2433 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/core/src/dataframe/mod.rs:2333` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (31 lines × 2) datafusion/physical-expr/src/equivalence/properties/mod.rs:1155 — datafusion/physical-expr/src/equivalence/properties/mod.rs:1155-1185 | datafusion/physical-expr/src/equivalence/properties/mod.rs:1199-1229 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-expr/src/equivalence/properties/mod.rs:1155` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (24 lines × 2) · ×2
  • Duplicated block (24 lines × 2) datafusion/functions-nested/src/cosine_distance.rs:149 — datafusion/functions-nested/src/cosine_distance.rs:149-172 | datafusion/functions-nested/src/inner_product.rs:155-178 — 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 4 separate duplicated blocks between them, totalling at least 91 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 (24 lines × 2) datafusion/physical-plan/src/joins/hash_join/exec.rs:1442 — datafusion/physical-plan/src/joins/hash_join/exec.rs:1442-1465 | datafusion/physical-plan/src/joins/nested_loop_join.rs:525-548 — 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 6 separate duplicated blocks between them, totalling at least 82 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/joins/hash_join/exec.rs:1442` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `f` to `&mut fmt::Formatter` in one and `&mut Formatter` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (20–22 lines × 2) · ×2
  • Duplicated block (20–22 lines × 2) datafusion/sqllogictest/src/engines/datafusion_engine/runner.rs:146 — datafusion/sqllogictest/src/engines/datafusion_engine/runner.rs:146-165 | datafusion/sqllogictest/src/engines/datafusion_substrait_roundtrip_engine/runner.rs:103-124 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/sqllogictest/src/engines/datafusion_engine/runner.rs:146` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (20–22 lines × 2) datafusion/functions-nested/src/array_has.rs:663 — datafusion/functions-nested/src/array_has.rs:663-684 | datafusion/functions-nested/src/array_has.rs:715-734 — 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 × 3) · ×2
  • Duplicated block (19 lines × 3) datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:1863 — datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:1863-1881 | datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:1913-1931 | datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:1943-1961 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:1863` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (19 lines × 3) datafusion/physical-plan/src/aggregates/clustered_final_stream.rs:269 — datafusion/physical-plan/src/aggregates/clustered_final_stream.rs:269-287 | datafusion/physical-plan/src/aggregates/clustered_partial_stream.rs:266-284 | datafusion/physical-plan/src/aggregates/single_stream.rs:264-282 — before extracting anything, compare `datafusion/physical-plan/src/aggregates/clustered_final_stream.rs` and `datafusion/physical-plan/src/aggregates/clustered_partial_stream.rs` as WHOLE FILES: this scan already matched 3 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/aggregates/clustered_final_stream.rs:269` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (19 lines × 2) · ×2
  • Duplicated block (19 lines × 2) datafusion/expr-common/src/casts.rs:785 — datafusion/expr-common/src/casts.rs:785-803 | datafusion/expr-common/src/casts.rs:805-823 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (19 lines × 2) datafusion/sql/src/select.rs:822 — datafusion/sql/src/select.rs:822-840 | datafusion/sql/src/select.rs:981-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.
D4 · Code Duplication · Duplicated block (18–19 lines × 2) · ×2
  • Duplicated block (18–19 lines × 2) datafusion/physical-plan/src/windows/proto.rs:138 — datafusion/physical-plan/src/windows/proto.rs:138-155 | datafusion/proto/src/physical_plan/from_proto.rs:161-179 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/windows/proto.rs:138` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18–19 lines × 2) datafusion/functions/src/unicode/find_in_set.rs:267 — datafusion/functions/src/unicode/find_in_set.rs:267-285 | datafusion/functions/src/unicode/find_in_set.rs:295-312 — 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 (16–17 lines × 2) · ×2
  • Duplicated block (16–17 lines × 2) datafusion/datasource-arrow/src/source.rs:349 — datafusion/datasource-arrow/src/source.rs:349-365 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/datasource-arrow/src/source.rs:349` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16–17 lines × 2) datafusion/sql/src/statement.rs:598 — datafusion/sql/src/statement.rs:598-614 | datafusion/sql/src/statement.rs:622-637 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/sql/src/statement.rs:598` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14–16 lines × 2) · ×2
  • Duplicated block (14–16 lines × 2) datafusion/core/src/execution/context/mod.rs:1190 — datafusion/core/src/execution/context/mod.rs:1190-1205 | datafusion/core/src/execution/context/mod.rs:1221-1234 — 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:1320 — datafusion/optimizer/src/decorrelate.rs:1320-1335 | datafusion/optimizer/src/decorrelate.rs:1368-1381 — 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:288 — datafusion/catalog/src/async.rs:288-301 | datafusion/catalog/src/async.rs:380-394 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/catalog/src/async.rs:288` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14–15 lines × 2) datafusion/physical-expr/src/expressions/cast.rs:321 — datafusion/physical-expr/src/expressions/cast.rs:321-335 | datafusion/physical-expr/src/expressions/try_cast.rs:165-178 — 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 4 separate duplicated blocks between them, totalling at least 60 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-expr/src/expressions/cast.rs:321` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `datafusion/physical-expr/src/expressions/try_cast.rs:179` calls `with_nullable` and `datafusion/physical-expr/src/expressions/cast.rs:336` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (14 lines × 3) · ×2
  • Duplicated block (14 lines × 3) datafusion/datasource-arrow/src/file_format.rs:360 — datafusion/datasource-arrow/src/file_format.rs:360-373 | datafusion/datasource-avro/src/file_format.rs:278-291 | datafusion/datasource-parquet/src/sink.rs:375-388 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/datasource-arrow/src/file_format.rs:360` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 3) datafusion/physical-plan/src/joins/asof_join.rs:600 — datafusion/physical-plan/src/joins/asof_join.rs:600-613 | datafusion/physical-plan/src/joins/sort_merge_join/exec.rs:878-891 | datafusion/physical-plan/src/joins/symmetric_hash_join.rs:684-697 — 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 51 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/joins/asof_join.rs:600` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (13 lines × 3) · ×2
  • Duplicated block (13 lines × 3) datafusion/physical-plan/src/aggregates/group_values/multi_group_by/bytes.rs:136 — datafusion/physical-plan/src/aggregates/group_values/multi_group_by/bytes.rs:136-148 | datafusion/physical-plan/src/aggregates/group_values/multi_group_by/bytes_view.rs:142-154 | datafusion/physical-plan/src/aggregates/group_values/multi_group_by/fixed_size_binary.rs:162-174 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/aggregates/group_values/multi_group_by/bytes.rs:136` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 3) datafusion/sql/src/parser.rs:826 — datafusion/sql/src/parser.rs:826-838 | datafusion/sql/src/parser.rs:1303-1315 | datafusion/sql/src/parser.rs:1390-1402 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/sql/src/parser.rs:826` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (11–13 lines × 2) · ×2
  • Duplicated block (11–13 lines × 2) datafusion/functions/src/datetime/make_date.rs:119 — datafusion/functions/src/datetime/make_date.rs:119-129 | datafusion/functions/src/datetime/make_time.rs:122-134 — 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/clustered_final_stream.rs:436 — datafusion/physical-plan/src/aggregates/clustered_final_stream.rs:436-446 | datafusion/physical-plan/src/aggregates/clustered_partial_stream.rs:391-403 — before extracting anything, compare `datafusion/physical-plan/src/aggregates/clustered_final_stream.rs` and `datafusion/physical-plan/src/aggregates/clustered_partial_stream.rs` as WHOLE FILES: this scan already matched 3 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/aggregates/clustered_final_stream.rs:436` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note first that the copies are not typed on the same thing: the declarations holding them bind `context` to `&ClusteredFinalAggregateContext` in one and `&ClusteredPartialAggregateContext` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (11 lines × 4) · ×2
  • Duplicated block (11 lines × 4) datafusion/physical-expr/src/aggregate.rs:744 — datafusion/physical-expr/src/aggregate.rs:744-754 | datafusion/physical-expr/src/aggregate.rs:842-852 | datafusion/physical-expr/src/aggregate.rs:912-922 | datafusion/physical-expr/src/aggregate.rs:932-942 — 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 (11 lines × 4) datafusion/functions/src/string/contains.rs:46 — datafusion/functions/src/string/contains.rs:46-56 | datafusion/functions/src/string/ends_with.rs:54-64 | datafusion/functions/src/string/levenshtein.rs:58-68 | datafusion/functions/src/string/starts_with.rs:50-60 — 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 69 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) · ×2
  • Duplicated block (7–9 lines × 3) datafusion/functions/src/regex/regexpinstr.rs:214 — datafusion/functions/src/regex/regexpinstr.rs:214-220 | datafusion/functions/src/regex/regexpinstr.rs:232-240 | datafusion/functions/src/regex/regexpinstr.rs:252-260 — 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–9 lines × 3) datafusion/functions-nested/src/remove.rs:227 — datafusion/functions-nested/src/remove.rs:227-233 | datafusion/functions-nested/src/replace.rs:122-130 | datafusion/functions-nested/src/replace.rs:348-356 — 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 (8–9 lines × 2) · ×2
  • Duplicated block (8–9 lines × 2) datafusion/expr/src/expr.rs:2874 — datafusion/expr/src/expr.rs:2874-2882 | datafusion/optimizer/src/eliminate_filter.rs:250-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 (8–9 lines × 2) datafusion/functions-nested/src/string.rs:511 — datafusion/functions-nested/src/string.rs:511-518 | datafusion/functions-nested/src/string.rs:523-531 — 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 (6–9 lines × 2) · ×2
  • Duplicated block (6–9 lines × 2) datafusion/physical-plan/src/union.rs:185 — datafusion/physical-plan/src/union.rs:185-193 | datafusion/physical-plan/src/union.rs:683-688 — 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:32 — datafusion/physical-plan/src/windows/proto.rs:32-37 | datafusion/proto/src/physical_plan/to_proto.rs:91-99 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/windows/proto.rs:32` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (8 lines × 6) · ×2
  • Duplicated block (8 lines × 6) datafusion/ffi/src/catalog_provider.rs:224 — datafusion/ffi/src/catalog_provider.rs:224-231 | datafusion/ffi/src/catalog_provider_list.rs:188-195 | datafusion/ffi/src/schema_provider.rs:234-241 | datafusion/ffi/src/table_provider.rs:539-549 | datafusion/ffi/src/table_provider_factory.rs:92-99 | datafusion/ffi/src/udtf.rs:192-199 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/ffi/src/table_provider.rs:539` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (8 lines × 6) datafusion/functions-nested/src/string.rs:192 — datafusion/functions-nested/src/string.rs:192-199 | datafusion/functions/src/crypto/digest.rs:59-66 | datafusion/functions/src/regex/regexplike.rs:70-77 | datafusion/functions/src/string/btrim.rs:78-85 | datafusion/functions/src/string/ltrim.rs:83-90 | datafusion/functions/src/string/rtrim.rs:83-90 — 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 39 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 lines × 4) · ×2
  • Duplicated block (7 lines × 4) datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:203 — datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:203-209 | datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:283-289 | datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:376-382 | datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:470-476 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:203` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 4) datafusion/physical-plan/src/joins/asof_join.rs:499 — datafusion/physical-plan/src/joins/asof_join.rs:499-505 | datafusion/physical-plan/src/joins/asof_join.rs:548-554 | datafusion/physical-plan/src/joins/hash_join/exec.rs:1820-1826 | datafusion/physical-plan/src/joins/nested_loop_join.rs:683-689 — 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.
D4 · Code Duplication · Duplicated block (6–7 lines × 2) · ×2
  • Duplicated block (6–7 lines × 2) datafusion/datasource/src/projection.rs:113 — datafusion/datasource/src/projection.rs:113-118 | datafusion/datasource/src/projection.rs:242-248 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/datasource/src/projection.rs:113` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (6–7 lines × 2) datafusion/functions-nested/src/flatten.rs:120 — datafusion/functions-nested/src/flatten.rs:120-126 | datafusion/functions-nested/src/flatten.rs:156-161 — 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 lines × 5) · ×2
  • Duplicated block (5 lines × 5) datafusion/functions-nested/src/array_avg.rs:91 — datafusion/functions-nested/src/array_avg.rs:91-95 | datafusion/functions-nested/src/array_normalize.rs:97-101 | datafusion/functions-nested/src/array_product.rs:95-99 | datafusion/functions-nested/src/array_scale.rs:108-116 | datafusion/functions-nested/src/array_sum.rs:91-95 — 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 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 (5 lines × 5) datafusion/functions-nested/src/array_avg.rs:85 — datafusion/functions-nested/src/array_avg.rs:85-89 | datafusion/functions-nested/src/array_normalize.rs:91-95 | datafusion/functions-nested/src/array_product.rs:89-93 | datafusion/functions-nested/src/array_scale.rs:93-103 | datafusion/functions-nested/src/array_sum.rs:85-89 — 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 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.
D5 · Coupling · Off the main sequence · ×2
  • 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-proto-models — datafusion-proto-models: abstractness 0.00, instability 0.14, distance 0.86 — zone of pain — concrete and depended on by 12 project(s), so it's rigid to change.
P6 · Release Hygiene · Release pipeline publishes an empty version · ×2
  • Release pipeline publishes an empty version .github/workflows/dependencies.yml:40 — `.github/workflows/dependencies.yml:40` 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:58 — `REDACTED:58` 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 180) datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:855 — Simplifier::f_up has cyclomatic complexity 180 (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 73) datafusion/optimizer/src/push_down_filter.rs:849 — PushDownFilter::rewrite has cyclomatic complexity 73 (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 · PgJsonVisitor · ×1
  • PgJsonVisitor::to_json_value (cyclomatic 57) datafusion/expr/src/logical_plan/display.rs:340 — PgJsonVisitor::to_json_value 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.
D1 · Cyclomatic Complexity · SchemaDisplay · ×1
  • SchemaDisplay::fmt (cyclomatic 55) datafusion/expr/src/expr.rs:3067 — 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 · PlanType · ×1
  • PlanType::deserialize (cyclomatic 40) datafusion/proto-models/src/generated/pbjson.rs:24813 — 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.
D1 · Cyclomatic Complexity · datafusion_datasource · ×1
  • datafusion_datasource::write::demux::compute_partition_keys_by_row (cyclomatic 40) datafusion/datasource/src/write/demux.rs:398 — datafusion_datasource::write::demux::compute_partition_keys_by_row has cyclomatic complexity 40 (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 38) datafusion/optimizer/src/analyzer/type_coercion.rs:698 — TypeCoercionRewriter::f_up 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.
D1 · Cyclomatic Complexity · NativeType · ×1
  • NativeType::fmt (cyclomatic 35) datafusion/common/src/types/native.rs:185 — 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 52) 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:3364 — 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:103 — 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 · check_rust_workflow_skips.check_skip_conditions (cyclomatic 33) · ×1
  • check_rust_workflow_skips.check_skip_conditions (cyclomatic 33) ci/scripts/check_rust_workflow_skips.py:146 — check_rust_workflow_skips.check_skip_conditions 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.
D1 · Cyclomatic Complexity · PropagateEmptyRelation · ×1
  • PropagateEmptyRelation::rewrite (cyclomatic 32) datafusion/optimizer/src/propagate_empty_relation.rs:39 — 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:1700 — 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:246 — 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. This is NOT this file's highest cyclomatic complexity: datafusion_functions::datetime::date_trunc::constant_granularity_step (cyclomatic 29) 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 · TreeRenderVisitor · ×1
  • TreeRenderVisitor::render_box_content (cyclomatic 28) datafusion/physical-plan/src/display.rs:1144 — 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:652 — 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:95 — 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 · datafusion_sqllogictest · ×1
  • datafusion_sqllogictest::bin::sqllogictests::run_tests (cyclomatic 25) datafusion/sqllogictest/bin/sqllogictests.rs:120 — datafusion_sqllogictest::bin::sqllogictests::run_tests 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 · cancel_merge_queue_runs.run (cyclomatic 25) · ×1
  • cancel_merge_queue_runs.run (cyclomatic 25) ci/scripts/cancel_merge_queue_runs.cjs:86 — cancel_merge_queue_runs.run 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.
D1 · Cyclomatic Complexity · ListingTableFactory · ×1
  • ListingTableFactory::create_inner (cyclomatic 24) datafusion/core/src/datasource/listing_table_factory.rs:67 — 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:214 — 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:112 — 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:211 — 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 · PushDecoderStreamState · ×1
  • PushDecoderStreamState::transition (cyclomatic 23) datafusion/datasource-parquet/src/push_decoder.rs:431 — PushDecoderStreamState::transition 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 · PredicateBoundsEvaluator · ×1
  • PredicateBoundsEvaluator::evaluate_bounds (cyclomatic 23) datafusion/expr/src/predicate_bounds.rs:55 — 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:722 — 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:278 — 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 · ParquetColumnOptions · ×1
  • ParquetColumnOptions::deserialize (cyclomatic 22) datafusion/proto-common/src/generated/pbjson.rs:6120 — 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 · datafusion · ×1
  • datafusion::bin::print_functions_docs::print_docs (cyclomatic 22) datafusion/core/src/bin/print_functions_docs.rs:79 — 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 · PartitionedFile · ×1
  • PartitionedFile::deserialize (cyclomatic 22) datafusion/proto-models/src/generated/pbjson.rs:18236 — 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.
D1 · Cyclomatic Complexity · BinaryTypeCoercer · ×1
  • BinaryTypeCoercer::signature_inner (cyclomatic 22) datafusion/expr-common/src/type_coercion/binary.rs:184 — 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 · JoinStatisticsProvider · ×1
  • JoinStatisticsProvider::compute_statistics (cyclomatic 22) datafusion/physical-plan/src/operator_statistics/mod.rs:943 — 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 · BloomFilterStatistics · ×1
  • BloomFilterStatistics::check_scalar (cyclomatic 21) datafusion/datasource-parquet/src/bloom_filter.rs:79 — 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 · InformationSchemaColumnsBuilder · ×1
  • InformationSchemaColumnsBuilder::add_column (cyclomatic 21) datafusion/expr/src/logical_plan/information_schema.rs:292 — InformationSchemaColumnsBuilder::add_column 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 · DefaultPhysicalExprAdapterRewriter · ×1
  • DefaultPhysicalExprAdapterRewriter::try_narrow_struct_cast (cyclomatic 21) datafusion/physical-expr-adapter/src/schema_rewriter.rs:484 — 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:134 — 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 · SpillReaderStream · ×1
  • SpillReaderStream::poll_next (cyclomatic 21) datafusion/physical-plan/src/spill/mod.rs:352 — SpillReaderStream::poll_next 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 · DFParser · ×1
  • DFParser::parse_create_external_table (cyclomatic 21) datafusion/sql/src/parser.rs:1194 — 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 · AggregateExec · ×1
  • AggregateExec::try_optimize_topk (cyclomatic 20) datafusion/physical-plan/src/aggregates/optimizations.rs:449 — AggregateExec::try_optimize_topk 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.
D1 · Cyclomatic Complexity · DFSchema · ×1
  • DFSchema::datatype_is_semantically_equal (cyclomatic 19) datafusion/common/src/dfschema.rs:787 — 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:134 — 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:200 — 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:53 — 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:419 — 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:594 — 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 · NthValueEvaluator · ×1
  • NthValueEvaluator::memoize (cyclomatic 19) datafusion/functions-window/src/nth_value.rs:390 — NthValueEvaluator::memoize 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 · JsonArrayToNdjsonReader · ×1
  • JsonArrayToNdjsonReader::process_byte (cyclomatic 18) datafusion/datasource-json/src/utils.rs:196 — 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 · ParquetOpenState · ×1
  • ParquetOpenState::transition (cyclomatic 18) datafusion/datasource-parquet/src/opener/mod.rs:613 — ParquetOpenState::transition 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 · ScalarSubqueryToJoin · ×1
  • ScalarSubqueryToJoin::rewrite (cyclomatic 18) datafusion/optimizer/src/scalar_subquery_to_join.rs:75 — 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 · StandardWindowExpr · ×1
  • StandardWindowExpr::evaluate_stateful (cyclomatic 18) datafusion/physical-expr/src/window/standard.rs:139 — StandardWindowExpr::evaluate_stateful 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 · ClusteredSingleAggregateStream · ×1
  • ClusteredSingleAggregateStream::handle_reading_input (cyclomatic 18) datafusion/physical-plan/src/aggregates/clustered_single_stream.rs:278 — ClusteredSingleAggregateStream::handle_reading_input 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 · NestedLoopJoinStream · ×1
  • NestedLoopJoinStream::poll_next (cyclomatic 18) datafusion/physical-plan/src/joins/nested_loop_join.rs:2271 — 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.
D1 · Cyclomatic Complexity · datafusion_sql · ×1
  • datafusion_sql::unparser::utils::date_part_to_sql (cyclomatic 18) datafusion/sql/src/unparser/utils.rs:437 — 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:93 — 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 · ListingTable · ×1
  • ListingTable::scan_with_args_inner (cyclomatic 17) datafusion/catalog-listing/src/table.rs:638 — ListingTable::scan_with_args_inner 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 · RowGroupsPrunedParquetOpen · ×1
  • RowGroupsPrunedParquetOpen::should_load_page_index (cyclomatic 17) datafusion/datasource-parquet/src/opener/mod.rs:1388 — RowGroupsPrunedParquetOpen::should_load_page_index 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 · ToTimestampFunc · ×1
  • ToTimestampFunc::invoke_with_args (cyclomatic 17) datafusion/functions/src/datetime/to_timestamp.rs:414 — 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:268 — 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:94 — 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 · PushdownSort · ×1
  • PushdownSort::optimize (cyclomatic 17) datafusion/physical-optimizer/src/pushdown_sort.rs:71 — PushdownSort::optimize 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 · FunctionArgs · ×1
  • FunctionArgs::try_new (cyclomatic 17) datafusion/sql/src/expr/function.rs:88 — 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:385 — 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 · PushdownChecker · ×1
  • PushdownChecker::f_down (cyclomatic 16) datafusion/datasource-parquet/src/projection_read_plan.rs:383 — 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:695 — 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:82 — 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 · InListExpr · ×1
  • InListExpr::evaluate (cyclomatic 16) datafusion/physical-expr/src/expressions/in_list.rs:324 — 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:274 — 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 · datafusion_cli · ×1
  • datafusion_cli::exec::exec_from_repl (cyclomatic 16) datafusion-cli/src/exec.rs:111 — 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.
D1 · Cyclomatic Complexity · generate-changelog.generate_changelog (cyclomatic 16) · ×1
  • generate-changelog.generate_changelog (cyclomatic 16) REDACTED:23 — 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 10 files · ×1
  • TodoComment repeated across 10 files datafusion/substrait/tests/cases/roundtrip_logical_plan.rs:93 — 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.)
D17 · Explicit Debt · TodoComment repeated across 11 files · ×1
  • TodoComment repeated across 11 files datafusion/sql/src/utils.rs:753 — 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 datafusion/physical-plan/src/analyze.rs:195 — 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.)
D2 · Cognitive Complexity · Simplifier · ×1
  • Simplifier::f_up (cognitive 161) datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:855 — Simplifier::f_up has cognitive complexity 161 (threshold 15). Drivers by points: if/else 40 (74 pts), boolean chains 44, match/switch 19 (37 pts), loops 3 (6 pts) (nesting depth added 55). 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 · PushDownFilter · ×1
  • PushDownFilter::rewrite (cognitive 109) datafusion/optimizer/src/push_down_filter.rs:849 — PushDownFilter::rewrite has cognitive complexity 109 (threshold 15). Drivers by points: if/else 37 (63 pts), loops 11 (25 pts), boolean chains 16, match/switch 3 (5 pts) (nesting depth added 42). To reduce it, split the body into named stages: move each independent 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_rust_workflow_skips.check_skip_conditions (cognitive 56) · ×1
  • check_rust_workflow_skips.check_skip_conditions (cognitive 56) ci/scripts/check_rust_workflow_skips.py:146 — check_rust_workflow_skips.check_skip_conditions has cognitive complexity 56 (threshold 15). Drivers by points: if/else 18 (36 pts), loops 7 (11 pts), boolean chains 9 (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 · AlignedBoundaryStream · ×1
  • AlignedBoundaryStream::poll_next (cognitive 53) datafusion/datasource/src/boundary_stream.rs:214 — 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 · SpillReaderStream · ×1
  • SpillReaderStream::poll_next (cognitive 52) datafusion/physical-plan/src/spill/mod.rs:352 — SpillReaderStream::poll_next has cognitive complexity 52 (threshold 15). Drivers by points: if/else 12 (37 pts), match/switch 4 (13 pts), boolean chains 1, loops 1 (nesting depth added 34). To reduce it, split the body into named stages: move each independent 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:1700 — 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 · PgJsonVisitor · ×1
  • PgJsonVisitor::to_json_value (cognitive 49) datafusion/expr/src/logical_plan/display.rs:340 — PgJsonVisitor::to_json_value has cognitive complexity 49 (threshold 15). Drivers by points: if/else 18 (38 pts), match/switch 5 (11 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent 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:75 — 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:211 — 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 · PushDecoderStreamState · ×1
  • PushDecoderStreamState::transition (cognitive 47) datafusion/datasource-parquet/src/push_decoder.rs:431 — PushDecoderStreamState::transition has cognitive complexity 47 (threshold 15). Drivers by points: if/else 10 (32 pts), match/switch 4 (11 pts), boolean chains 3, 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.
D2 · Cognitive Complexity · ConcatWsFunc · ×1
  • ConcatWsFunc::invoke_with_args (cognitive 47) datafusion/functions/src/string/concat_ws.rs:103 — 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:67 — 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 · cancel_merge_queue_runs.run (cognitive 44) · ×1
  • cancel_merge_queue_runs.run (cognitive 44) ci/scripts/cancel_merge_queue_runs.cjs:86 — cancel_merge_queue_runs.run has cognitive complexity 44 (threshold 15). Drivers by points: if/else 14 (30 pts), error handling 3 (6 pts), loops 3 (4 pts), boolean chains 2, ternaries 1 (2 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.
D2 · Cognitive Complexity · PlanType · ×1
  • PlanType::deserialize (cognitive 43) datafusion/proto-models/src/generated/pbjson.rs:24813 — 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.
D2 · Cognitive Complexity · SchemaDisplay · ×1
  • SchemaDisplay::fmt (cognitive 41) datafusion/expr/src/expr.rs:3067 — 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 · StandardWindowExpr · ×1
  • StandardWindowExpr::evaluate_stateful (cognitive 39) datafusion/physical-expr/src/window/standard.rs:139 — StandardWindowExpr::evaluate_stateful has cognitive complexity 39 (threshold 15). Drivers by points: if/else 20 (34 pts), loops 2 (3 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.
D2 · Cognitive Complexity · ScanState · ×1
  • ScanState::poll_scan (cognitive 38) datafusion/datasource/src/file_stream/scan_state.rs:112 — 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:370 — 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 · ArrayMap · ×1
  • ArrayMap::lookup_and_get_indices (cognitive 36) datafusion/physical-plan/src/joins/array_map.rs:274 — ArrayMap::lookup_and_get_indices has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (26 pts), loops 2 (4 pts), match/switch 2 (4 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.
D2 · Cognitive Complexity · WindowShiftEvaluator · ×1
  • WindowShiftEvaluator::evaluate (cognitive 35) datafusion/functions-window/src/lead_lag.rs:594 — 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:324 — 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 · RoundFunc · ×1
  • RoundFunc::invoke_with_args (cognitive 33) datafusion/functions/src/math/round.rs:278 — 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:684 — 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 · DFParser · ×1
  • DFParser::parse_create_external_table (cognitive 33) datafusion/sql/src/parser.rs:1194 — 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:722 — 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:468 — 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 · CsvFormat · ×1
  • CsvFormat::infer_schema_from_stream (cognitive 30) datafusion/datasource-csv/src/file_format.rs:526 — 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:383 — 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 · SingleDistinctToGroupBy · ×1
  • SingleDistinctToGroupBy::rewrite (cognitive 30) datafusion/optimizer/src/single_distinct_to_groupby.rs:244 — SingleDistinctToGroupBy::rewrite has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (19 pts), match/switch 4 (9 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.
D2 · Cognitive Complexity · AsOfJoinStream · ×1
  • AsOfJoinStream::poll_next_impl (cognitive 30) datafusion/physical-plan/src/joins/asof_join.rs:1262 — 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 · GroupsAccumulatorAdapter · ×1
  • GroupsAccumulatorAdapter::invoke_per_accumulator_with_scratch (cognitive 29) datafusion/functions-aggregate-common/src/aggregate/groups_accumulator.rs:301 — 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:1169 — 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:196 — 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 · LogicalPlanBuilder · ×1
  • LogicalPlanBuilder::infer_data (cognitive 28) datafusion/expr/src/logical_plan/builder.rs:458 — 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 · KeyRangeBitmap · ×1
  • KeyRangeBitmap::union (cognitive 28) datafusion/physical-plan/src/joins/key_range_bitmap.rs:120 — KeyRangeBitmap::union has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (21 pts), loops 2 (5 pts), match/switch 1 (2 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 · WindowFrameStateRange · ×1
  • WindowFrameStateRange::calculate_index_of_row (cognitive 27) datafusion/expr/src/window_state.rs:527 — WindowFrameStateRange::calculate_index_of_row has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (16 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 · CommonSubexprEliminate · ×1
  • CommonSubexprEliminate::try_optimize_aggregate (cognitive 26) datafusion/optimizer/src/common_subexpr_eliminate.rs:237 — 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 · ArrowBytesMap · ×1
  • ArrowBytesMap::insert_if_new_inner (cognitive 26) datafusion/physical-expr-common/src/binary_map.rs:413 — 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 · PushdownSort · ×1
  • PushdownSort::optimize (cognitive 26) datafusion/physical-optimizer/src/pushdown_sort.rs:71 — PushdownSort::optimize has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 3, match/switch 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 · ClusteredSingleAggregateStream · ×1
  • ClusteredSingleAggregateStream::handle_reading_input (cognitive 26) datafusion/physical-plan/src/aggregates/clustered_single_stream.rs:278 — ClusteredSingleAggregateStream::handle_reading_input has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 6 (13 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 · MemorySourceConfig · ×1
  • MemorySourceConfig::repartition_preserving_order (cognitive 25) datafusion/datasource/src/memory.rs:556 — 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 · PartitionedFile · ×1
  • PartitionedFile::deserialize (cognitive 25) datafusion/proto-models/src/generated/pbjson.rs:18236 — 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.
D2 · Cognitive Complexity · WindowFrameStateGroups · ×1
  • WindowFrameStateGroups::calculate_index_of_row (cognitive 25) datafusion/expr/src/window_state.rs:695 — 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 · NthValueEvaluator · ×1
  • NthValueEvaluator::memoize (cognitive 25) datafusion/functions-window/src/nth_value.rs:390 — NthValueEvaluator::memoize has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 6, match/switch 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 · DecorrelatePredicateSubquery · ×1
  • DecorrelatePredicateSubquery::rewrite (cognitive 25) datafusion/optimizer/src/decorrelate_predicate_subquery.rs:52 — DecorrelatePredicateSubquery::rewrite has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 3 (9 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 · GraphvizVisitor · ×1
  • GraphvizVisitor::pre_visit (cognitive 25) datafusion/physical-plan/src/display.rs:683 — 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 · HashJoinExec · ×1
  • HashJoinExec::fmt_as (cognitive 25) datafusion/physical-plan/src/joins/hash_join/exec.rs:1441 — HashJoinExec::fmt_as has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (22 pts), match/switch 2 (3 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 · PrimitiveValuesRouter · ×1
  • PrimitiveValuesRouter::route_with (cognitive 25) datafusion/physical-plan/src/repartition/range.rs:392 — 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:452 — 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 · PreparedAccessPlan · ×1
  • PreparedAccessPlan::reorder_by_statistics (cognitive 24) datafusion/datasource-parquet/src/access_plan.rs:737 — 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:95 — 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 · DistinctArrayAggGroupsAccumulator · ×1
  • DistinctArrayAggGroupsAccumulator::evaluate (cognitive 24) datafusion/functions-aggregate/src/array_agg.rs:1088 — DistinctArrayAggGroupsAccumulator::evaluate has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 4 (6 pts), match/switch 3, 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 · OrderingEquivalenceClass · ×1
  • OrderingEquivalenceClass::remove_redundant_entries (cognitive 24) datafusion/physical-expr/src/equivalence/ordering.rs:96 — 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 · CsvOpener · ×1
  • CsvOpener::open (cognitive 23) datafusion/datasource-csv/src/source.rs:758 — CsvOpener::open has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 1 (3 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 · Documentation · ×1
  • Documentation::to_doc_attribute (cognitive 23) datafusion/doc/src/lib.rs:74 — 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:86 — 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:39 — 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 · CaseBody · ×1
  • CaseBody::case_when_with_expr (cognitive 23) datafusion/physical-expr/src/expressions/case.rs:768 — 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:283 — 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:276 — 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:1731 — 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:93 — 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 · ProjectionExprs · ×1
  • ProjectionExprs::project_statistics_impl (cognitive 22) datafusion/physical-expr/src/projection.rs:718 — ProjectionExprs::project_statistics_impl has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 2 (8 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 · MessageFramer · ×1
  • MessageFramer::push (cognitive 22) datafusion/physical-plan/src/spill/mod.rs:187 — 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 · JsonFormat · ×1
  • JsonFormat::infer_schema (cognitive 21) datafusion/datasource-json/src/file_format.rs:242 — 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:3364 — 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:200 — 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:53 — 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 · Optimizer · ×1
  • Optimizer::optimize (cognitive 21) datafusion/optimizer/src/optimizer.rs:632 — 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 · LiteralGuarantee · ×1
  • LiteralGuarantee::analyze (cognitive 21) datafusion/physical-expr/src/utils/guarantee.rs:109 — LiteralGuarantee::analyze has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (16 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 · DefaultPhysicalExprAdapterRewriter · ×1
  • DefaultPhysicalExprAdapterRewriter::try_narrow_struct_cast (cognitive 21) datafusion/physical-expr-adapter/src/schema_rewriter.rs:484 — 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 · Aggregating · ×1
  • Aggregating::handle_stage (cognitive 21) datafusion/physical-plan/src/aggregates/clustered_final_stream.rs:317 — Aggregating::handle_stage has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 3 (8 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.
D2 · Cognitive Complexity · IndentVisitor · ×1
  • IndentVisitor::pre_visit (cognitive 21) datafusion/physical-plan/src/display.rs:585 — 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 · PrintOptions · ×1
  • PrintOptions::write_output (cognitive 21) datafusion-cli/src/print_options.rs:172 — 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 · ListingTable · ×1
  • ListingTable::scan_with_args_inner (cognitive 20) datafusion/catalog-listing/src/table.rs:638 — ListingTable::scan_with_args_inner has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (13 pts), match/switch 3 (4 pts), boolean chains 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.
D2 · Cognitive Complexity · NativeType · ×1
  • NativeType::fmt (cognitive 20) datafusion/common/src/types/native.rs:185 — 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 · SortKeyWalk · ×1
  • SortKeyWalk::pin_key (cognitive 20) datafusion/physical-expr/src/equivalence/properties/walk.rs:220 — SortKeyWalk::pin_key has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 3 (7 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 · RepartitionExecState · ×1
  • RepartitionExecState::consume_input_streams (cognitive 20) datafusion/physical-plan/src/repartition/mod.rs:433 — 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:2537 — 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:22 — 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:860 — 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 · CoalesceFunc · ×1
  • CoalesceFunc::invoke_with_args (cognitive 19) datafusion/functions/src/core/coalesce.rs:134 — CoalesceFunc::invoke_with_args has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), match/switch 3 (6 pts), loops 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 · PercentileContAccumulator · ×1
  • PercentileContAccumulator::retract_batch (cognitive 19) datafusion/functions-aggregate/src/percentile_cont.rs:530 — 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 · GroupedTopKAggregateStream · ×1
  • GroupedTopKAggregateStream::poll_next (cognitive 19) datafusion/physical-plan/src/aggregates/grouped_topk_stream.rs:191 — 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 · UnmarkedPairs · ×1
  • UnmarkedPairs::scope_matches (cognitive 19) datafusion/physical-plan/src/joins/hash_join/not_in.rs:1354 — UnmarkedPairs::scope_matches has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (10 pts), match/switch 4 (6 pts), loops 1 (2 pts), boolean chains 1 (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.
D2 · Cognitive Complexity · RecvFuture · ×1
  • RecvFuture::poll (cognitive 19) datafusion/physical-plan/src/repartition/distributor_channels.rs:282 — 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 · draft_inactive_prs.run (cognitive 19) · ×1
  • draft_inactive_prs.run (cognitive 19) ci/scripts/draft_inactive_prs.cjs:102 — draft_inactive_prs.run has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 2, loops 2, ternaries 1 (2 pts) (nesting depth added 8). Of this number, 18 points are the body's own statements and 1 belongs to one function literal 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.
D2 · Cognitive Complexity · Statistics · ×1
  • Statistics::with_fetch (cognitive 18) datafusion/common/src/stats.rs:545 — 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:202 — 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 · PredicateBoundsEvaluator · ×1
  • PredicateBoundsEvaluator::evaluate_bounds (cognitive 18) datafusion/expr/src/predicate_bounds.rs:55 — 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 · EliminateGroupByConstant · ×1
  • EliminateGroupByConstant::rewrite (cognitive 18) datafusion/optimizer/src/eliminate_group_by_constant.rs:30 — EliminateGroupByConstant::rewrite has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 2 (4 pts), match/switch 2 (3 pts), boolean chains 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 · ProjectionMapping · ×1
  • ProjectionMapping::try_new (cognitive 18) datafusion/physical-expr/src/projection.rs:1285 — 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 · SpillPoolReader · ×1
  • SpillPoolReader::poll_next (cognitive 18) datafusion/physical-plan/src/spill/spill_pool.rs:724 — 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:1436 — 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 · MinMaxStatistics · ×1
  • MinMaxStatistics::new_from_files (cognitive 17) datafusion/datasource/src/statistics.rs:54 — MinMaxStatistics::new_from_files has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 4, match/switch 1 (2 pts) (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:1907 — 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:453 — 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 · FilterNullJoinKeys · ×1
  • FilterNullJoinKeys::rewrite (cognitive 17) datafusion/optimizer/src/filter_null_join_keys.rs:27 — 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:149 — 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 · TopKAggregation · ×1
  • TopKAggregation::transform_sort (cognitive 17) datafusion/physical-optimizer/src/topk_aggregation.rs:114 — TopKAggregation::transform_sort has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 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 · HashJoinStream · ×1
  • HashJoinStream::process_probe_batch (cognitive 17) datafusion/physical-plan/src/joins/hash_join/stream.rs:843 — HashJoinStream::process_probe_batch has cognitive complexity 17 (threshold 15). Drivers by points: if/else 15, 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 · IncrementalSortIterator · ×1
  • IncrementalSortIterator::next (cognitive 17) datafusion/physical-plan/src/sorts/stream.rs:411 — IncrementalSortIterator::next has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 6 (12 pts), if/else 3 (5 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 · UnnestStream · ×1
  • UnnestStream::poll_next_impl (cognitive 17) datafusion/physical-plan/src/unnest.rs:612 — 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 · DerivedRelationBuilder · ×1
  • DerivedRelationBuilder::build (cognitive 17) datafusion/sql/src/unparser/ast.rs:687 — 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:23 — 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 · BufferIdMap · ×1
  • BufferIdMap::decrement (cognitive 16) datafusion/common/src/utils/memory.rs:749 — BufferIdMap::decrement has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (15 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 · ParquetCdcOptions · ×1
  • ParquetCdcOptions::deserialize (cognitive 16) datafusion/proto-common/src/generated/pbjson.rs:5921 — 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: one other method here (JsonOptions::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 · JsonOptions · ×1
  • JsonOptions::deserialize (cognitive 16) datafusion/proto-common/src/generated/pbjson.rs:5143 — 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: one other method here (ParquetCdcOptions::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 · BloomFilterStatistics · ×1
  • BloomFilterStatistics::check_scalar (cognitive 16) datafusion/datasource-parquet/src/bloom_filter.rs:79 — 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 · InformationSchemaColumnsBuilder · ×1
  • InformationSchemaColumnsBuilder::add_column (cognitive 16) datafusion/expr/src/logical_plan/information_schema.rs:292 — InformationSchemaColumnsBuilder::add_column has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12, 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 · Partitioning · ×1
  • Partitioning::deserialize (cognitive 16) datafusion/proto-models/src/generated/pbjson.rs:18417 — 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.
D2 · Cognitive Complexity · BinaryTypeCoercer · ×1
  • BinaryTypeCoercer::signature_inner (cognitive 16) datafusion/expr-common/src/type_coercion/binary.rs:184 — 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 · datafusion_functions_aggregate · ×1
  • datafusion_functions_aggregate::percentile_cont::create_percentile_accumulator (cognitive 16) datafusion/functions-aggregate/src/percentile_cont.rs:282 — 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 · ReplaceFilterTop1 · ×1
  • ReplaceFilterTop1::rewrite (cognitive 16) datafusion/optimizer/src/replace_filter_top1.rs:65 — ReplaceFilterTop1::rewrite has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), match/switch 3 (4 pts), boolean chains 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 · TopKRepartition · ×1
  • TopKRepartition::optimize (cognitive 16) datafusion/physical-optimizer/src/topk_repartition.rs:63 — 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 · TopKHeap · ×1
  • TopKHeap::_tree_print (cognitive 16) datafusion/physical-plan/src/aggregates/topk/heap.rs:457 — TopKHeap::_tree_print has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (15 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.
D2 · Cognitive Complexity · FilterExecStream · ×1
  • FilterExecStream::poll_next (cognitive 16) datafusion/physical-plan/src/filter.rs:1833 — 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 · AggregateStatisticsProvider · ×1
  • AggregateStatisticsProvider::compute_statistics (cognitive 16) datafusion/physical-plan/src/operator_statistics/mod.rs:843 — 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:943 — 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 · StatisticsContext · ×1
  • StatisticsContext::try_provider_stats (cognitive 16) datafusion/physical-plan/src/statistics.rs:546 — StatisticsContext::try_provider_stats has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 1 (2 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 · FunctionArgs · ×1
  • FunctionArgs::try_new (cognitive 16) datafusion/sql/src/expr/function.rs:88 — 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:40 — 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.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D30 · Dependency Vulnerabilities · Medium vulnerability · ×1
  • REDACTED
D30 · Dependency Vulnerabilities · Medium advisory (unsound) · ×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:83 — datafusion/functions-nested/src/array_avg.rs:83-98 | datafusion/functions-nested/src/array_normalize.rs:89-104 | datafusion/functions-nested/src/array_product.rs:87-102 | datafusion/functions-nested/src/array_scale.rs:91-119 | datafusion/functions-nested/src/array_sum.rs:83-98 — 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:385 — datafusion-cli/src/object_storage.rs:385-420 | datafusion-cli/src/object_storage.rs:470-507 | datafusion/common/src/config.rs:2508-2539 | datafusion/common/src/config.rs:3289-3320 — 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 (58 shared lines) · ×1
  • Near-duplicate member pair (58 shared lines) datafusion/functions/src/string/ends_with.rs:80 — datafusion/functions/src/string/ends_with.rs:80-147 | datafusion/functions/src/string/starts_with.rs:76-143 — These two members are variants of one another: 58 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 (45 shared lines) · ×1
  • Near-duplicate member pair (45 shared lines) datafusion/common/src/scalar/mod.rs:2001 — datafusion/common/src/scalar/mod.rs:2001-2076 | datafusion/common/src/scalar/mod.rs:2079-2150 — These two members are variants of one another: 45 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:772 — datafusion/physical-expr/src/expressions/case.rs:772-911 | datafusion/physical-expr/src/expressions/case.rs:918-997 — 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 (36 shared lines) · ×1
  • Near-duplicate member pair (36 shared lines) datafusion/datasource-csv/src/source.rs:923 — datafusion/datasource-csv/src/source.rs:923-976 | datafusion/datasource-json/src/source.rs:593-642 — These two members are variants of one another: 36 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:272 — datafusion/physical-plan/src/display.rs:272-317 | datafusion/physical-plan/src/display.rs:471-512 — 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 (24 shared lines) · ×1
  • Near-duplicate member pair (24 shared lines) datafusion/common/src/dfschema.rs:715 — datafusion/common/src/dfschema.rs:715-780 | datafusion/common/src/dfschema.rs:787-866 — These two members are variants of one another: 24 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 · Members sharing a duplicated core (12 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (12 members, 50+ identical tokens) datafusion/physical-plan/src/aggregates/mod.rs:2169 — datafusion/physical-plan/src/aggregates/mod.rs:2169-2225 | datafusion/physical-plan/src/async_func.rs:165-178 | datafusion/physical-plan/src/buffer.rs:164-176 | datafusion/physical-plan/src/coalesce_batches.rs:173-186 | datafusion/physical-plan/src/coalesce_partitions.rs:154-168 | datafusion/physical-plan/src/filter.rs:697-713 | datafusion/physical-plan/src/limit.rs:191-205 | datafusion/physical-plan/src/limit.rs:481-494 | datafusion/physical-plan/src/sorts/sort_preserving_merge.rs:278-291 | datafusion/physical-plan/src/unnest.rs:231-247 | datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs:465-484 | datafusion/physical-plan/src/windows/window_agg_exec.rs:256-270 — These 12 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 12 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 12 times.
D4 · Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (5 members, 50+ identical tokens) datafusion/datasource/src/memory.rs:697 — datafusion/datasource/src/memory.rs:697-767 | datafusion/physical-plan/src/joins/asof_join.rs:659-745 | datafusion/physical-plan/src/joins/hash_join/exec.rs:2246-2370 | datafusion/physical-plan/src/joins/nested_loop_join.rs:993-1036 | datafusion/physical-plan/src/joins/sort_merge_join/exec.rs:951-1043 — 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 · Edited copy of a member (131 corresponding lines) · ×1
  • Edited copy of a member (131 corresponding lines) datafusion/common/src/scalar/mod.rs:534 — datafusion/common/src/scalar/mod.rs:534-664 | datafusion/common/src/scalar/mod.rs:669-850 — These two members are one piece of code written twice and then edited apart: 131 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 (74 corresponding lines) · ×1
  • Edited copy of a member (74 corresponding lines) datafusion/common/src/scalar/mod.rs:5399 — datafusion/common/src/scalar/mod.rs:5399-5472 | datafusion/common/src/scalar/mod.rs:5488-5565 — These two members are one piece of code written twice and then edited apart: 74 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 (66 corresponding lines) · ×1
  • Edited copy of a member (66 corresponding lines) datafusion/common/src/hash_utils.rs:1212 — datafusion/common/src/hash_utils.rs:1212-1305 | datafusion/common/src/hash_utils/build_hasher.rs:403-468 — These two members are one piece of code written twice and then edited apart: 66 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 (116 corresponding lines) · ×1
  • Edited copy of a member (116 corresponding lines) datafusion/functions/src/math/ceil.rs:84 — datafusion/functions/src/math/ceil.rs:84-199 | datafusion/functions/src/math/floor.rs:130-245 — These two members are one piece of code written twice and then edited apart: 116 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 (56 corresponding lines) · ×1
  • Edited copy of a member (56 corresponding lines) datafusion/functions/src/datetime/make_date.rs:97 — datafusion/functions/src/datetime/make_date.rs:97-152 | datafusion/functions/src/datetime/make_time.rs:98-160 — These two members are one piece of code written twice and then edited apart: 56 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 (82 corresponding lines) · ×1
  • Edited copy of a member (82 corresponding lines) datafusion/functions-nested/src/extract.rs:590 — datafusion/functions-nested/src/extract.rs:590-671 | datafusion/functions-nested/src/extract.rs:681-764 — These two members are one piece of code written twice and then edited apart: 82 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 (67 corresponding lines) · ×1
  • Edited copy of a member (67 corresponding lines) datafusion/physical-plan/src/windows/proto.rs:31 — datafusion/physical-plan/src/windows/proto.rs:31-97 | datafusion/proto/src/physical_plan/to_proto.rs:90-168 — These two members are one piece of code written twice and then edited apart: 67 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 (54 corresponding lines) · ×1
  • Edited copy of a member (54 corresponding lines) datafusion/expr-common/src/signature.rs:924 — datafusion/expr-common/src/signature.rs:924-977 | datafusion/expr-common/src/signature.rs:986-1046 — These two members are one piece of code written twice and then edited apart: 54 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 (46 corresponding lines) · ×1
  • Edited copy of a member (46 corresponding lines) datafusion/functions-nested/src/array_has.rs:659 — datafusion/functions-nested/src/array_has.rs:659-705 | datafusion/functions-nested/src/array_has.rs:712-757 — These two members are one piece of code written twice and then edited apart: 46 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 (53 corresponding lines) · ×1
  • Edited copy of a member (53 corresponding lines) datafusion/common/src/hash_utils.rs:493 — datafusion/common/src/hash_utils.rs:493-545 | datafusion/common/src/hash_utils/build_hasher.rs:336-395 — These two members are one piece of code written twice and then edited apart: 53 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 (60 corresponding lines) · ×1
  • Edited copy of a member (60 corresponding lines) datafusion/physical-expr/src/expressions/case/literal_lookup_table/bytes_like_lookup_table.rs:72 — datafusion/physical-expr/src/expressions/case/literal_lookup_table/bytes_like_lookup_table.rs:72-131 | datafusion/physical-expr/src/expressions/case/literal_lookup_table/bytes_like_lookup_table.rs:135-210 — These two members are one piece of code written twice and then edited apart: 60 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 (49 corresponding lines) · ×1
  • Edited copy of a member (49 corresponding lines) datafusion/physical-plan/src/aggregates/aggregate_hash_table/common.rs:139 — datafusion/physical-plan/src/aggregates/aggregate_hash_table/common.rs:139-194 | datafusion/physical-plan/src/aggregates/aggregate_hash_table/common_clustered.rs:177-225 — These two members are one piece of code written twice and then edited apart: 49 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 (80 corresponding lines) · ×1
  • Edited copy of a member (80 corresponding lines) datafusion/functions-aggregate/src/planner.rs:23 — datafusion/functions-aggregate/src/planner.rs:23-102 | datafusion/functions-window/src/planner.rs:23-113 — These two members are one piece of code written twice and then edited apart: 80 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 (48 corresponding lines) · ×1
  • Edited copy of a member (48 corresponding lines) datafusion/physical-plan/src/aggregates/hash_stream.rs:285 — datafusion/physical-plan/src/aggregates/hash_stream.rs:285-347 | datafusion/physical-plan/src/aggregates/partial_reduce_stream.rs:153-200 — These two members are one piece of code written twice and then edited apart: 48 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 copies of one member (4 members, 48+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 48+ corresponding lines) datafusion/functions/src/datetime/to_timestamp.rs:523 — datafusion/functions/src/datetime/to_timestamp.rs:523-570 | datafusion/functions/src/datetime/to_timestamp.rs:609-656 | datafusion/functions/src/datetime/to_timestamp.rs:695-742 | datafusion/functions/src/datetime/to_timestamp.rs:781-828 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 48 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (40 corresponding lines) · ×1
  • Edited copy of a member (40 corresponding lines) datafusion/physical-plan/src/joins/nested_loop_join.rs:481 — datafusion/physical-plan/src/joins/nested_loop_join.rs:481-520 | datafusion/physical-plan/src/joins/sort_merge_join/exec.rs:440-479 — These two members are one piece of code written twice and then edited apart: 40 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 (37 corresponding lines) · ×1
  • Edited copy of a member (37 corresponding lines) datafusion/expr-common/src/signature.rs:407 — datafusion/expr-common/src/signature.rs:407-443 | datafusion/expr-common/src/signature.rs:449-487 — These two members are one piece of code written twice and then edited apart: 37 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 copies of one member (3 members, 34+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 34+ corresponding lines) datafusion/functions-nested/src/array_avg.rs:124 — datafusion/functions-nested/src/array_avg.rs:124-161 | datafusion/functions-nested/src/array_product.rs:128-161 | datafusion/functions-nested/src/array_sum.rs:124-161 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 34 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 33+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 33+ corresponding lines) datafusion/functions/src/string/common.rs:493 — datafusion/functions/src/string/common.rs:493-525 | datafusion/functions/src/string/common.rs:540-573 | datafusion/functions/src/unicode/initcap.rs:147-183 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 33 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 26+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 26+ corresponding lines) datafusion/ffi/src/udaf/mod.rs:382 — datafusion/ffi/src/udaf/mod.rs:382-416 | datafusion/ffi/src/udf/mod.rs:284-312 | datafusion/ffi/src/udwf/mod.rs:213-238 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 26 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 35+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 35+ corresponding lines) datafusion/datasource-csv/src/file_format.rs:930 — datafusion/datasource-csv/src/file_format.rs:930-965 | datafusion/datasource-json/src/file_format.rs:563-600 | datafusion/datasource-parquet/src/sink.rs:548-582 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 35 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 37+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 37+ corresponding lines) datafusion/expr/src/udaf.rs:1055 — datafusion/expr/src/udaf.rs:1055-1109 | datafusion/expr/src/udaf.rs:1156-1192 | datafusion/expr/src/udaf.rs:1345-1383 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 37 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 17+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 17+ corresponding lines) datafusion/physical-plan/src/joins/symmetric_hash_join.rs:1741 — datafusion/physical-plan/src/joins/symmetric_hash_join.rs:1741-1757 | datafusion/physical-plan/src/joins/symmetric_hash_join.rs:1771-1787 | datafusion/physical-plan/src/joins/symmetric_hash_join.rs:1802-1819 | datafusion/physical-plan/src/joins/symmetric_hash_join.rs:1834-1851 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 17 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (6 members, 14+ corresponding lines) · ×1
  • Edited copies of one member (6 members, 14+ corresponding lines) datafusion/common/src/stats.rs:131 — datafusion/common/src/stats.rs:131-144 | datafusion/common/src/stats.rs:149-162 | datafusion/common/src/stats.rs:167-180 | datafusion/common/src/stats.rs:224-238 | datafusion/common/src/stats.rs:268-281 | datafusion/common/src/stats.rs:286-300 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 14 lines, 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 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. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 18+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 18+ corresponding lines) datafusion-cli/src/object_storage/instrumented.rs:169 — datafusion-cli/src/object_storage/instrumented.rs:169-187 | datafusion-cli/src/object_storage/instrumented.rs:193-210 | datafusion-cli/src/object_storage/instrumented.rs:297-314 | datafusion-cli/src/object_storage/instrumented.rs:316-333 | datafusion-cli/src/object_storage/instrumented.rs:339-356 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 18 lines, 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 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. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 20+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 20+ corresponding lines) datafusion/physical-expr-common/src/binary_map.rs:376 — datafusion/physical-expr-common/src/binary_map.rs:376-403 | datafusion/physical-plan/src/aggregates/group_values/multi_group_by/bytes.rs:225-244 | datafusion/physical-plan/src/aggregates/group_values/multi_group_by/bytes.rs:246-267 | datafusion/physical-plan/src/aggregates/group_values/multi_group_by/bytes.rs:275-304 | datafusion/physical-plan/src/aggregates/group_values/multi_group_by/bytes.rs:306-326 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 20 lines, 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 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. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 25+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 25+ corresponding lines) datafusion/functions-nested/src/extract.rs:302 — datafusion/functions-nested/src/extract.rs:302-328 | datafusion/functions-nested/src/resize.rs:72-96 | datafusion/functions-nested/src/sort.rs:87-115 | datafusion/functions-nested/src/string.rs:88-116 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 25 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 22+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 22+ corresponding lines) datafusion/physical-expr/src/expressions/in_list.rs:487 — datafusion/physical-expr/src/expressions/in_list.rs:487-508 | datafusion/physical-expr/src/expressions/lambda.rs:291-315 | datafusion/physical-expr/src/expressions/like.rs:140-161 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 22 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 1+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 1+ corresponding lines) datafusion/functions/src/crypto/mod.rs:16 — datafusion/functions/src/crypto/mod.rs:16-16 | datafusion/functions/src/crypto/mod.rs:17-17 | datafusion/functions/src/crypto/mod.rs:18-18 | datafusion/functions/src/crypto/mod.rs:19-19 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 1 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 14+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 14+ corresponding lines) datafusion/physical-expr/src/expressions/is_not_null.rs:118 — datafusion/physical-expr/src/expressions/is_not_null.rs:118-132 | datafusion/physical-expr/src/expressions/is_null.rs:117-131 | datafusion/physical-expr/src/expressions/negative.rs:217-231 | datafusion/physical-expr/src/expressions/not.rs:197-210 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 14 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 12+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 12+ corresponding lines) datafusion/functions-aggregate/src/lib.rs:182 — datafusion/functions-aggregate/src/lib.rs:182-194 | datafusion/functions-window/src/lib.rs:74-86 | datafusion/functions/src/lib.rs:167-178 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 18+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 18+ corresponding lines) datafusion/ffi/src/catalog_provider.rs:125 — datafusion/ffi/src/catalog_provider.rs:125-144 | datafusion/ffi/src/catalog_provider.rs:150-170 | datafusion/ffi/src/catalog_provider_list.rs:98-115 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 10+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 10+ corresponding lines) datafusion/core/src/execution/session_state.rs:2368 — datafusion/core/src/execution/session_state.rs:2368-2377 | datafusion/core/src/execution/session_state.rs:2382-2392 | datafusion/core/src/execution/session_state.rs:2397-2406 | datafusion/core/src/execution/session_state.rs:2411-2420 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 10 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 21+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 21+ corresponding lines) datafusion/physical-plan/src/coop.rs:395 — datafusion/physical-plan/src/coop.rs:395-415 | datafusion/physical-plan/src/union.rs:568-588 | datafusion/physical-plan/src/union.rs:901-921 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 21 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 16+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 16+ corresponding lines) datafusion/functions-nested/src/remove.rs:186 — datafusion/functions-nested/src/remove.rs:186-201 | datafusion/functions-nested/src/replace.rs:81-99 | datafusion/functions-nested/src/replace.rs:188-207 | datafusion/functions-nested/src/replace.rs:307-325 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 16 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (8 members, 7+ corresponding lines) · ×1
  • Edited copies of one member (8 members, 7+ corresponding lines) datafusion/core/src/execution/session_state.rs:2323 — datafusion/core/src/execution/session_state.rs:2323-2329 | datafusion/core/src/execution/session_state.rs:2334-2341 | datafusion/core/src/execution/session_state.rs:2346-2352 | datafusion/core/src/execution/session_state.rs:2357-2363 | datafusion/execution/src/task.rs:208-214 | datafusion/execution/src/task.rs:215-221 | datafusion/execution/src/task.rs:222-228 | datafusion/execution/src/task.rs:233-241 — These 8 members are one piece of code written 8 times and then edited apart: every two of them correspond over at least 7 lines, 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 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. Left alone, the next edit has to be made 8 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 11+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 11+ corresponding lines) datafusion/ffi/src/execution/task_ctx.rs:111 — datafusion/ffi/src/execution/task_ctx.rs:111-124 | datafusion/ffi/src/execution/task_ctx.rs:128-138 | datafusion/ffi/src/session/mod.rs:275-287 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 11+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 11+ corresponding lines) datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:190 — datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:190-200 | datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:270-280 | datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:363-373 | datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:457-467 | datafusion/functions-aggregate-common/src/utils.rs:234-245 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 11 lines, 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 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. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (7 members, 11+ corresponding lines) · ×1
  • Edited copies of one member (7 members, 11+ corresponding lines) datafusion/physical-expr/src/expressions/column.rs:141 — datafusion/physical-expr/src/expressions/column.rs:141-153 | datafusion/physical-expr/src/expressions/is_not_null.rs:97-109 | datafusion/physical-expr/src/expressions/is_null.rs:96-108 | datafusion/physical-expr/src/expressions/negative.rs:176-188 | datafusion/physical-expr/src/expressions/not.rs:176-188 | datafusion/physical-expr/src/expressions/similar_to_pattern.rs:123-136 | datafusion/physical-expr/src/expressions/unknown_column.rs:80-90 — These 7 members are one piece of code written 7 times and then edited apart: every two of them correspond over at least 11 lines, 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 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. Left alone, the next edit has to be made 7 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 9+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 9+ corresponding lines) datafusion/physical-plan/src/aggregates/group_values/multi_group_by/boolean.rs:41 — datafusion/physical-plan/src/aggregates/group_values/multi_group_by/boolean.rs:41-51 | datafusion/physical-plan/src/aggregates/group_values/multi_group_by/bytes.rs:180-188 | datafusion/physical-plan/src/aggregates/group_values/multi_group_by/fixed_size_binary.rs:80-88 | datafusion/physical-plan/src/aggregates/group_values/multi_group_by/primitive.rs:143-156 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 9 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 6+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 6+ corresponding lines) datafusion/common/src/types/canonical_extensions/json.rs:30 — datafusion/common/src/types/canonical_extensions/json.rs:30-35 | datafusion/common/src/types/canonical_extensions/opaque.rs:29-34 | datafusion/common/src/types/canonical_extensions/timestamp_with_offset.rs:40-45 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 4+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 4+ corresponding lines) datafusion/physical-plan/src/coalesce_partitions.rs:286 — datafusion/physical-plan/src/coalesce_partitions.rs:286-289 | datafusion/physical-plan/src/limit.rs:269-272 | datafusion/physical-plan/src/sorts/sort_preserving_merge.rs:405-408 | datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs:550-553 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 4 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (41–48 lines × 2) · ×1
  • Duplicated block (41–48 lines × 2) datafusion/expr/src/type_coercion/functions.rs:162 — datafusion/expr/src/type_coercion/functions.rs:162-209 | datafusion/expr/src/type_coercion/functions.rs:253-293 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/expr/src/type_coercion/functions.rs:253` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (46 lines × 2) · ×1
  • Duplicated block (46 lines × 2) datafusion/sql/src/select.rs:218 — datafusion/sql/src/select.rs:218-263 | datafusion/sql/src/select.rs:327-372 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/sql/src/select.rs:218` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (37 lines × 2) · ×1
  • Duplicated block (37 lines × 2) datafusion/datasource/src/memory.rs:82 — datafusion/datasource/src/memory.rs:82-118 | datafusion/physical-plan/src/test.rs:76-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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/datasource/src/memory.rs:82` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `f` to `&mut fmt::Formatter` in one and `&mut Formatter` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (32–37 lines × 2) · ×1
  • Duplicated block (32–37 lines × 2) datafusion/expr/src/logical_plan/tree_node.rs:118 — datafusion/expr/src/logical_plan/tree_node.rs:118-149 | datafusion/expr/src/logical_plan/tree_node.rs:641-677 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/expr/src/logical_plan/tree_node.rs:118` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (30–36 lines × 2) · ×1
  • Duplicated block (30–36 lines × 2) datafusion/physical-plan/src/topk/mod.rs:2067 — datafusion/physical-plan/src/topk/mod.rs:2067-2102 | datafusion/physical-plan/src/topk/mod.rs:2462-2491 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/topk/mod.rs:2067` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
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:80 — datafusion/physical-plan/src/aggregates/group_values/single_group_by/bytes.rs:80-112 | datafusion/physical-plan/src/aggregates/group_values/single_group_by/bytes_view.rs:82-114 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (29–31 lines × 2) · ×1
  • Duplicated block (29–31 lines × 2) datafusion/common/src/scalar/mod.rs:5079 — datafusion/common/src/scalar/mod.rs:5079-5107 | datafusion/common/src/scalar/mod.rs:5213-5243 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/common/src/scalar/mod.rs:5213` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (26–31 lines × 2) · ×1
  • Duplicated block (26–31 lines × 2) datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:1165 — datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:1165-1195 | datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:1210-1235 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:1165` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (30 lines × 2) · ×1
  • Duplicated block (30 lines × 2) datafusion/datasource-arrow/src/file_format.rs:346 — datafusion/datasource-arrow/src/file_format.rs:346-375 | datafusion/datasource-avro/src/file_format.rs:264-293 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/datasource-arrow/src/file_format.rs:346` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (29 lines × 2) · ×1
  • Duplicated block (29 lines × 2) datafusion/physical-plan/src/aggregates/mod.rs:1982 — datafusion/physical-plan/src/aggregates/mod.rs:1982-2010 | datafusion/physical-plan/src/aggregates/mod.rs:2043-2071 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `datafusion/physical-plan/src/aggregates/mod.rs:2012` calls `join` and `datafusion/physical-plan/src/aggregates/mod.rs:2072` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (27–28 lines × 2) · ×1
  • Duplicated block (27–28 lines × 2) datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:1015 — datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:1015-1042 | datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:1105-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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:1015` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (28 lines × 2) · ×1
  • Duplicated block (28 lines × 2) datafusion/sql/src/unparser/dialect.rs:920 — datafusion/sql/src/unparser/dialect.rs:920-947 | datafusion/sql/src/unparser/dialect.rs:1143-1170 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/sql/src/unparser/dialect.rs:920` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (17–27 lines × 2) · ×1
  • Duplicated block (17–27 lines × 2) datafusion/datasource/src/file_scan_config/mod.rs:1450 — datafusion/datasource/src/file_scan_config/mod.rs:1450-1466 | datafusion/datasource/src/file_scan_config/mod.rs:1523-1549 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/datasource/src/file_scan_config/mod.rs:1450` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (27 lines × 2) · ×1
  • Duplicated block (27 lines × 2) datafusion/functions-aggregate-common/src/aggregate/groups_accumulator/accumulate.rs:599 — datafusion/functions-aggregate-common/src/aggregate/groups_accumulator/accumulate.rs:599-625 | datafusion/functions-aggregate-common/src/aggregate/groups_accumulator/accumulate.rs:634-660 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/functions-aggregate-common/src/aggregate/groups_accumulator/accumulate.rs:599` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (26 lines × 4) · ×1
  • Duplicated block (26 lines × 4) datafusion-cli/src/object_storage.rs:386 — datafusion-cli/src/object_storage.rs:386-411 | datafusion-cli/src/object_storage.rs:471-496 | datafusion/common/src/config.rs:2509-2534 | datafusion/common/src/config.rs:3290-3315 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `datafusion-cli/src/object_storage.rs:412` calls `visit` and `datafusion-cli/src/object_storage.rs:497` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (24–26 lines × 2) · ×1
  • Duplicated block (24–26 lines × 2) datafusion/common/src/hash_utils.rs:438 — datafusion/common/src/hash_utils.rs:438-463 | datafusion/common/src/hash_utils/build_hasher.rs:291-314 — 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 4 separate duplicated blocks between them, totalling at least 54 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/common/src/hash_utils.rs:438` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (26 lines × 2) · ×1
  • Duplicated block (26 lines × 2) datafusion/expr/src/logical_plan/plan.rs:1716 — datafusion/expr/src/logical_plan/plan.rs:1716-1741 | datafusion/expr/src/logical_plan/plan.rs:1756-1781 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/expr/src/logical_plan/plan.rs:1716` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `datafusion/expr/src/logical_plan/plan.rs:1714` calls `Sort`, `Ok`, `TableScan` and `datafusion/expr/src/logical_plan/plan.rs:1755` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (20–25 lines × 3) · ×1
  • Duplicated block (20–25 lines × 3) datafusion-cli/src/functions.rs:564 — datafusion-cli/src/functions.rs:564-583 | datafusion-cli/src/functions.rs:809-833 | datafusion-cli/src/functions.rs:973-997 — 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 (22–25 lines × 2) · ×1
  • Duplicated block (22–25 lines × 2) datafusion/physical-plan/src/topk/mod.rs:1858 — datafusion/physical-plan/src/topk/mod.rs:1858-1882 | datafusion/physical-plan/src/topk/mod.rs:2833-2854 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/topk/mod.rs:1858` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (24 lines × 3) · ×1
  • Duplicated block (24 lines × 3) datafusion/functions/src/datetime/to_timestamp.rs:615 — datafusion/functions/src/datetime/to_timestamp.rs:615-638 | datafusion/functions/src/datetime/to_timestamp.rs:701-724 | datafusion/functions/src/datetime/to_timestamp.rs:787-810 — 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 (22–24 lines × 2) · ×1
  • Duplicated block (22–24 lines × 2) datafusion/physical-expr/src/expressions/case.rs:168 — datafusion/physical-expr/src/expressions/case.rs:168-191 | datafusion/physical-expr/src/expressions/lambda.rs:93-114 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-expr/src/expressions/case.rs:168` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (17–23 lines × 2) · ×1
  • Duplicated block (17–23 lines × 2) datafusion/functions/src/math/round.rs:179 — datafusion/functions/src/math/round.rs:179-195 | datafusion/functions/src/math/trunc.rs:73-95 — 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 60 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/functions/src/math/trunc.rs:73` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (23 lines × 2) · ×1
  • Duplicated block (23 lines × 2) datafusion/physical-expr/src/expressions/cast.rs:836 — datafusion/physical-expr/src/expressions/cast.rs:836-858 | datafusion/physical-expr/src/expressions/try_cast.rs:317-339 — 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 4 separate duplicated blocks between them, totalling at least 60 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 × 2) · ×1
  • Duplicated block (20–23 lines × 2) datafusion/physical-plan/src/aggregates/hash_stream.rs:470 — datafusion/physical-plan/src/aggregates/hash_stream.rs:470-489 | datafusion/physical-plan/src/aggregates/partial_reduce_stream.rs:300-322 — before extracting anything, compare `datafusion/physical-plan/src/aggregates/hash_stream.rs` and `datafusion/physical-plan/src/aggregates/partial_reduce_stream.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 59 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/aggregates/hash_stream.rs:470` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `datafusion/physical-plan/src/aggregates/hash_stream.rs:490` calls `add_part`, `num_rows` and `datafusion/physical-plan/src/aggregates/partial_reduce_stream.rs:324` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (17–22 lines × 2) · ×1
  • Duplicated block (17–22 lines × 2) datafusion/common/src/config.rs:2444 — datafusion/common/src/config.rs:2444-2465 | datafusion/common/src/config.rs:2482-2498 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/common/src/config.rs:2444` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (21–22 lines × 2) · ×1
  • Duplicated block (21–22 lines × 2) datafusion/expr/src/logical_plan/tree_node.rs:86 — datafusion/expr/src/logical_plan/tree_node.rs:86-106 | datafusion/expr/src/logical_plan/tree_node.rs:610-631 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/expr/src/logical_plan/tree_node.rs:86` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (18–22 lines × 2) · ×1
  • Duplicated block (18–22 lines × 2) datafusion/physical-expr/src/window/aggregate.rs:263 — datafusion/physical-expr/src/window/aggregate.rs:263-284 | datafusion/physical-expr/src/window/sliding_aggregate.rs:195-212 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-expr/src/window/aggregate.rs:263` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (18–21 lines × 2) · ×1
  • Duplicated block (18–21 lines × 2) datafusion/physical-plan/src/joins/cross_join.rs:547 — datafusion/physical-plan/src/joins/cross_join.rs:547-567 | datafusion/physical-plan/src/joins/cross_join.rs:569-586 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/joins/cross_join.rs:547` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (12–20 lines × 2) · ×1
  • Duplicated block (12–20 lines × 2) datafusion/functions/src/datetime/to_timestamp.rs:420 — datafusion/functions/src/datetime/to_timestamp.rs:420-431 | datafusion/functions/src/datetime/to_timestamp.rs:529-548 — 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:126 — datafusion/functions-nested/src/array_avg.rs:126-144 | datafusion/functions-nested/src/array_product.rs:130-144 | datafusion/functions-nested/src/array_sum.rs:126-144 — 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 54 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 (18 lines × 3) · ×1
  • Duplicated block (18 lines × 3) datafusion/datasource-csv/src/source.rs:959 — datafusion/datasource-csv/src/source.rs:959-976 | datafusion/datasource-json/src/source.rs:625-642 | datafusion/datasource-parquet/src/writer.rs:58-75 — before extracting anything, compare `datafusion/datasource-csv/src/source.rs` and `datafusion/datasource-json/src/source.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 57 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/datasource-csv/src/source.rs:959` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (19–20 lines × 3) · ×1
  • Duplicated block (19–20 lines × 3) datafusion/ffi/src/table_provider.rs:280 — datafusion/ffi/src/table_provider.rs:280-298 | datafusion/ffi/src/table_provider.rs:361-379 | datafusion/ffi/src/table_provider.rs:399-418 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/ffi/src/table_provider.rs:280` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (14–18 lines × 2) · ×1
  • Duplicated block (14–18 lines × 2) datafusion/common/src/scalar/mod.rs:5430 — datafusion/common/src/scalar/mod.rs:5430-5443 | datafusion/common/src/scalar/mod.rs:5519-5536 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/common/src/scalar/mod.rs:5430` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (15–18 lines × 2) · ×1
  • Duplicated block (15–18 lines × 2) datafusion/functions/src/regex/regexpcount.rs:409 — datafusion/functions/src/regex/regexpcount.rs:409-423 | datafusion/functions/src/regex/regexpcount.rs:491-508 — 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 (16–17 lines × 4) · ×1
  • Duplicated block (16–17 lines × 4) datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:1015 — datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:1015-1030 | datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:1105-1120 | datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:1264-1280 | datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:1314-1330 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:1015` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (17 lines × 3) · ×1
  • Duplicated block (17 lines × 3) datafusion/physical-plan/src/sorts/partitioned_topk.rs:604 — datafusion/physical-plan/src/sorts/partitioned_topk.rs:604-620 | datafusion/physical-plan/src/sorts/partitioned_topk.rs:623-639 | datafusion/physical-plan/src/sorts/partitioned_topk.rs:642-658 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/sorts/partitioned_topk.rs:604` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14–16 lines × 3) · ×1
  • Duplicated block (14–16 lines × 3) datafusion/functions-nested/src/cosine_distance.rs:100 — datafusion/functions-nested/src/cosine_distance.rs:100-115 | datafusion/functions-nested/src/inner_product.rs:102-117 | datafusion/functions-nested/src/utils.rs:467-480 — 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 4 separate duplicated blocks between them, totalling at least 91 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/functions-nested/src/utils.rs:467` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (13–16 lines × 2) · ×1
  • Duplicated block (13–16 lines × 2) datafusion/functions-aggregate-common/src/aggregate/groups_accumulator/accumulate.rs:284 — datafusion/functions-aggregate-common/src/aggregate/groups_accumulator/accumulate.rs:284-296 | datafusion/functions-aggregate-common/src/aggregate/groups_accumulator/accumulate.rs:484-499 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/functions-aggregate-common/src/aggregate/groups_accumulator/accumulate.rs:284` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `datafusion/functions-aggregate-common/src/aggregate/groups_accumulator/accumulate.rs:297` calls `set_bit` and `datafusion/functions-aggregate-common/src/aggregate/groups_accumulator/accumulate.rs:500` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (12–16 lines × 2) · ×1
  • Duplicated block (12–16 lines × 2) datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:1300 — datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:1300-1311 | datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:1402-1417 — 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–15 lines × 4) · ×1
  • Duplicated block (9–15 lines × 4) datafusion/sql/src/unparser/expr.rs:1625 — datafusion/sql/src/unparser/expr.rs:1625-1639 | datafusion/sql/src/unparser/expr.rs:1641-1655 | datafusion/sql/src/unparser/expr.rs:1657-1671 | datafusion/sql/src/unparser/expr.rs:1672-1680 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/sql/src/unparser/expr.rs:1625` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
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:60 — datafusion/physical-plan/src/spill/in_progress_spill_file.rs:60-74 | datafusion/physical-plan/src/spill/in_progress_spill_file.rs:104-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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/spill/in_progress_spill_file.rs:60` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (15 lines × 4) · ×1
  • Duplicated block (15 lines × 4) datafusion/functions-nested/src/array_avg.rs:84 — datafusion/functions-nested/src/array_avg.rs:84-98 | datafusion/functions-nested/src/array_normalize.rs:90-104 | datafusion/functions-nested/src/array_product.rs:88-102 | datafusion/functions-nested/src/array_sum.rs:84-98 — 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 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 (14 lines × 4) · ×1
  • Duplicated block (14 lines × 4) datafusion/functions/src/datetime/to_timestamp.rs:540 — datafusion/functions/src/datetime/to_timestamp.rs:540-553 | datafusion/functions/src/datetime/to_timestamp.rs:624-637 | datafusion/functions/src/datetime/to_timestamp.rs:710-723 | datafusion/functions/src/datetime/to_timestamp.rs:796-809 — 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 (12–14 lines × 3) · ×1
  • Duplicated block (12–14 lines × 3) datafusion/catalog/src/information_schema.rs:769 — datafusion/catalog/src/information_schema.rs:769-782 | datafusion/catalog/src/information_schema.rs:784-797 | datafusion/catalog/src/information_schema.rs:798-809 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/catalog/src/information_schema.rs:769` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (10–14 lines × 2) · ×1
  • Duplicated block (10–14 lines × 2) REDACTED:2960 — REDACTED:2960-2973 | REDACTED:2978-2987 — 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–14 lines × 2) · ×1
  • Duplicated block (13–14 lines × 2) datafusion/functions-aggregate/src/array_agg.rs:1392 — datafusion/functions-aggregate/src/array_agg.rs:1392-1405 | datafusion/functions-aggregate/src/array_agg.rs:1577-1589 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/functions-aggregate/src/array_agg.rs:1392` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (10–13 lines × 2) · ×1
  • Duplicated block (10–13 lines × 2) datafusion/datasource-json/src/source.rs:414 — datafusion/datasource-json/src/source.rs:414-426 | datafusion/datasource-json/src/source.rs:470-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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/datasource-json/src/source.rs:414` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (10–11 lines × 7) · ×1
  • Duplicated block (10–11 lines × 7) datafusion/ffi/src/query_planner.rs:134 — datafusion/ffi/src/query_planner.rs:134-143 | datafusion/ffi/src/table_provider.rs:287-296 | datafusion/ffi/src/table_provider.rs:330-339 | datafusion/ffi/src/table_provider.rs:368-377 | datafusion/ffi/src/table_provider.rs:406-415 | datafusion/ffi/src/table_provider.rs:467-476 | datafusion/ffi/src/udtf.rs:137-147 — there are 7 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 7 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/ffi/src/udtf.rs:137` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `datafusion/ffi/src/table_provider.rs:327` calls `clone` and `datafusion/ffi/src/table_provider.rs:464` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8–11 lines × 2) · ×1
  • Duplicated block (8–11 lines × 2) datafusion/datasource-arrow/src/source.rs:183 — datafusion/datasource-arrow/src/source.rs:183-190 | datafusion/datasource-arrow/src/source.rs:215-225 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/datasource-arrow/src/source.rs:183` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (7–11 lines × 2) · ×1
  • Duplicated block (7–11 lines × 2) datafusion/expr/src/higher_order_function.rs:1270 — datafusion/expr/src/higher_order_function.rs:1270-1280 | datafusion/expr/src/higher_order_function.rs:1354-1360 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/expr/src/higher_order_function.rs:1270` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (17–20 lines × 2) · ×1
  • Duplicated block (17–20 lines × 2) datafusion/expr/src/logical_plan/display.rs:768 — datafusion/expr/src/logical_plan/display.rs:768-784 | datafusion/expr/src/logical_plan/plan.rs:2540-2559 — 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 52 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/expr/src/logical_plan/display.rs:768` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (9–10 lines × 4) · ×1
  • Duplicated block (9–10 lines × 4) datafusion/functions/src/regex/regexpcount.rs:93 — datafusion/functions/src/regex/regexpcount.rs:93-101 | datafusion/functions/src/regex/regexpinstr.rs:111-119 | datafusion/functions/src/regex/regexpmatch.rs:111-119 | datafusion/functions/src/utils.rs:112-121 — before extracting anything, compare `datafusion/functions/src/regex/regexpcount.rs` and `datafusion/functions/src/regex/regexpinstr.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 40 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/functions/src/utils.rs:112` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (10 lines × 3) · ×1
  • Duplicated block (10 lines × 3) datafusion/functions/src/math/nanvl.rs:63 — datafusion/functions/src/math/nanvl.rs:63-72 | datafusion/functions/src/math/round.rs:180-189 | datafusion/functions/src/math/trunc.rs:75-89 — 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 60 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/functions/src/math/trunc.rs:75` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6–10 lines × 2) · ×1
  • Duplicated block (6–10 lines × 2) datafusion/datasource/src/memory.rs:731 — datafusion/datasource/src/memory.rs:731-736 | datafusion/physical-plan/src/joins/hash_join/exec.rs:2324-2333 — 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 (8–10 lines × 2) · ×1
  • Duplicated block (8–10 lines × 2) datafusion/expr/src/logical_plan/display.rs:398 — datafusion/expr/src/logical_plan/display.rs:398-405 | datafusion/expr/src/logical_plan/plan.rs:2234-2243 — 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 52 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/expr/src/logical_plan/display.rs:398` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `datafusion/expr/src/logical_plan/display.rs:407` calls `push` and `datafusion/expr/src/logical_plan/plan.rs:2245` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (9 lines × 5) · ×1
  • Duplicated block (9 lines × 5) datafusion/ffi/src/catalog_provider.rs:225 — datafusion/ffi/src/catalog_provider.rs:225-233 | datafusion/ffi/src/catalog_provider_list.rs:189-197 | datafusion/ffi/src/schema_provider.rs:235-243 | datafusion/ffi/src/table_provider_factory.rs:93-101 | datafusion/ffi/src/udtf.rs:193-202 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/ffi/src/catalog_provider.rs:225` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (7–8 lines × 7) · ×1
  • Duplicated block (7–8 lines × 7) datafusion/physical-plan/src/async_func.rs:166 — datafusion/physical-plan/src/async_func.rs:166-172 | datafusion/physical-plan/src/coalesce_batches.rs:174-181 | datafusion/physical-plan/src/limit.rs:192-198 | datafusion/physical-plan/src/limit.rs:482-488 | datafusion/physical-plan/src/sorts/sort_preserving_merge.rs:279-286 | datafusion/physical-plan/src/unnest.rs:232-238 | datafusion/physical-plan/src/windows/window_agg_exec.rs:257-263 — there are 7 copies across 6 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 7 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/async_func.rs:166` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (8 lines × 5) · ×1
  • Duplicated block (8 lines × 5) datafusion/physical-plan/src/aggregates/mod.rs:2170 — datafusion/physical-plan/src/aggregates/mod.rs:2170-2177 | datafusion/physical-plan/src/buffer.rs:165-172 | datafusion/physical-plan/src/coalesce_partitions.rs:155-162 | datafusion/physical-plan/src/filter.rs:698-705 | datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs:466-473 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/aggregates/mod.rs:2170` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6–8 lines × 2) · ×1
  • Duplicated block (6–8 lines × 2) datafusion/common/src/scalar/mod.rs:3620 — datafusion/common/src/scalar/mod.rs:3620-3627 | datafusion/common/src/scalar/mod.rs:3727-3732 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/common/src/scalar/mod.rs:3620` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (7–8 lines × 2) · ×1
  • Duplicated block (7–8 lines × 2) datafusion/physical-plan/src/joins/hash_join/exec.rs:2321 — datafusion/physical-plan/src/joins/hash_join/exec.rs:2321-2328 | datafusion/physical-plan/src/joins/nested_loop_join.rs:1025-1031 — 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 6 separate duplicated blocks between them, totalling at least 82 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/joins/hash_join/exec.rs:2321` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (7 lines × 12) · ×1
  • Duplicated block (7 lines × 12) datafusion/physical-plan/src/aggregates/mod.rs:2170 — datafusion/physical-plan/src/aggregates/mod.rs:2170-2176 | datafusion/physical-plan/src/async_func.rs:166-172 | datafusion/physical-plan/src/buffer.rs:165-171 | datafusion/physical-plan/src/coalesce_batches.rs:174-180 | datafusion/physical-plan/src/coalesce_partitions.rs:155-161 | datafusion/physical-plan/src/filter.rs:698-704 | datafusion/physical-plan/src/limit.rs:192-198 | datafusion/physical-plan/src/limit.rs:482-488 | datafusion/physical-plan/src/sorts/sort_preserving_merge.rs:279-285 | datafusion/physical-plan/src/unnest.rs:232-238 | datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs:466-472 | datafusion/physical-plan/src/windows/window_agg_exec.rs:257-263 — 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 7 separate duplicated blocks between them, totalling at least 68 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/aggregates/mod.rs:2170` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (7 lines × 6) · ×1
  • Duplicated block (7 lines × 6) datafusion/functions-nested/src/utils.rs:227 — datafusion/functions-nested/src/utils.rs:227-233 | datafusion/functions/src/regex/regexpcount.rs:92-98 | datafusion/functions/src/regex/regexpinstr.rs:110-116 | datafusion/functions/src/regex/regexpmatch.rs:110-116 | datafusion/functions/src/regex/regexpreplace.rs:198-204 | datafusion/functions/src/utils.rs:111-117 — before extracting anything, compare `datafusion/functions-nested/src/utils.rs` and `datafusion/functions/src/utils.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. 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/functions-nested/src/utils.rs:227` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (4–7 lines × 5) · ×1
  • Duplicated block (4–7 lines × 5) datafusion/functions/src/datetime/date_trunc.rs:954 — datafusion/functions/src/datetime/date_trunc.rs:954-957 | datafusion/functions/src/datetime/date_trunc.rs:958-964 | datafusion/functions/src/datetime/date_trunc.rs:966-972 | datafusion/functions/src/datetime/date_trunc.rs:974-980 | datafusion/functions/src/datetime/date_trunc.rs:981-984 — 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 × 7) · ×1
  • Duplicated block (6 lines × 7) datafusion/functions-nested/src/utils.rs:226 — datafusion/functions-nested/src/utils.rs:226-231 | datafusion/functions/src/regex/regexpcount.rs:91-96 | datafusion/functions/src/regex/regexpinstr.rs:109-114 | datafusion/functions/src/regex/regexpmatch.rs:109-114 | datafusion/functions/src/regex/regexpreplace.rs:197-202 | datafusion/functions/src/regex/regexpreplace.rs:691-696 | datafusion/functions/src/utils.rs:110-115 — before extracting anything, compare `datafusion/functions-nested/src/utils.rs` and `datafusion/functions/src/utils.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. 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `args` to `&[&ArrayRef]` in one and `ScalarFunctionArgs` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (6 lines × 6) · ×1
  • Duplicated block (6 lines × 6) datafusion/functions/src/math/abs.rs:164 — datafusion/functions/src/math/abs.rs:164-169 | datafusion/functions/src/math/monotonicity.rs:332-338 | datafusion/functions/src/math/monotonicity.rs:435-441 | datafusion/functions/src/math/monotonicity.rs:473-479 | datafusion/functions/src/math/monotonicity.rs:511-517 | datafusion/functions/src/math/monotonicity.rs:638-644 — 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 (6 lines × 4) · ×1
  • Duplicated block (6 lines × 4) datafusion/functions-aggregate/src/covariance.rs:282 — datafusion/functions-aggregate/src/covariance.rs:282-287 | datafusion/functions-aggregate/src/covariance.rs:307-312 | datafusion/functions-aggregate/src/regr.rs:610-616 | datafusion/functions-aggregate/src/regr.rs:640-646 — 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 (3–5 lines × 3) · ×1
  • Duplicated block (3–5 lines × 3) datafusion/datasource/src/memory.rs:296 — datafusion/datasource/src/memory.rs:296-298 | datafusion/physical-plan/src/joins/hash_join/exec.rs:2210-2221 | datafusion/physical-plan/src/joins/nested_loop_join.rs:974-978 — 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 6 separate duplicated blocks between them, totalling at least 82 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/physical-plan/src/joins/hash_join/exec.rs:2210` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `datafusion/physical-plan/src/joins/hash_join/exec.rs:2208` calls `into` and `datafusion/physical-plan/src/joins/nested_loop_join.rs:973` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (9 lines × 4) · ×1
  • Duplicated block (9 lines × 4) datafusion/ffi/src/catalog_provider.rs:172 — datafusion/ffi/src/catalog_provider.rs:172-180 | datafusion/ffi/src/catalog_provider_list.rs:137-145 | datafusion/ffi/src/schema_provider.rs:180-188 | datafusion/ffi/src/table_provider.rs:485-493 — 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 (11 lines × 5) · ×1
  • Duplicated block (11 lines × 5) datafusion/functions/src/string/ascii.rs:54 — datafusion/functions/src/string/ascii.rs:54-64 | datafusion/functions/src/string/bit_length.rs:46-56 | datafusion/functions/src/string/lower.rs:44-54 | datafusion/functions/src/string/upper.rs:43-53 | datafusion/functions/src/unicode/initcap.rs:52-62 — 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 (5 lines × 4) · ×1
  • Duplicated block (5 lines × 4) datafusion/sqllogictest/src/test_context/range_partitioning.rs:73 — datafusion/sqllogictest/src/test_context/range_partitioning.rs:73-77 | datafusion/sqllogictest/src/test_context/range_partitioning.rs:111-117 | datafusion/sqllogictest/src/test_context/range_partitioning.rs:134-143 | datafusion/sqllogictest/src/test_context/range_partitioning.rs:159-165 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `datafusion/sqllogictest/src/test_context/range_partitioning.rs:73` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `datafusion/sqllogictest/src/test_context/range_partitioning.rs:79` calls `Int32`, `Some` and `datafusion/sqllogictest/src/test_context/range_partitioning.rs:145` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D5 · Coupling · Unstable project datafusion · ×1
  • Unstable project datafusion — datafusion has instability 0.87 with 4 dependents.
D5 · Coupling · Unstable project datafusion-catalog-listing · ×1
  • Unstable project datafusion-catalog-listing — datafusion-catalog-listing has instability 0.83 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.83 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-functions-nested · ×1
  • Unstable project datafusion-functions-nested — datafusion-functions-nested has instability 0.83 with 2 dependents.
D5 · Coupling · Unstable project datafusion-physical-optimizer · ×1
  • Unstable project datafusion-physical-optimizer — datafusion-physical-optimizer has instability 0.83 with 2 dependents.
D5 · Coupling · Unstable project datafusion-proto · ×1
  • Unstable project datafusion-proto — datafusion-proto has instability 0.94 with 1 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.
R1 · Type Safety · Type Safety · ×1
  • Type Safety — 0 typed · 6 plain JS — the untyped files are ci/scripts/cancel_merge_queue_runs.cjs, ci/scripts/draft_inactive_prs.cjs, ci/scripts/release_version_labeler.js, ci/scripts/test_cancel_merge_queue_runs.cjs, REDACTED, datafusion/wasmtest/datafusion-wasm-app/index.js.
R10 · Code Duplication · Duplicated block with local edits (27 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (27 matched lines × 2 locations) REDACTED:152 — REDACTED:152 · REDACTED:263 — the two spans are one implementation copied and then locally edited — 192 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block (8 lines × 2 locations) · ×1
  • Duplicated block (8 lines × 2 locations) ci/scripts/test_cancel_merge_queue_runs.cjs:285 — ci/scripts/test_cancel_merge_queue_runs.cjs:285 · ci/scripts/test_cancel_merge_queue_runs.cjs:300 — 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.
R10 · Code Duplication · Duplicated block (6 lines × 2 locations) · ×1
  • Duplicated block (6 lines × 2 locations) ci/scripts/test_cancel_merge_queue_runs.cjs:306 — ci/scripts/test_cancel_merge_queue_runs.cjs:306 · ci/scripts/test_cancel_merge_queue_runs.cjs:430 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (5 lines × 2 locations) · ×1
  • Duplicated block (5 lines × 2 locations) ci/scripts/test_cancel_merge_queue_runs.cjs:160 — ci/scripts/test_cancel_merge_queue_runs.cjs:160 · ci/scripts/test_cancel_merge_queue_runs.cjs:184 — 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.
R2 · Cyclomatic Complexity · Complex function run (cyclomatic 25, cognitive 44) · ×1
  • Complex function run (cyclomatic 25, cognitive 44) ci/scripts/cancel_merge_queue_runs.cjs:86 — run has cyclomatic complexity 25 and cognitive complexity 44; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function run (cyclomatic 11, cognitive 18) · ×1
  • Complex function run (cyclomatic 11, cognitive 18) ci/scripts/draft_inactive_prs.cjs:102 — run has cyclomatic complexity 11 and cognitive complexity 18; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R7 · Dead Code · Dead file (~169 LoC) · ×1
  • Dead file (~169 LoC) ci/scripts/draft_inactive_prs.cjs — no import path from any entry point (4 application, 3 tooling, 2 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Minor — 73 finding(s)
D34 · Knowledge Freshness · Orphaned file · ×36
  • Orphaned file dev/create_license.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file datafusion/execution/src/object_store.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file datafusion-cli/src/command.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file datafusion/physical-expr/src/equivalence/properties/joins.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file benchmarks/src/imdb/mod.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file datafusion/catalog/src/listing_schema.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file datafusion/common/src/spans.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file datafusion/physical-plan/src/render_tree.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file datafusion/substrait/src/variation_const.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file datafusion/common-runtime/src/common.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file datafusion/physical-plan/src/aggregates/group_values/single_group_by/boolean.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file datafusion/common/src/diagnostic.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file benchmarks/lineprotocol.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file datafusion/physical-plan/src/sort_pushdown.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file datafusion/functions-nested/src/macros_lambda.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file datafusion/ffi/src/statistics.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file datafusion/core/src/execution/context/csv.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file datafusion/physical-expr-common/src/metrics/custom.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file test-utils/src/array_gen/primitive.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file datafusion/physical-plan/src/tree_node.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file datafusion/physical-expr-common/src/metrics/elapsed_compute.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file datafusion/optimizer/src/plan_signature.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file datafusion/common/src/file_options/csv_writer.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file test-utils/src/array_gen/string.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file benchmarks/src/imdb/convert.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • + 11 more in this group — see findings.md.
X10 · Duplicated predicate · Duplicated predicate · ×10
  • Duplicated predicate datafusion/functions/src/core/greatest.rs:89 — `!lhs.data_type().is_nested() && lhs.logical_null_count() == 0 && rhs.logical_null_count() == 0` appears character-identically in 2 files — datafusion/functions/src/core/greatest.rs, datafusion/functions/src/core/least.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate datafusion/physical-expr/src/higher_order_function.rs:389 — `array.len() == 1 && !input_empty && input_all_scalar` appears character-identically in 2 files — datafusion/physical-expr/src/higher_order_function.rs, datafusion/physical-expr/src/scalar_function.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate datafusion/functions-nested/src/range.rs:62 — `has_positive_component && has_negative_component` appears character-identically in 2 files — datafusion/functions-nested/src/range.rs, datafusion/functions-table/src/generate_series.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate datafusion/physical-plan/src/joins/hash_join/exec.rs:1330 — `left.boundedness().is_unbounded() || join_type == JoinType::LeftSemi` appears character-identically in 2 files — datafusion/physical-plan/src/joins/hash_join/exec.rs, datafusion/physical-plan/src/joins/nested_loop_join.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate datafusion/functions-nested/src/cosine_distance.rs:159 — `list_array1.is_null(row) || list_array2.is_null(row)` appears character-identically in 2 files — datafusion/functions-nested/src/cosine_distance.rs, datafusion/functions-nested/src/inner_product.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate datafusion/physical-optimizer/src/ensure_requirements/enforce_sorting/sort_pushdown.rs:508 — `plan.is::<GlobalLimitExec>() || plan.is::<LocalLimitExec>()` appears character-identically in 2 files — datafusion/physical-optimizer/src/ensure_requirements/enforce_sorting/sort_pushdown.rs, datafusion/physical-optimizer/src/utils.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate datafusion/physical-expr-common/src/physical_expr.rs:122 — `selection.null_count() == 0 && !selection.has_false()` appears character-identically in 2 files — datafusion/physical-expr-common/src/physical_expr.rs, datafusion/physical-plan/src/aggregates/aggregate_argument.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate datafusion/physical-expr-common/src/binary_map.rs:655 — `self.map.is_empty() && self.null.is_none()` appears character-identically in 2 files — datafusion/physical-expr-common/src/binary_map.rs, datafusion/physical-expr-common/src/binary_view_map.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate datafusion/functions-nested/src/cosine_distance.rs:179 — `slice1.null_count() != 0 || slice2.null_count() != 0` appears character-identically in 2 files — datafusion/functions-nested/src/cosine_distance.rs, datafusion/functions-nested/src/inner_product.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate datafusion/expr/src/expr_schema.rs:87 — `target_field.name().is_empty() && target_field.is_nullable() && target_field.metadata().is_empty()` appears character-identically in 3 files — datafusion/expr/src/expr_schema.rs, datafusion/physical-expr/src/expressions/cast.rs, datafusion/physical-expr/src/expressions/try_cast.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
P10 · Library API & versioning · Implementation type on the public API · ×6
  • Implementation type on the public API datafusion/expr/src/async_udf.rs:24 — 1 public type in `datafusion_expr.async_udf` is marked as implementation by its own namespace, folder or name: `AsyncScalarUDFImpl` (datafusion/expr/src/async_udf.rs:24, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
  • Implementation type on the public API datafusion/expr/src/higher_order_function.rs:510 — 1 public type in `datafusion_expr.higher_order_function` is marked as implementation by its own namespace, folder or name: `HigherOrderUDFImpl` (datafusion/expr/src/higher_order_function.rs:510, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
  • Implementation type on the public API datafusion/expr/src/udaf.rs:451 — 1 public type in `datafusion_expr.udaf` is marked as implementation by its own namespace, folder or name: `AggregateUDFImpl` (datafusion/expr/src/udaf.rs:451, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
  • Implementation type on the public API datafusion/expr/src/udf.rs:522 — 1 public type in `datafusion_expr.udf` is marked as implementation by its own namespace, folder or name: `ScalarUDFImpl` (datafusion/expr/src/udf.rs:522, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
  • Implementation type on the public API datafusion/expr/src/udwf.rs:302 — 1 public type in `datafusion_expr.udwf` is marked as implementation by its own namespace, folder or name: `WindowUDFImpl` (datafusion/expr/src/udwf.rs:302, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
  • Implementation type on the public API datafusion/session/src/table.rs:758 — 1 public type in `datafusion_session.table` is marked as implementation by its own namespace, folder or name: `TableFunctionImpl` (datafusion/session/src/table.rs:758, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
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: benchmarks/src/util/simulated_object_store.rs, datafusion/physical-plan/src/proto_test_util.rs, datafusion/physical-plan/src/proto/registry.rs, datafusion/proto-models/src/registry.rs, datafusion/datasource/src/proto.rs, datafusion/datasource-parquet/src/opener/early_stop.rs. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 5 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/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 #3 — If anonymized user #3 becomes unavailable, 4 significant file(s) lose their only recent owner: datafusion/physical-plan/src/joins/logical_batch.rs, benchmarks/compile_profile.py, xtask/src/main.rs, datafusion/common/src/display/graphviz.rs. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #4 — If anonymized user #4 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/byte_view_filter.rs, datafusion/physical-expr/src/expressions/in_list/dictionary_filter.rs, datafusion/physical-expr/src/expressions/in_list/result.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
D16 · Bus Factor · Further sole-owners (lower concentration) · ×1
  • Further sole-owners (lower concentration) — 12 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 (37 single-owned of 995 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 995 of the 1160 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)) (+6 more) — spread or document their files in the same way, at lower priority than the named off-boarding risks above. The files folded here: datafusion/sqllogictest/src/config_matrix.rs, dev/release/download-python-wheels.py, datafusion/pruning/src/primitive_in_list.rs, datafusion/pruning/src/in_list.rs, datafusion/execution/src/memory_pool/drift.rs, datafusion/sqllogictest/src/memory_drift.rs, datafusion/physical-plan/src/sorts/merge_trace.rs, test-utils/src/array_gen/decimal.rs (+10 more).
D20 · ADR Quality · No ADRs found · ×1
  • No ADRs found datafusion-cli/src/main.rs:1 — 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/`. ADRs are expected here because `datafusion-cli/src/main.rs` makes this repository a deployable product (line 1).
D26 · Project Cohesion · Projects may be oversized for their cohesion · ×1
  • Projects may be oversized for their cohesion — 6 of 47 project(s) overshoot their size bounds, lowering Project Cohesion to 7.4/10. The most over is `datafusion/physical-plan` (173402 LoC, 301 module-visible types across 21 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.
D34 · Knowledge Freshness · Further orphaned files (smaller) · ×1
  • Further orphaned files (smaller) — 36 smaller file(s) also have no living knowledge — folded into the freshness score and metrics rather than raised one row each — most significant first: dev/create_license.py, datafusion/execution/src/object_store.rs, datafusion-cli/src/command.rs, datafusion/physical-expr/src/equivalence/properties/joins.rs, benchmarks/src/imdb/mod.rs, datafusion/catalog/src/listing_schema.rs, datafusion/physical-plan/src/aggregates/group_values/single_group_by/boolean.rs, datafusion/common/src/spans.rs (and 28 more) (39 orphaned of 995 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 995 of the 1160 production source files in this repository met that bar). 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/26 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`, `xtask`.
P3 · Security & performance tooling · Dependabot does not watch gitsubmodule · ×1
  • Dependabot does not watch gitsubmodule REDACTED:6 — `REDACTED` schedules updates, but no `package-ecosystem` entry covers `gitsubmodule`, which this tree depends on — so those dependencies get no update pull requests and no advisory pressure, however complete the dep-scan credit looks. Add the missing entry to the `updates:` list.
P4 · Deployment & Rollback · No release approval gate · ×1
  • No release approval gate — The release is automated and no gate that pauses it for a human is DECLARED IN THIS REPOSITORY'S PIPELINE FILES. What was read: every file under `.github/workflows/`, `.forgejo/workflows/`, `.gitea/workflows/`, `.azuredevops/` and `.azure-pipelines/`, plus `.gitlab-ci*` and `azure-pipelines*` — with comment text stripped, so documenting a gate is not declaring one. What would have counted: GitLab's `when: manual`, CircleCI's `type: approval`, an Azure `ManualValidation@` task or an `approvals:` block, a Jenkins `input` step, a `uses:` step naming an approval action, an `environment:` paired with `reviewers` / `required_reviewers` / `protection` / `wait-timer` / `deployment_branch_policy`, a draft-release step, a `workflow_dispatch` promotion, or a release-event gate. ★ What this cannot see, because none of it is a file: a GitHub environment whose required reviewers are configured in repo SETTINGS, a branch protection rule, or an organisation deployment policy — all of them real, enforced gates that live outside the repository. If yours is one of those, this row is wrong and nothing in the tree could have told us. Otherwise: whatever the release trigger points at is published to users unreviewed, so a mistagged or unverified commit ships and the only remedy is a follow-up release.
X7 · Silent fallback defaults · Silent fallback default on Err · ×1
  • Silent fallback default on Err datafusion/sql/src/unparser/expr.rs:1110 — `sql_op_precedence` turns every `Err` into `0` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Minor — 10 finding(s)
D12 · Dependency Hygiene · Outdated · ×8
  • Outdated: aws-config — `aws-config` is locked at 1.13.0 but 1.13.2 is the current stable release on crates.io, and it already satisfies the `"1.8.18"` requirement declared in datafusion-cli/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p aws-config` and commit the updated REDACTED.
  • Outdated: itoa — `itoa` is locked at 1.0.18 but 1.0.19 is the current stable release on crates.io, and it already satisfies the `"1.0"` requirement declared in datafusion/functions-nested/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p itoa` and commit the updated REDACTED.
  • Outdated: libloading — `libloading` is locked at 0.9.0 but 0.9.1 is the current stable release on crates.io, and it already satisfies the `"0.9"` requirement declared in datafusion/ffi/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p libloading` and commit the updated REDACTED.
  • Outdated: prost — `prost` is locked at 0.14.4 but 0.14.6 is the current stable release on crates.io, and it already satisfies the `"0.14.1"` requirement declared in datafusion/ffi/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p prost` and commit the updated REDACTED.
  • Outdated: syn — `syn` is locked at 3.0.9 but 3.0.10 is the current stable release on crates.io, and it already satisfies the `"3.0.2"` requirement declared in datafusion/macros/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p syn` and commit the updated REDACTED.
  • Outdated: toml — `toml` is locked at 1.1.6+spec-1.1.0 but 1.2.1+spec-1.1.0 is the current stable release on crates.io, and it already satisfies the `"1.1.3"` requirement declared in benchmarks/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p toml` and commit the updated REDACTED.
  • Outdated: wasm-bindgen — `wasm-bindgen` is locked at 0.2.118 but 0.2.130 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.
  • Outdated: zstd — `zstd` is locked at 0.14.3 but 0.14.4 is the current stable release on crates.io, and it already satisfies the `"0.14"` requirement declared in datafusion/core/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p zstd` and commit the updated REDACTED.
D5 · Coupling · Off the main sequence · ×2
  • 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.12, distance 0.73 — 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.

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/canine-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-450cf7f4c65047e3a6b7ea8aec947ddd/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/canine-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-450cf7f4c65047e3a6b7ea8aec947ddd/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/canine-sast.yml --json --quiet --timeout 10 --timeout-threshold 3 --metrics off --exclude *.arrow --exclude *.avro --exclude *.csv --exclude *.dat --exclude *.db --exclude *.feather --exclude *.geojson --exclude *.h5 --exclude *.hdf5 --exclude *.jsonl --exclude *.log --exclude *.ndjson --exclude *.npy --exclude *.npz --exclude *.orc --exclude *.parquet --exclude *.pickle --exclude *.pkl --exclude *.psv --exclude *.sqlite --exclude *.sqlite3 --exclude *.tfrecord --exclude *.tsv --exclude *.txt .52artifacts/raw/semgrep.json
D30 · Dependency Vulnerabilitiestrivy—trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** .5artifacts/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—
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/** .0artifacts/raw/trivy-fs.json

Run 01a1daf1-4b51-7612-80b3-3605953d2166 · 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