Public report of apache/gluten, published 26 October 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.10.5). Watchdog 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, 26 October 2026, 11:02 UTC · Survey ID cd_f757ee6653d548ea9b7a28a855e3864f

apache/gluten

Measured 26 October 2026, 10:47 UTC, at code version 258bf8e

No regression since the last survey

A regression is a drop of 0.5 points or more in the score, or of 2.5 or more out of 10 in a dimension, since the last survey.

CAI score 54out of 100 At risk Up 1 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 large codebase: 177,345 lines of product code in 40 projects, tests not counted · Estimated rebuild effort: about 3.7 person-years · Weakest lens: Security and Compliance, 46

Findings by how serious they are

455 critical 1716 serious 237 minor

17 dimensions are left out of the score. For each one, Watchdog either couldn't measure it in this code, or found no evidence of the safeguard it looks 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

Watchdog
Producer
Canine Development
Analyzer
Watchdog engine 1.0.0
Measured
26 October 2026, 10:47 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 Watchdog. It is open to any tool that implements it, and today Watchdog is the only one that does.

A critical security finding is open, such as a library with a known critical vulnerability or a password or key found in the code. The score itself is unchanged, but its band shows At risk until the finding is fixed. See the Security and Compliance lens.

The score is deterministic, which means the same code always gets the same score. Watchdog works 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 ▸

62of 62 dimensions measured by tools.
2385of 2408 findings point to an exact file and line, so you can open each one in the code. The other 23 concern the repository as a whole, such as missing documentation.
62dimensions across 7 lenses, read from 177,345 lines of product code in 40 projects.
Chapters

Executive summary

apache/gluten is rated At risk because critical security findings are open, most of them in the build pipeline. Its score is held back because 25 of the dependencies have a known vulnerability and it has pipeline tools referenced by a changeable name. It scores 54 out of 100, which the At risk rating leaves unchanged.

Security and Compliance, at 46, is the weakest lens and counts most in the score. The best first step is fixing the 79 unsafe settings in infrastructure or container files, worth about 4 points. Updating the 25 dependencies with a known vulnerability would lift Security and Compliance itself, worth about 3 points. Raising Security and Compliance to 70 would lift the score to about 60.

332 pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with. Thirty-three known security holes in the packages the code depends on can be used by attackers, and thirty pipeline steps run downloads nobody checks. Pinning each tool to an exact version, updating the vulnerable packages and checking each download against a checksum would close these risks. The 21 unsafe settings in infrastructure or container files need changing to safe values. The six pipeline steps that install packages without pinning their versions need the packages they install pinned to exact versions. The 11 sets of files in separate parts that keep changing together need that dependency made explicit.

The product code is 177,345 lines, about €540,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.
Security and Compliance 46 · counts for 46%Code Health 55 · counts for 25%Performance 62 · counts for 14%Architecture 63 · counts for 8%Production Readiness 63 · counts for 4%Maturity 73 · counts for 2%Domain Modelling 100 · counts for 1%

If Security and Compliance rose from 46 to 70, the lowest score rated Strong, the score would rise from 54 to about 60.

Code composition: what the lines of code are
Product code 37%Tests 63%
New since the last survey: 102 findings

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

Watchdog compares 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: 134 findings

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

  • Cyclomatic Complexity · ArrowWritableColumnVector.createVectorAccessor (cyclomatic 23) gluten-arrow/src/main/java/org/apache/gluten/vectorized/ArrowWritableColumnVector.java
  • Cyclomatic Complexity · GlutenOptimisticTransaction.writeFiles (cyclomatic 21) backends-velox/src-delta40/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala
  • Cyclomatic Complexity · ArrowColumnVectorUtils.populatePrimitive (cyclomatic 21) gluten-arrow/src/main/java/org/apache/spark/sql/execution/vectorized/ArrowColumnVectorUtils.java
  • Cyclomatic Complexity · ArrowWritableColumnVector.createVectorWriter (cyclomatic 19) gluten-arrow/src/main/java/org/apache/gluten/vectorized/ArrowWritableColumnVector.java
  • Cyclomatic Complexity · GlutenDeltaParquetFileFormat.iteratorWithAdditionalMetadataColumns (cyclomatic 16) backends-velox/src-delta40/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala
  • Cognitive Complexity · GlutenOptimisticTransaction.writeFiles (cognitive 29) backends-velox/src-delta40/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala
  • Cognitive Complexity · ArrowWritableColumnVector.createVectorAccessor (cognitive 27) gluten-arrow/src/main/java/org/apache/gluten/vectorized/ArrowWritableColumnVector.java
  • Cognitive Complexity · ArrowColumnVectorUtils.populatePrimitive (cognitive 26) gluten-arrow/src/main/java/org/apache/spark/sql/execution/vectorized/ArrowColumnVectorUtils.java
  • Cognitive Complexity · GlutenDeltaParquetFileFormat.iteratorWithAdditionalMetadataColumns (cognitive 24) backends-velox/src-delta40/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala
  • Cognitive Complexity · ArrowWritableColumnVector.createVectorWriter (cognitive 20) gluten-arrow/src/main/java/org/apache/gluten/vectorized/ArrowWritableColumnVector.java
  • Cognitive Complexity · GlutenDeltaFileFormatWriter.executeWrite (cognitive 16) backends-velox/src-delta40/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala
  • God Classes · ClassTooLong: ArrowWritableColumnVector gluten-arrow/src/main/java/org/apache/gluten/vectorized/ArrowWritableColumnVector.java
  • God Classes · ClassTooLong: VeloxSparkPlanExecApi backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala
  • God Classes · FileTooLong: vectorized/ArrowWritableColumnVector.java gluten-arrow/src/main/java/org/apache/gluten/vectorized/ArrowWritableColumnVector.java
  • God Classes · TooManyMethods: ArrowWritableColumnVector gluten-arrow/src/main/java/org/apache/gluten/vectorized/ArrowWritableColumnVector.java
  • God Classes · TooManyMethods: WritableColumnVectorShim shims/spark42/src/main/java/org/apache/spark/sql/execution/vectorized/WritableColumnVectorShim.java
  • God Classes · TooManyMethods: WritableColumnVectorShim shims/spark40/src/main/java/org/apache/spark/sql/execution/vectorized/WritableColumnVectorShim.java
  • God Classes · TooManyMethods: WritableColumnVectorShim shims/spark41/src/main/java/org/apache/spark/sql/execution/vectorized/WritableColumnVectorShim.java
  • God Classes · TooManyMethods: WritableColumnVectorShim shims/spark34/src/main/java/org/apache/spark/sql/execution/vectorized/WritableColumnVectorShim.java
  • God Classes · TooManyMethods: WritableColumnVectorShim shims/spark35/src/main/java/org/apache/spark/sql/execution/vectorized/WritableColumnVectorShim.java
  • God Classes · TooManyMethods: ArrowVectorWriter gluten-arrow/src/main/java/org/apache/gluten/vectorized/ArrowWritableColumnVector.java
  • Code Duplication · Members sharing a duplicated core (8 members, 50+ identical tokens) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/ClickhouseOptimisticTransaction.scala
  • Code Duplication · Duplicated block (70 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialGenerateExec.scala
  • Code Duplication · Duplicated block (63 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala
  • Code Duplication · Duplicated block (59–60 lines × 2) backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala
  • Code Duplication · Duplicated block (53 lines × 2) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala
  • Code Duplication · Duplicated block (51 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialGenerateExec.scala
  • Code Duplication · Duplicated block (49 lines × 2) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala
  • Code Duplication · Duplicated block (48 lines × 2) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala
  • Code Duplication · Duplicated block (41 lines × 2) backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala
  • Code Duplication · Duplicated block (39 lines × 4) backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala
  • Code Duplication · Duplicated block (39 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala
  • Code Duplication · Duplicated block (32 lines × 2) backends-velox/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala
  • Code Duplication · Duplicated block (31 lines × 2) backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala
  • Code Duplication · Duplicated block (30 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala
  • Code Duplication · Duplicated block (25 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala
  • Code Duplication · Duplicated block (20 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala
  • Code Duplication · Duplicated block (16 lines × 2) gluten-delta/src-delta33/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala
  • Code Duplication · Duplicated block (9 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialGenerateExec.scala
  • Code Duplication · Duplicated block (73 lines × 2) backends-velox/src-delta33/main/scala/org/apache/spark/sql/execution/datasources/v2/DeltaWriteOperators.scala
  • Code Duplication · Duplicated block (5 lines × 2) backends-clickhouse/src/main/scala/org/apache/spark/rpc/GlutenDriverEndpoint.scala
  • Code Duplication · Duplicated block (22 lines × 2) gluten-arrow/src/main/java/org/apache/gluten/vectorized/ArrowColumnVector.java
  • Code Duplication · Duplicated block (7–9 lines × 2) gluten-arrow/src/main/java/org/apache/gluten/vectorized/ArrowWritableColumnVector.java
  • Code Duplication · Duplicated block (8 lines × 2) gluten-arrow/src/main/java/org/apache/gluten/vectorized/ArrowWritableColumnVector.java
  • Code Duplication · Duplicated block (36 lines × 2) backends-bolt/src/main/java/org/apache/gluten/metrics/Metrics.java
  • Code Duplication · Duplicated block (188 lines × 5) shims/spark34/src/main/java/org/apache/spark/sql/execution/vectorized/WritableColumnVectorShim.java
  • Code Duplication · Duplicated block (190 lines × 3) shims/spark40/src/main/java/org/apache/spark/sql/execution/vectorized/WritableColumnVectorShim.java
  • Code Duplication · Duplicated block (11 lines × 3) gluten-arrow/src/main/java/org/apache/gluten/vectorized/ArrowColumnVector.java
  • Code Duplication · Duplicated block (8 lines × 2) gluten-arrow/src/main/java/org/apache/gluten/vectorized/ArrowColumnVector.java
  • Code Duplication · Duplicated block (7 lines × 2) gluten-arrow/src/main/java/org/apache/gluten/vectorized/ArrowColumnVector.java
  • Code Duplication · Duplicated block (6 lines × 2) gluten-arrow/src/main/java/org/apache/gluten/vectorized/ArrowColumnVector.java
  • Code Duplication · Duplicated block (10 lines × 2) dev/check.py
  • Explicit Debt · FixmeComment backends-velox/src-delta40/test/scala/org/apache/spark/sql/delta/DeleteSQLSuite.scala
  • Explicit Debt · FixmeComment backends-velox/src-delta40/test/scala/org/apache/spark/sql/delta/DeleteSQLSuite.scala
  • Explicit Debt · TodoComment backends-velox/src-iceberg-spark34/test/java/org/apache/gluten/execution/TestStoragePartitionedJoins.java
  • Explicit Debt · TodoComment backends-velox/src-iceberg-spark34/test/java/org/apache/gluten/source/TestPartitionPruning.java
  • Explicit Debt · TodoComment backends-velox/src-iceberg-spark34/test/java/org/apache/gluten/source/TestFilteredScan.java
  • Explicit Debt · TodoComment backends-velox/src-iceberg-spark34/test/java/org/apache/gluten/source/TestFilteredScan.java
  • Explicit Debt · TodoComment backends-velox/src-iceberg-spark34/test/java/org/apache/gluten/source/TestFilteredScan.java
  • Explicit Debt · HackComment backends-velox/src-delta40/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala
  • Explicit Debt · TodoComment backends-velox/src-delta40/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala
  • Explicit Debt · TodoComment backends-velox/src-delta40/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala
  • Explicit Debt · TodoComment backends-velox/src-delta40/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala
  • Explicit Debt · FixmeComment backends-velox/src-delta40/test/scala/org/apache/spark/sql/delta/DeleteSQLSuite.scala
  • Explicit Debt · FixmeComment backends-velox/src-delta40/test/scala/org/apache/spark/sql/delta/perf/OptimizeMetadataOnlyDeltaQuerySuite.scala
  • Explicit Debt · FixmeComment backends-velox/src/test/scala/org/apache/gluten/functions/ScalarFunctionsValidateSuite.scala
  • Explicit Debt · TodoComment gluten-arrow/src/main/java/org/apache/gluten/vectorized/ArrowWritableColumnVector.java
  • Explicit Debt · TodoComment gluten-arrow/src/main/java/org/apache/gluten/vectorized/ArrowWritableColumnVector.java
  • Explicit Debt · TodoComment gluten-iceberg/src/main/scala/org/apache/gluten/execution/IcebergScanTransformer.scala
  • Explicit Debt · TodoComment REDACTED
  • Explicit Debt · FixmeComment repeated across 11 files gluten-ut/spark34/src/test/scala/org/apache/gluten/utils/bolt/BoltTestSettings.scala
  • Explicit Debt · FixmeComment repeated across 11 files gluten-ut/spark34/src/test/scala/org/apache/gluten/utils/bolt/BoltTestSettings.scala
  • Explicit Debt · TodoComment repeated across 12 files gluten-ut/spark40/src/test/scala/org/apache/gluten/utils/velox/VeloxTestSettings.scala
  • Explicit Debt · TodoComment gluten-ut/spark41/src/test/scala/org/apache/gluten/utils/velox/VeloxTestSettings.scala
  • Explicit Debt · TodoComment gluten-ut/spark42/src/test/scala/org/apache/gluten/utils/velox/VeloxTestSettings.scala
  • Explicit Debt · TodoComment gluten-ut/spark41/src/test/scala/org/apache/gluten/utils/velox/VeloxSQLQueryTestSettings.scala
  • Static Analysis (SAST) · High: REDACTED REDACTED
  • Static Analysis (SAST) · High: REDACTED REDACTED
  • Static Analysis (SAST) · High: REDACTED REDACTED
  • Static Analysis (SAST) · High: REDACTED REDACTED
  • Static Analysis (SAST) · High: REDACTED REDACTED
  • Static Analysis (SAST) · High: REDACTED REDACTED
  • Static Analysis (SAST) · High: REDACTED REDACTED
  • Static Analysis (SAST) · High: REDACTED REDACTED
  • Static Analysis (SAST) · High: REDACTED ep/build-velox/src/setup-centos7.sh
  • Dependency Vulnerabilities · Medium CVE: [GHSA redacted] REDACTED
  • IaC & Container Security · High IaC: REDACTED dev/docker/Dockerfile
  • IaC & Container Security · High IaC: REDACTED dev/docker/Dockerfile.centos7-gcc13
  • IaC & Container Security · High IaC: REDACTED dev/docker/Dockerfile.centos7-gcc13
  • IaC & Container Security · High IaC: REDACTED dev/docker/Dockerfile.centos7-gcc13
  • IaC & Container Security · High IaC: REDACTED dev/docker/Dockerfile.centos7-gcc13
  • IaC & Container Security · High IaC: REDACTED dev/docker/Dockerfile.centos7-gcc13
  • IaC & Container Security · High IaC: REDACTED dev/docker/Dockerfile.centos7-gcc13
  • IaC & Container Security · High IaC: REDACTED dev/docker/Dockerfile.centos7-gcc13
  • IaC & Container Security · High IaC: REDACTED dev/docker/Dockerfile.centos7-gcc13
  • IaC & Container Security · High IaC: REDACTED dev/docker/Dockerfile.centos7-static-build
  • IaC & Container Security · Medium IaC: REDACTED dev/docker/Dockerfile
  • IaC & Container Security · Medium IaC: REDACTED dev/docker/Dockerfile
Rebuild cost: about €540,000 · Estimate
Cost to rebuild€180,000 to €900,000, for 2,976 to 9,441 hours of work, about 3.7 person-years for 2 to 7 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 54. 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.
SizeLarge: 177,345 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: Watchdog prices 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
Resolve the 79 Medium IaC finding(s) in IaC & Container Security — start with REDACTED (21), REDACTED (7), REDACTED (6).
Raises the score by about 4 points · Medium effort · IaC & Container Security
2
Resolve the 9 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED, REDACTED, REDACTED.
Raises the score by about 2 points · Low effort · Supply-chain Provenance & Signing
3
Resolve the 25 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (22), REDACTED (3).
Raises the score by about 3 points · Medium effort · Dependency Vulnerabilities

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 €540,000 to build again, about 3.7 person-years of work. Its weakest lens is Security and Compliance, at 46 (Weak). Security and Compliance is about how well the product is protected, and how it handles personal data. Because the weakest lens counts most in the score, work on Security and Compliance also moves the score most.
Based on: the rebuild estimate · the Security and Compliance grade · how much each lens counts
What to do: Start with the Security and Compliance actions in Top priorities.
If you do one thing first · First action
Resolve the 79 Medium IaC finding(s) in IaC & Container Security. Of all the actions in this report, it raises the score most for the work it takes: about 4 points for medium effort, because it clears the 79 IaC & Container Security findings. 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.2 out of 10. Code at that level is slower to change than clean code, and Watchdog estimates the extra work at 2% to 5% on every change. The history of the code shows how much it changes: about 797,651 lines over the last 90 days, which is about 3,234,918 lines a year. At that pace, the extra work comes to an estimated 161.7 to 1078.3 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 Watchdog's 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 backends-bolt backends-bolt gluten-arrow gluten-arrow backends-bolt->gluten-arrow gluten-core gluten-core backends-bolt->gluten-core gluten-substrait gluten-substrait backends-bolt->gluten-substrait backends-clickhouse backends-clickhouse backends-clickhouse->gluten-substrait backends-velox backends-velox backends-velox->gluten-arrow backends-velox->gluten-substrait gluten gluten gluten_core_impl gluten_core_impl gluten->gluten_core_impl gluten-arrow->gluten-substrait spark-sql-columnar-shims-common spark-sql-columnar-shims-common gluten-arrow->spark-sql-columnar-shims-common gluten-celeborn gluten-celeborn gluten-celeborn->gluten-substrait gluten-delta gluten-delta gluten-delta->gluten-substrait gluten-flink-loader gluten-flink-loader gluten-flink-planner gluten-flink-planner gluten-flink-loader->gluten-flink-planner gluten-flink-runtime gluten-flink-runtime gluten-flink-planner->gluten-flink-runtime gluten-flink-ut gluten-flink-ut gluten-flink-ut->gluten-flink-loader gluten-flink-ut->gluten-flink-planner gluten-flink-ut->gluten-flink-runtime gluten-hudi gluten-hudi gluten-hudi->gluten-substrait gluten-it-common gluten-it-common gluten-substrait->gluten-core gluten-ui gluten-ui gluten-substrait->gluten-ui gluten-substrait->spark-sql-columnar-shims-common gluten-ui->spark-sql-columnar-shims-common gluten_velox_impl gluten_velox_impl gluten_velox_impl->gluten_core_impl velox velox velox->gluten velox->gluten_velox_impl __more__ +20 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.

337 modules, with 556 dependencies between them. 12 loops run through 57 of the modules, marked above the diagonal.

The table shows the 40 modules with the most connections; 297 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 gluten.config2 gluten.extension.columnar.cost3 gluten.integration.metrics4 gluten.logging5 gluten.substrait6 spark.sql.execution.window7 gluten.extension.columnar.cost.LongCosterChain8 gluten.extension.columnar.offload9 gluten.extension.columnar.transition.FloydWarshallGraph10 gluten.extension.columnar.validator11 gluten.extension.columnar.transition12 gluten.extension.columnar.transition.Convention13 gluten.extension.columnar.transition.ConventionFunc14 gluten.extension.columnar.transition.ConventionReq.RowType15 gluten.expression16 gluten.integration17 gluten.integration.action.TableRender.RowParser.FieldAppender18 gluten.qt19 gluten.integration.action20 gluten.qt.execution21 gluten.integration.action.TableRender22 spark.sql.delta23 spark.task24 gluten.memory25 gluten.runtime26 gluten.vectorized27 gluten.metrics28 gluten.utils29 spark.storage30 spark.sql.execution31 gluten.execution32 gluten.extension.columnar33 gluten.sql.shims34 gluten.extension.injector35 gluten.backendsapi.bolt36 gluten.extension37 spark.shuffle38 gluten.backendsapi39 gluten.backendsapi.clickhouse40 gluten.backendsapi.velox
1 gluten.config
2 gluten.extension.columnar.cost
3 gluten.integration.metrics
4 gluten.logging
5 gluten.substrait
6 spark.sql.execution.window
7 gluten.extension.columnar.cost.LongCosterChain2
8 gluten.extension.columnar.offload3
9 gluten.extension.columnar.transition.FloydWarshallGraph12
10 gluten.extension.columnar.validator11
11 gluten.extension.columnar.transition1125
12 gluten.extension.columnar.transition.Convention4
13 gluten.extension.columnar.transition.ConventionFunc44
14 gluten.extension.columnar.transition.ConventionReq.RowType2
15 gluten.expression335
16 gluten.integration522
17 gluten.integration.action.TableRender.RowParser.FieldAppender1
18 gluten.qt14
19 gluten.integration.action16
20 gluten.qt.execution1
21 gluten.integration.action.TableRender11
22 spark.sql.delta1641
23 spark.task1
24 gluten.memory1
25 gluten.runtime1
26 gluten.vectorized916
27 gluten.metrics911
28 gluten.utils11111257
29 spark.storage21
30 spark.sql.execution6312221315128
31 gluten.execution313324750121612515
32 gluten.extension.columnar211
33 gluten.sql.shims111122
34 gluten.extension.injector1
35 gluten.backendsapi.bolt2143112112201517
36 gluten.extension110411101
37 spark.shuffle110222
38 gluten.backendsapi2511121152224
39 gluten.backendsapi.clickhouse3124131121113211417
40 gluten.backendsapi.velox2153112115211417
Uses a module listed above itPart of a loopThe module itself
1 gluten.config2 gluten.extension.columnar.cost3 gluten.integration.metrics4 gluten.logging5 gluten.substrait6 spark.sql.execution.window7 gluten.extension.columnar.cost.LongCosterChain8 gluten.extension.columnar.offload9 gluten.extension.columnar.transition.FloydWarshallGraph10 gluten.extension.columnar.validator11 gluten.extension.columnar.transition12 gluten.extension.columnar.transition.Convention13 gluten.extension.columnar.transition.ConventionFunc14 gluten.extension.columnar.transition.ConventionReq.RowType15 gluten.expression16 gluten.integration17 gluten.integration.action.TableRender.RowParser.FieldAppender18 gluten.qt19 gluten.integration.action20 gluten.qt.execution21 gluten.integration.action.TableRender22 spark.sql.delta23 spark.task24 gluten.memory25 gluten.runtime26 gluten.vectorized27 gluten.metrics28 gluten.utils29 spark.storage30 spark.sql.execution31 gluten.execution32 gluten.extension.columnar33 gluten.sql.shims34 gluten.extension.injector35 gluten.backendsapi.bolt36 gluten.extension37 spark.shuffle38 gluten.backendsapi39 gluten.backendsapi.clickhouse40 gluten.backendsapi.veloxgluten.config1gluten.extension.columnar.cost2gluten.integration.metrics3gluten.logging4gluten.substrait5spark.sql.execution.window6gluten.extension.columnar.cost.LongCosterChain7gluten.extension.columnar.offload8gluten.extension.columnar.transition.FloydWarshallGraph9gluten.extension.columnar.validator10gluten.extension.columnar.transition11gluten.extension.columnar.transition.Convention12gluten.extension.columnar.transition.ConventionFunc13gluten.extension.columnar.transition.ConventionReq.RowType14gluten.expression15gluten.integration16gluten.integration.action.TableRender.RowParser.FieldAppender17gluten.qt18gluten.integration.action19gluten.qt.execution20gluten.integration.action.TableRender21spark.sql.delta22spark.task23gluten.memory24gluten.runtime25gluten.vectorized26gluten.metrics27gluten.utils28spark.storage29spark.sql.execution30gluten.execution31gluten.extension.columnar32gluten.sql.shims33gluten.extension.injector34gluten.backendsapi.bolt35gluten.extension36spark.shuffle37gluten.backendsapi38gluten.backendsapi.clickhouse39gluten.backendsapi.velox40231211112544423355221141611116411119169111111125721631222131512831332475012161251521111112212143112112201517110411101110222251112115222431241311211132114172153112115211417+297 more modules (most-connected shown)

At a glance — Code Health · 55% · Adequate · gated by X5 ·

At a glance — Architecture · 63% · Adequate · gated by AX8 ·

At a glance — Maturity · 73% · Strong ·

At a glance — Readiness · 63% · Adequate ·

At a glance — Security · 46% · Weak · gated by D29, D30, D31, D36 ·

At a glance — Domain Modelling · 100% · Exemplary ·

At a glance — Performance · 62% · Adequate ·

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 — Injection393High / Critical
A02:2025 — Security Misconfiguration102High / Critical
A03:2025 — Software Supply Chain Failures82High / Critical
A07:2025 — Authentication Failures1High / Critical

Roadmap

Begin by addressing the 79 medium IaC findings, prioritizing fixes in the CentOS and Ubuntu Dockerfiles, while simultaneously resolving the 25 high-severity dependency vulnerabilities in Maven and Python packages. Next, eliminate the 50 static analysis issues related to mutable job containers, focusing on the Velox backend and nightly configuration files. Finally, enforce strict null safety in Scala by enabling explicit null checks and WartRemover, and resolve the remaining 19 medium dependency vulnerabilities in the same package managers.

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

Do thisHelpsEffortDimension
Resolve the 79 Medium IaC finding(s) in IaC & Container Security — start with REDACTED (21), REDACTED (7), REDACTED (6).+4.5 ptsMediumIaC & Container Security
Resolve the 9 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED, REDACTED, REDACTED.+1.6 ptsLowSupply-chain Provenance & Signing
Resolve the 25 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (22), REDACTED (3).+3.0 ptsMediumDependency Vulnerabilities
Resolve the 50 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (17), REDACTED (11), REDACTED (4).+2.9 ptsMediumStatic Analysis (SAST)
Resolve the 8 Critical CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (8).+1.3 ptsLowDependency Vulnerabilities
On Scala 3, add `-Yexplicit-nulls` to `scalacOptions` so `String` and `String | Null` mean different things, and type each Java API's result as nullable where it can return null; on Scala 2 (or as a first step), enable WartRemover's `Null` wart (`wartremoverErrors += Wart.Null`) or Scalafix's `DisableSyntax.noNulls = true` so the code holds absence in `Option`. Then pay the assertions down rather than adding to them: each `.nn` is a null the compiler could not rule out — wrap the Java value in `Option(…)` at the boundary, pattern-match on `null` once there, or change the API so the null cannot arrive; an `unsafeNulls` import switches the checking off for everything after it.+2.3 ptsMediumNullable reference types
Resolve the 19 Medium CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (14), REDACTED (5).+2.3 ptsMediumDependency Vulnerabilities
Resolve the 1 Leaked secret finding(s) in Secret Scanning — start with REDACTED.+1.0 ptsLowSecret Scanning

File quality

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

FileScoreBandWorst signal
REDACTED0.0SlopDependency Vulnerabilities: Critical CVE: REDACTED
REDACTED0.0SlopDependency Vulnerabilities: Critical CVE: REDACTED
REDACTED0.2SlopIaC & Container Security: High IaC: REDACTED
REDACTED0.7SlopStatic Analysis (SAST): High: REDACTED
REDACTED1.0SlopDependency Vulnerabilities: High CVE: REDACTED
REDACTED1.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED1.3SlopIaC & Container Security: High IaC: REDACTED
REDACTED1.6SlopIaC & Container Security: High IaC: REDACTED
REDACTED1.7SlopIaC & Container Security: High IaC: REDACTED
REDACTED2.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.3SlopSecret Scanning: Leaked secret: REDACTED
REDACTED2.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.5SlopStatic 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 — 455

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

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

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

Could not be resolved — 17

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

Methodology & how to trust this report

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

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

What we checked — 62 dimensions across the health lenses
D1D2D3D4D5D6D9D13D15D16D17D19D26D28D29D30D31D34D35D36D43D44AX10AX3AX4AX6AX8DM12DM6DM9M1M2M3P1P2P3P4P6PF2X1X12X13X14X15X16X17X18X19X20X21X22X23X24X25X26X27X28X29X3X30X4X5

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, 2385 of 2408 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
  2. Is there a tool behind the number? Every score below names the method that produced it — Roslyn, git, a scanner, or (for a handful of documentation/naming dimensions) an LLM labelled sampled · advisory — not a narrative.
  3. Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.

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

Tools & methods

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

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

Every finding is locatable in findings.md. Run 01a177d2-c7f3-7058-abd8-26edbf6f9632.

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.

  • D4 Code Duplication — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. The 681 duplicated block group(s) on this row were found in the languages this pass could tokenize, and they do NOT cover all of this repository's production source: .cc (76,536 lines, 25% of production source), .cpp (46,322 lines, 15% of production source) went unread, because no language model this pass could load exposed a clone-unit token stream for those file kinds. Duplication in that source is UNMEASURED — its absence from the count above is a gap in this analyzer's language coverage, not a finding that the code is free of duplication.
  • D8 Code Coverage — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT MEASURED: test source is present (.java, .scala) but the built-in coverage collector has no runner for this repository's ecosystem — so this suite was never executed by it. Not scored — this is a gap in the analyzer's language coverage, not a defect in the repo. To have real coverage read, produce a coverage report in a standard format (JaCoCo XML — `mvn jacoco:report`, or `addSbtPlugin("org.scoverage" % "sbt-scoverage" % "<version>")` in `project/plugins.sbt`, then `sbt clean coverage test coverageReport`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures. You can widen what we reach: optional: produce a coverage report in a standard format (JaCoCo XML — `mvn jacoco:report`, or `addSbtPlugin("org.scoverage" % "sbt-scoverage" % "<version>")` in `project/plugins.sbt`, then `sbt clean coverage test coverageReport`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures — then the real number is read on the next scan.
  • D11 Test Reliability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test source is present (.java, .scala) but the built-in reliability runner does not support this repository's ecosystem, so flakiness couldn't be assessed. Not scored — this is a gap in the analyzer's language coverage, not a finding about this repository.
  • D12 Dependency Hygiene — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Not scored — 41 Maven/Gradle manifest(s) were read, stating a version for 95 dependency(ies) and leaving 364 to a parent or an imported BOM, but no build resolved the dependency graph, so the outdated signal was not established. NOT a finding that these dependencies are current or healthy.
  • D19 Documentation Quality — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 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 — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This 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 — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D21's deterministic naming 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. Until then its declarations carry no naming verdict this run — this says nothing about whether its names are consistent.
  • D22 Internal API Consistency — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22 identifies the intentionally-exposed surface from `IsPackable` and `.Contracts` project names, MSBuild conventions read off the loaded project set. This target exposed no such projects, so the probe never ran; this says nothing about whether the repository has a public API. This repository commits no C#/VB source at all, so there was never an MSBuild project set to read these conventions off. That is OUR side and it is a COLLECTOR gap, not an environment fault: it declares a published package (REDACTED), but no published-package marker D22 reads admitted any project here, so this ecosystem's public API has no collector, and the remedy is to write one — no change to the scan image can close it.
  • D24 Comment Value — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover the language this repository's product is written in, so it had nothing of the product to read. That is a gap in this analyzer's language reach — not a finding about this repository.
  • D26 Project Cohesion — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Project size and spread are measured over build units whose source a code model reads. This repository's .cc, .cpp source is a material share of its production lines and was read by none, so the score is a verdict about the units that were read. Not a finding that the unread source is cohesive — it is unmeasured.
  • D27 Navigability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover the language this repository's product is written in, so it had nothing of the product to read. That is a gap in this analyzer's language reach — not a finding about this repository.
  • D32 Data Compliance (PII/GDPR) — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxTransformerApi.scala`, `gluten-ui/src/main/scala/org/apache/spark/sql/execution/ui/GlutenAllExecutionsPage.scala` produced a parse error, so every rule in this engine's `gdpr.yml` was absent there. That absence is NOT a clean result: these rules detect personal data crossing a boundary into a log sink, a URL or browser storage, and a file that was never parsed cannot report any of the three. The rest of the tree analysed normally and its rows above stand; only these files are unaccounted for. You can widen what we reach: fix the syntax error (or exclude the file deliberately) and re-scan to cover it.
  • AXR1 Runtime accessibility — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Render strategy: boot via REDACTED (REDACTED). docker build failed (exit 1) — 24 | # https://github.com/apache/gluten/issues/12412. 25 | 26 | >>> FROM almalinux:8 27 | 28 | ARG GLUTEN_REPO=https://github.com/apache/gluten -------------------- ERROR: failed to solve: almalinux:8: failed to resolve source metadata for docker.io/library/almalinux:8: failed to do request: Head "https://registry-1.docker.io/v2/library/almalinux/manifests/8": Forbidden; runtime evidence skipped.
  • C1 Data Protection — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These personal data controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks personal data controls.
  • C2 Access Controls — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These authorization controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks authorization controls.
  • DM8 Value-object opportunities — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check finds primitive parameters that travel together through several signatures of the domain (a missing value object). Its deterministic rule has not yet shown 95 % precision on adjudicated rows, so the clumps it finds are counted here and not published as findings, and the card carries no score. That is a limit of the analyzer, not a finding about your code.
  • GD1 Unfinished & placeholder code — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby and Scala source only, and this repository's Java, Python, c, cpp 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 — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby and Scala source only, and this repository's Python, c, cpp 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.
  • P8 Schema migrations — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. The schema may be created by a runner, a deploy script or a config file outside what this check reads, so an absence here is our blind spot rather than a missing migration strategy. The card abstains instead of scoring. You can widen what we reach: if the schema is created and evolved by a tool this check does not name, naming it lets us teach the detector to read it.
  • S1 Web-Security Posture — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These web-security controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks web-security controls.

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

Limitations & what we did not check

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

Per-dimension blind spots

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

  • D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
  • D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
  • D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
  • D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
  • D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
  • 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.
  • D9 Test Distribution: The test-pyramid shape is inferred from project/folder naming and references, with a single test host bucketed per-file by its path tier and content signals — a suite that names tiers unconventionally and gives no per-file signal can still be mis-bucketed.
  • 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").
  • 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.
  • 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 REDACTED, 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.
  • DM6 Domain ↔ infrastructure boundary: Infrastructure reached through a hand-rolled wrapper, a domain-named facade, reflection, or a string-keyed service locator resolves to a non-infra type and isn't seen; the body scan is symbol resolution over syntax, not full dataflow. A clean result means "no resolved infra reference in a domain body", not a proof of purity.
  • 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 Complexity6.0 / 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 6.0 / 10 · rule-coverage 100% · ceiling Prevented

44 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was ExpressionConverter.transformExpression at 101. A further 12 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 FallbackByUserOptions.validate at 38 — they are counted neither in the figure above nor in this dimension's score. 5 files carry no cyclomatic complexity row at all for this reason — every one of their over-threshold methods was excluded, so the exclusion is disclosed nowhere in the file itself: backends-velox/src/main/scala/org/apache/gluten/execution/VeloxColumnarToRowExec.scala (VeloxColumnarToRowExec.doValidateInternal at 20), gluten-substrait/src/main/scala/org/apache/gluten/expression/ConverterUtils.scala (ConverterUtils.getTypeNode at 20), gluten-substrait/src/main/scala/org/apache/spark/sql/execution/GlutenExplainUtils.scala (GlutenExplainUtils.shouldIgnoreInFallbackStats at 20), backends-bolt/src/main/scala/org/apache/gluten/execution/BoltColumnarToRowExec.scala (BoltColumnarToRowExec.doValidateInternal at 19), backends-clickhouse/src/main/scala/org/apache/spark/sql/execution/CHColumnarToRowExec.scala (CHColumnarToRowExec.doValidateInternal at 18). 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.

GlutenShuffleBlockFetcherIterator.next (cyclomatic 39) · ×5shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:879
CachedColumnarBatchKryoSerializer.serializeStats (cyclomatic 25) · ×2backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:190
CachedColumnarBatchKryoSerializer.deserializeStats (cyclomatic 20) · ×2backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:289
GlutenDeltaParquetFileFormat.iteratorWithAdditionalMetadataColumns (cyclomatic 16) · ×2backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:338
ExpressionConverter.transformExpression (cyclomatic 101)gluten-substrait/src/main/scala/org/apache/gluten/expression/ExpressionConverter.scala:301

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

What to do

  1. Bring the 2 bodies over 60 down to 60 or less in Cyclomatic Complexity — start with ExpressionConverter.transformExpression (cyclomatic 101), gen-function-support-docs.parse_logs (cyclomatic 77). — 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 2 together lifts Cyclomatic Complexity from 6.0 to about 6.5/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.
  2. Enforce Cyclomatic Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

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

133 method(s) exceeded the cognitive complexity threshold of 15; the worst was gen-function-support-docs.parse_logs at 213.

GlutenShuffleBlockFetcherIterator.next (cognitive 100) · ×5shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:879
GlutenShuffleBlockFetcherIterator.fetchUpToMaxBytes (cognitive 24) · ×5shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1297
GlutenShuffleBlockFetcherIterator.collectFetchRequests (cognitive 20) · ×5shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:545
GlutenShuffleBlockFetcherIterator.sendRequest (cognitive 19) · ×5shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:269
GlutenShuffleBlockFetcherIterator.cleanup (cognitive 17) · ×5shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:227

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

What to do

  1. Bring the 1 body over 120 down to 120 or less in Cognitive Complexity — start with gen-function-support-docs.parse_logs (cognitive 213). — Refactoring it lifts Cognitive Complexity from 5.2 to about 5.8/10.
  2. Enforce Cognitive Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

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

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

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

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

48 god class(es) detected.

FileTooLong: REDACTED · ×25REDACTED
ClassTooLong: BoltSparkPlanExecApi · ×9backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:72
TooManyMethods: SparkPlanExecApi · ×8gluten-substrait/src/main/scala/org/apache/gluten/backendsapi/SparkPlanExecApi.scala:53
MethodTooLong: StreamExecJoin.translateToPlanInternal · ×6gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecJoin.java:175

What to do

  1. Resolve the 25 FileTooLong finding(s) in God Classes — start with GlutenShuffleBlockFetcherIterator.scala (5), ColumnarCachedBatchSerializer.scala (2), REDACTED. — One of this dimension's main actionable groups (25 warning-level).
  2. Resolve the 9 ClassTooLong finding(s) in God Classes — start with GlutenShuffleBlockFetcherIterator.scala (2), BoltSparkPlanExecApi.scala, CHSparkPlanExecApi.scala. — One of this dimension's main actionable groups (9 warning-level).
  3. Resolve the 8 TooManyMethods finding(s) in God Classes — start with DeltaLog.scala (2), SparkPlanExecApi.scala, GlutenAbstractStreamOperator.java. — One of this dimension's main actionable groups (8 warning-level).
  4. Enforce God Classes in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

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

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

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

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

681 duplicated block group(s) detected. A further 68 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted. 11 of the 749 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. Measured on part of this repository only: .cc, .cpp (41% of production source) was not exposed to the token comparison, so duplication there is unmeasured and is not in this count.

Duplicated block (9 lines × 2) · ×34backends-bolt/src-celeborn/main/scala/org/apache/spark/shuffle/BoltCelebornColumnarShuffleWriter.scala:176
Duplicated block (10 lines × 2) · ×33backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:89
Members sharing a duplicated core (5 members, 50+ identical tokens) · ×30shims/spark34/src/main/scala/org/apache/gluten/sql/shims/spark34/Spark34Shims.scala:57
Duplicated block (11 lines × 2) · ×28backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:500
Duplicated block (8 lines × 2) · ×26backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:811

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

What to do

  1. Resolve the 34 Duplicated block (9 lines × 2) finding(s) in Code Duplication — start with OnHeapFileSystem.java (3), ColumnarArrowEvalPythonExec.scala (2), RewriteDateTimestampComparisonRule.scala (2). — One of this dimension's main actionable groups (34 warning-level).
  2. Resolve the 33 Duplicated block (10 lines × 2) finding(s) in Code Duplication — start with BoltSparkPlanExecApi.scala (4), ColumnarCachedBatchSerializer.scala (3), BoltColumnarWriteFilesExec.scala (2). — One of this dimension's main actionable groups (33 warning-level).
  3. Resolve the 30 Members sharing a duplicated core (5 members, 50+ identical tokens) finding(s) in Code Duplication — start with GlutenShuffleBlockFetcherIterator.scala (15), GlutenPushBasedFetchHelper.scala (5), AbstractHiveTableScanExec.scala (3). — One of this dimension's main actionable groups (30 warning-level).
  4. Enforce Code Duplication in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.

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

D5 · Coupling9.6 / 10Stronggated by 2 serious findings✓ 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 9.6 / 10 · rule-coverage 100% · ceiling Prevented

40 production modules (Maven+CMake), 0 dependency cycle(s), 0 unstable depended-on module(s). Read from the build's own module declarations; 2 module(s) off the main sequence, with abstractness counted on 24 of the 40 (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: gluten-flink-runtime · ×2

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. Enforce Coupling in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D6 · Cohesion (LCOM4)9.6 / 10Stronggated by 6 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

6 of 190 classes have LCOM4 above 3.

Low cohesion: AbstractHiveTableScanExec (LCOM4 5) · ×6shims/spark34/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:58

What to do

  1. Resolve the 6 Low cohesion finding(s) in Cohesion (LCOM4) — start with AbstractHiveTableScanExec.scala (5), BasicPhysicalOperatorTransformer.scala. — One of this dimension's main actionable groups (6 warning-level).
  2. Enforce Cohesion (LCOM4) in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.

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

D9 · Test Distribution9.9 / 10Exemplary✓ Tool-verified

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

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

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

3753 test methods: 3711 unit, 22 integration, 0 BDD, 20 e2e. The Python suite contributes 59 test function(s) across 7 file(s) declaring at least one — every `def test…` in a file pytest or unittest would collect, which is those frameworks' own definition of a case; a parametrize table counts once, so this is a floor. Its tier split is read from file names and paths only. The Scala suite contributes 3426 test case(s) across 344 file(s) in a test source set declaring at least one — every `test("…")`, `it("…")`, `property("…")` and `"…" in {…}` registration and every JUnit `@Test`, which is how munit, ScalaTest, utest, ZIO Test and specs2 declare a case; a case registered under a computed name is not counted, so this is a floor. Its tier split is INFERRED from paths and file names, except sbt's src/it source set, which the build declares.

✓ On the Gold path — maintain.

Detailed fixes: d9_recommendation.md.

D13 · Secret Scanning5.0 / 10Adequate✓ Tool-verified

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 5.0 / 10 · rule-coverage 100% · ceiling Prevented

1 secret(s) detected.

REDACTED

What to do

  1. Resolve the 1 Leaked secret finding(s) in Secret Scanning — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
  2. Enforce Secret Scanning in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D15 · Churn × Complexity Hotspots9.8 / 10Stronggated by 11 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.8 / 10 · rule-coverage 100% · ceiling Documented

Top hotspots: gluten-substrait/src/main/scala/org/apache/gluten/expression/ExpressionConverter.scala (10×101=1010); backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala (14×49=686); gluten-substrait/src/main/scala/org/apache/gluten/extension/columnar/validator/Validators.scala (6×33=198)

Hotspot: gluten-substrait/src/main/scala/org/apache/gluten/expression/ExpressionConverter.scala · ×11gluten-substrait/src/main/scala/org/apache/gluten/expression/ExpressionConverter.scala:301

What to do

  1. Resolve the 11 Hotspot finding(s) in Churn × Complexity Hotspots — start with ExpressionConverter.scala, VeloxSparkPlanExecApi.scala, Validators.scala. — One of this dimension's main actionable groups (11 warning-level).

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

D16 · Bus Factor9.4 / 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.4 / 10 · rule-coverage 100% · ceiling Documented

47 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala. Counted over 828 of the 1418 production source files in this repository: 587 are under the ~2,400-byte size floor this dimension measures over, and the remaining 3 have no attributable history left to measure.

Off-boarding risk: anonymized user #1 · ×3
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.3 / 10Stronggated by 544 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.3 / 10 · rule-coverage 100% · ceiling Prevented

587 deducted task-comment markers across 177345 LoC (0.3/KLoC) → score 9.3. 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 · ×448tools/gluten-it/common/src/main/scala/org/apache/spark/sql/SparkQueryRunner.scala:108
FixmeComment · ×90tools/gluten-it/common/src/main/scala/org/apache/spark/sql/SparkQueryRunner.scala:224
HackComment · ×3backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala:173
FixmeComment repeated across 11 files · ×2gluten-ut/spark42/src/test/scala/org/apache/gluten/utils/velox/VeloxTestSettings.scala:226
TodoComment repeated across 12 filesgluten-ut/spark42/src/test/scala/org/apache/spark/sql/GlutenColumnExpressionSuite.scala:28

What to do

  1. Resolve the 448 TodoComment finding(s) in Explicit Debt — start with VeloxTestSettings.scala (39), ClickHouseTestSettings.scala (34), VeloxSQLQueryTestSettings.scala (32). — One of this dimension's main actionable groups (448 warning-level).
  2. Resolve the 90 FixmeComment finding(s) in Explicit Debt — start with ClickHouseTestSettings.scala (8), ClickHouseAdaptiveQueryExecSuite.scala (8), DeleteSQLSuite.scala (8). — One of this dimension's main actionable groups (90 warning-level).
  3. Resolve the 3 HackComment finding(s) in Explicit Debt — start with GlutenDeltaOptimizedWriterExec.scala (2), DeltaOptimizedWriterTransformer.scala. — One of this dimension's main actionable groups (3 warning-level).
  4. Enforce Explicit Debt in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D19 · Documentation 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. 79 document(s) read across 1 unit(s).

✓ On the Gold path — maintain.

Detailed fixes: d19_recommendation.md.

D26 · Project Cohesion4.7 / 10Weak✓ Tool-verified

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

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

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

7 of 25 build units (Maven) flagged as possibly oversized/incoherent. This repository's .cc, .cpp source was read by no build unit, so this covers part of the tree, not all of it.

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

393 finding(s): 0 critical, 376 high, 12 medium, 5 low. 282 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 13 file(s) — `.github/workflows/util/delta-spark-ut/apply-delta-test-patches.sh` (lines 98–104, lines 105–115, lines 151–154, …), `.github/workflows/util/delta-spark-ut/run-delta-tests.sh` (lines 133–188), `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxTransformerApi.scala`, `cpp-ch/local-engine/Storages/Parquet/ParquetMeta.h` (line 167, line 168, line 176), `cpp/bolt/operators/plannodes/RowVectorStream.h` (line 136), … (+8 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 10 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

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

What to do

  1. Resolve the 50 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (17), REDACTED (11), REDACTED (4). — One of this dimension's main actionable groups (50 issue-level).
  2. Resolve the 19 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (6), REDACTED (5), REDACTED (2). — One of this dimension's main actionable groups (19 issue-level).
  3. No action in Static Analysis (SAST) — all 282 REDACTED finding(s) are reported here at file:line but scored by D36 (supply-chain provenance), so none is charged to this dimension. — One of this dimension's main actionable groups (282 issue-level, 0 of them charged here).

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

D30 · Dependency Vulnerabilities0.0 / 10Critical✓ 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.

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

55 finding(s): 8 critical, 25 high, 19 medium, 3 low.

REDACTED
REDACTED
REDACTED
REDACTED

What to do

  1. Resolve the 25 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (22), REDACTED (3). — One of this dimension's main actionable groups (25 issue-level).
  2. Resolve the 19 Medium CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (14), REDACTED (5). — One of this dimension's main actionable groups (19 warning-level).
  3. Resolve the 8 Critical CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (8). — One of this dimension's main actionable groups (8 issue-level).

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

D31 · IaC & Container Security0.0 / 10Critical✓ 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 0.0 / 10 · rule-coverage 100% · ceiling Documented

102 finding(s): 0 critical, 21 high, 79 medium, 2 low.

REDACTED
REDACTED
REDACTED

What to do

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

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

D34 · Knowledge Freshness8.0 / 10Adequategated by 7 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 8.0 / 10 · rule-coverage 100% · ceiling Documented

165 of 831 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/DeltaLog.scala. Counted over 831 of the 1418 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

Orphaned knowledge · ×7backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/DeltaLog.scala:1
Orphaned file · ×158backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/execution/datasources/v1/clickhouse/MergeTreeFileFormatWriter.scala:1
Further orphaned files (smaller)

What to do

  1. Resolve the 7 Orphaned knowledge finding(s) in Knowledge Freshness — start with DeltaLog.scala, VacuumCommand.scala, Snapshot.scala. — One of this dimension's main actionable groups (7 issue-level).
  2. Resolve the 158 Orphaned file finding(s) in Knowledge Freshness — start with ExpandOutputPartitioningShim.scala (3), GenerateTreeStringShim.scala (2), MergeTreeFileFormatWriter.scala. — One of this dimension's main actionable groups (158 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.6 / 10Adequategated by 11 critical 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.6 / 10 · rule-coverage 100% · ceiling Documented

Strongest change-coupling: BatchScanMetricsUpdater.scala↔FileSourceScanMetricsUpdater.scala 100%; Spark40Shims.scala↔Spark41Shims.scala 90%; FileSourceScanMetricsUpdater.scala↔HiveTableScanMetricsUpdater.scala 90%

Boundary-crossing change coupling: CHIteratorApi.scala ↔ WholeStageZippedPartitionsRDD.scala · ×11backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHIteratorApi.scala:1
Change coupling: Spark40Shims.scala ↔ Spark41Shims.scala · ×17shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala:1
Change-coupling hub: BatchScanMetricsUpdater.scala → FileSourceScanMetricsUpdater.scala, HiveTableScanMetricsUpdater.scala, MetricsUtil.scala · ×3backends-velox/src/main/scala/org/apache/gluten/metrics/BatchScanMetricsUpdater.scala

What to do

  1. Resolve the 11 Boundary-crossing change coupling finding(s) in Change Coupling — start with GlutenColumnarRule.scala (2), CHIteratorApi.scala, GlutenPlugin.scala. — One of this dimension's main actionable groups (11 issue-level).
  2. Resolve the 17 Change coupling finding(s) in Change Coupling — start with FileSourceScanMetricsUpdater.scala (2), ColumnarBuildSideRelation.scala (2), Spark40Shims.scala. — One of this dimension's main actionable groups (17 warning-level).
  3. Resolve the 3 Change-coupling hub finding(s) in Change Coupling — start with BatchScanMetricsUpdater.scala, Metrics.java, Spark35Shims.scala. — One of this dimension's main actionable groups (3 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
REDACTED

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

What to do

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

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

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

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

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

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

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

✓ On the Gold path — maintain.

Detailed fixes: d43_recommendation.md.

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

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

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

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

0 end-of-life runtime(s) and 0 end-of-life framework(s), read from 4 platform declaration(s) and 305 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.8 / 10Exemplary✓ Tool-verified

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

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

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

What to do

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

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

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

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

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

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

AX6 · Interface segregation9.9 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether interfaces stay focused rather than fat — the Interface-Segregation principle (SOLID 'I').

Method: Roslyn scan: public interface declared-member counts (accessors fold into their property/event); fat-interface threshold (over 15 declared members) flagged per type. Each finding also reports the distinct-OPERATION count — members counted by name, so an overload group counts once — which decides whether it states the caller-side ISP harm or the implementer-side burden of an overload set. TypeScript: exported interfaces that declare behaviour, counted over their REQUIRED operations (method signatures and function-typed properties with no `?`, once per signature) — data-shape interfaces and ambient .d.ts declarations are outside the population; JavaScript declares no interfaces and is not applicable. Deterministic, type-level.

  • `MetricsApi` declares 44 abstract members: `genInputIteratorTransformerMetrics`, `genInputIteratorTransformerMetricsUpdater`, `metricsUpdatingFunction`, `genBatchScanTransformerMetrics`, `genBatchScanTransformerMetricsUpdater`, `genHiveTableScanTransformerMetrics`, `genHiveTableScanTransformerMetricsUpdater`, `genFileSourceScanTransformerMetrics`, `genFileSourceScanTransformerMetricsUpdater`, `genFilterTransformerMetrics`, `genFilterTransformerMetricsUpdater`, `genProjectTransformerMetrics`, `genProjectTransformerMetricsUpdater`, `genHashAggregateTransformerMetrics`, `genHashAggregateTransformerMetricsUpdater`, `genExpandTransformerMetrics`, `genExpandTransformerMetricsUpdater`, `genCustomExpandMetrics`, `genColumnarShuffleExchangeMetrics`, `genWindowTransformerMetrics`, `genWindowTransformerMetricsUpdater`, `genColumnarToRowMetrics`, `genRowToColumnarMetrics`, `genLimitTransformerMetrics`, `genLimitTransformerMetricsUpdater`, `genWriteFilesTransformerMetrics`, `genWriteFilesTransformerMetricsUpdater`, `genBatchWriteMetrics`, `genSortTransformerMetrics`, `genSortTransformerMetricsUpdater`, `genTopNTransformerMetrics`, `genTopNTransformerMetricsUpdater`, `genSortMergeJoinTransformerMetrics`, `genSortMergeJoinTransformerMetricsUpdater`, `genColumnarBroadcastExchangeMetrics`, `genColumnarSubqueryBroadcastMetrics`, `genHashJoinTransformerMetrics`, `genHashJoinTransformerMetricsUpdater`, `genNestedLoopJoinTransformerMetrics`, `genNestedLoopJoinTransformerMetricsUpdater`, and 4 more. Counted over its ABSTRACT members — a `def` with no body or a `val`/`var` with no initializer, once per signature; concrete members, private and protected members, and members of a companion `object` are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — gluten-substrait/src/main/scala/org/apache/gluten/backendsapi/MetricsApi.scala:30
  • `SparkPlanExecApi` declares 33 abstract members: `genFilterExecTransformer`, `genHashAggregateExecTransformer`, `genHashAggregateExecPullOutHelper`, `genColumnarShuffleExchange`, `genShuffledHashJoinExecTransformer`, `genBroadcastHashJoinExecTransformer`, `genSampleExecTransformer`, `genSortMergeJoinExecTransformer`, `genCartesianProductExecTransformer`, `genBroadcastNestedLoopJoinExecTransformer`, `genGetMapValueTransformer`, `genGetArrayItemTransformer`, `genPosExplodeTransformer`, `genShuffleDependency`, `genColumnarShuffleWriter`, `genColumnarShuffleReader`, `createColumnarBatchSerializer`, `createBroadcastRelation`, `createColumnarWriteFilesExec`, `createColumnarArrowEvalPythonExec`, `genLikeTransformer`, `genToUnixTimestampTransformer`, `genDateDiffTransformer`, `genWindowFunctionsNode`, `genGenerateTransformer`, `genPreProjectForGenerate`, `genPostProjectForGenerate`, `genColumnarCollectLimitExec`, `genColumnarRangeExec`, `genColumnarTailExec`, `genColumnarToCarrierRow`, `genTimestampAddTransformer`, `genMonthsBetweenTransformer`. Counted over its ABSTRACT members — a `def` with no body or a `val`/`var` with no initializer, once per signature; concrete members, private and protected members, and members of a companion `object` are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — gluten-substrait/src/main/scala/org/apache/gluten/backendsapi/SparkPlanExecApi.scala:53
  • `SparkShims` declares 26 abstract members: `scalarExpressionMappings`, `aggregateExpressionMappings`, `runtimeReplaceableExpressionMappings`, `filesGroupedToBuckets`, `getSampleSeed`, `isKeyGroupedPartitioning`, `setJobDescriptionOrTagForBroadcastExchange`, `cancelJobGroupForBroadcastExchange`, `getFileStatus`, `isFileSplittable`, `isRowIndexMetadataColumn`, `findRowIndexColumnIndexInSchema`, `splitFiles`, `getAnalysisExceptionPlan`, `getCommonPartitionValues`, `orderPartitions`, `extractExpressionTimestampAddUnit`, `isNullIntolerant`, `createParquetFilters`, `getOperatorId`, `setOperatorId`, `unsetOperatorId`, `isParquetFileEncrypted`, `getErrorMessage`, `createSparkPlan`, `getShuffleBlockFetcherIterator`. Counted over its ABSTRACT members — a `def` with no body or a `val`/`var` with no initializer, once per signature; concrete members, private and protected members, and members of a companion `object` are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — shims/common/src/main/scala/org/apache/gluten/sql/shims/SparkShims.scala:73

What to do

  • Split fat interfaces into focused role-interfaces so clients depend only on what they use.
AX8 · Test isolation0.0 / 10Critical✓ 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.

  • `gluten-ut-spark34` (production) references the test project `gluten-ut-common (test-jar)`. Production must never depend on test code — it pulls a unit-test framework and test fixtures into the shipped product and inverts the only correct direction (tests depend on production, never the reverse). Move any shared helper into a production support library, or invert the reference.
  • `gluten-ut-spark35` (production) references the test project `gluten-ut-common (test-jar)`. Production must never depend on test code — it pulls a unit-test framework and test fixtures into the shipped product and inverts the only correct direction (tests depend on production, never the reverse). Move any shared helper into a production support library, or invert the reference.
  • `gluten-ut-spark40` (production) references the test project `gluten-ut-common (test-jar)`. Production must never depend on test code — it pulls a unit-test framework and test fixtures into the shipped product and inverts the only correct direction (tests depend on production, never the reverse). Move any shared helper into a production support library, or invert the reference.
  • `gluten-ut-spark41` (production) references the test project `gluten-ut-common (test-jar)`. Production must never depend on test code — it pulls a unit-test framework and test fixtures into the shipped product and inverts the only correct direction (tests depend on production, never the reverse). Move any shared helper into a production support library, or invert the reference.
  • `gluten-ut-spark42` (production) references the test project `gluten-ut-common (test-jar)`. Production must never depend on test code — it pulls a unit-test framework and test fixtures into the shipped product and inverts the only correct direction (tests depend on production, never the reverse). Move any shared helper into a production support library, or invert the reference.
  • `gluten-ut-test` (production) references the test project `gluten-ut-common (test-jar)`. Production must never depend on test code — it pulls a unit-test framework and test fixtures into the shipped product and inverts the only correct direction (tests depend on production, never the reverse). Move any shared helper into a production support library, or invert the reference.

What to do

  • Remove every production → test project reference: extract any shared test helper into a production support library (which the tests reference), or invert the dependency so the test project depends on production — not the reverse.
DM12 · Ambient inputs in the domain10.0 / 10Exemplary○ Nothing flagged

Other · Domain Modelling — Whether domain types receive the time and randomness their rules depend on, rather than reading the process clock or a global random source directly — an ambient read makes the rule it feeds untestable at the instant that matters and lets two reads inside one operation disagree.

Method: Roslyn (DDD-gated, C#/VB only): domain-layer types scanned for ambient reads — DateTime/DateTimeOffset.Now/UtcNow/Today, Random.Shared, new Random(), Stopwatch.GetTimestamp — resolved against the semantic model, with a comment/string-stripped token fallback only where resolution fails. Body reads are scored; field/property initialisers are surfaced unscored. Apply/When folds excluded (ES1 owns them). Deterministic, symbol-resolved.

DM6 · Domain ↔ infrastructure boundary10.0 / 10Exemplary✓ Tool-verified

Other · Domain Modelling — Whether the domain layer stays free of infrastructure dependencies (EF/Marten/HTTP/ASP.NET) — the clean-architecture dependency rule.

Method: Roslyn (DDD-gated): domain-layer types scanned for infrastructure usage in member SIGNATURES and inside method/accessor BODIES — resolved calls and object-creations into EF/Marten/HTTP/Mongo/Redis/message-bus types (not just a namespace allowlist). Deterministic, symbol-resolved, exhaustive over domain-layer bodies, DDD-native.

Coverage: Domain layer identified by NAMESPACE heuristic; infrastructure then resolved by symbol in member SIGNATURES and method/accessor BODIES — rename the layer and the check evaporates.

DM9 · Scattered domain decisions10.0 / 10Exemplary✓ Tool-verified

Other · Domain Modelling — Whether one domain rule is decided — or one measurement produced — in more than one place, rather than living on the type that owns it.

Method: Neutral body surface plus Roslyn (DDD-gated), two arms. DECISION (Roslyn only): a predicate over a domain type's members judged in two or more types, where none of those decisions live on the owning type — operands of comparisons and relational property patterns only, so a member merely passed as an argument is not judged. DERIVATION: a plain all-numeric carrier of ≥2 members, with no base type and exactly one constructor, CONSTRUCTED as the result of a method (returned or assigned, never inline as an argument) in two or more types other than its own — the same measurement produced twice, which centralising the judgement does not fix. DERIVATION runs on every language whose frontend declares the produced-or-passed fact per construction (Roslyn and the Java sidecar today); a target with only the derivation arm carries an engine gap naming the decision arm as not assessed, and a frontend that declares nothing keeps the dimension not measured rather than clean. Single-member rules, test code and generated code are out of population for both. Advisory.

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

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

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

What to do

  • 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.
  • Add a README to the 36 of 39 project(s) that lack one — worth up to 1.8 pts.
M2 · Architecture documentation5.0 / 10Adequate✓ 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 repo is organised deliberately — src/test separation and consistent project naming.

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

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

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

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

P2 · Observability6.7 / 10Adequate✓ 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 9/10 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`.

What to do

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

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

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

What to do

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

P6 · Release Hygiene5.0 / 10Adequate✓ 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.

  • No CHANGELOG/HISTORY/RELEASES file — what shipped when isn't easy to reconstruct for support or audit. (Versioning/tagging makes releases traceable, but a changelog records the what.)

What to do

  • Keep a changelog (e.g. Keep-a-Changelog) recording what shipped in each release.
PF2 · Allocation hygiene6.2 / 10Adequate✓ Tool-verified

Readiness · Performance — Whether the code is written to minimise allocations so it doesn't pressure its host's memory manager — buffer/slice views over copies, object pooling, stack or value-type allocation, and buffer writers. Reward-only: credited where present, never penalised where a simpler style is fine.

Method: Production-source scan: density (per 1k LoC) of allocation-aware APIs — in .NET Span/Memory, ArrayPool/ObjectPool, stackalloc, ValueTask, value-type structs, IBufferWriter, string.Create, SkipLocalsInit; off .NET, with comments and strings blanked, Go's sync.Pool, preallocated slices/maps, Grow, strconv.Append* and buf[:0] reuse; the JVM's NIO buffer views, MemorySegment, primitive collections, pools and literal presizes (plus Kotlin primitive arrays and value classes, Scala AnyVal and @specialized); Swift's reserveCapacity, ContiguousArray, withUnsafe* access and ~Copyable. Activated off .NET on the same floor (400 lines, and benchmarks or 8 uses); Rust and garbage-collected scripting languages are not applicable. Reward-only. Deterministic, syntax/text detection.

What to do

  • Raise allocation-aware density on the hot paths — currently 93 use(s) across 194,108 production line(s) (~0.5/1k). More of the idioms below on the allocation-heavy paths climbs this toward 10.
  • Java: on hot paths, work through buffer views (ByteBuffer/LongBuffer slices, MemorySegment) instead of copies, avoid boxing with primitive collections (fastutil, Eclipse Collections, HPPC, Trove), presize collections and StringBuilders, and pool expensive buffers (Netty's pooled allocator, commons-pool).
  • Scala: on hot paths, make small wrappers value classes (extends AnyVal), @specialized generic code over primitives, use primitive collections, and presize builders.
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.

X12 · Unreachable branch10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether any branch is dead by construction — a switch arm whose label can never equal a case-normalised subject, or an `else if` whose predicate the arm above has already swallowed.

Method: Roslyn syntax + semantics: switch labels compared against the subject's own case normaliser, and if/else-if chains checked for a literal an earlier arm's containment test already swallows. Deterministic, provable per finding. Advisory.

X13 · Undrained process stream10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a child process that has BOTH standard streams redirected drains both — reading one to the end while the other is never read deadlocks once the child fills the unread pipe.

Method: Roslyn syntax + semantics: ProcessStartInfo launches with both streams redirected, checked for a drain of each stream across the enclosing type. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `spawn` imported from `child_process` whose stdout and stderr are both pipes (no options, no `stdio`, or `stdio` of `'pipe'`), bound to a local that never leaves its scope, where exactly one of the two streams is read, the other never, and the child’s `close`/`exit` (or the read stream’s end) is awaited; a shell redirect in the call’s arguments or a `kill` of the child suppresses it. The same rule reads Python’s `subprocess.Popen`, Dart’s `Process.start`, Ruby’s `Open3.popen3`, and Scala’s JDK process starts (`new ProcessBuilder(…).start()` with no `redirectErrorStream`/`redirectError`/`redirectOutput`/`inheritIO`, `Runtime.getRuntime.exec`) where one of `getInputStream`/`getErrorStream` is read and the other never while `waitFor()` is called or the read stream is read to its end. Deterministic, provable per finding. Advisory.

X14 · Bypassable address classification10.0 / 10Exemplary○ Nothing flagged

Other · Security — Whether a hand-rolled public/private IP check can be walked past — a method that unwraps IPv4-mapped IPv6 but returns the opposite verdict for the same host written as IPv4-compatible, 6to4 or NAT64.

Method: Roslyn syntax + semantics: methods that unwrap IPv4-mapped IPv6 and hand-roll IPv4 range carve-outs, checked for whether the IPv6 branch also accounts for the IPv4-compatible, 6to4 and NAT64 embeddings. Deterministic, provable per finding. Advisory.

X15 · Unvalidated length from an untrusted reader5.2 / 10Adequate✓ Tool-verified

Other · Security — Whether a length read out of the stream being parsed is bounded before it is allocated or read — an unchecked count taken from the input lets the input choose the allocation.

Method: Roslyn syntax + semantics: integer lengths read from a BinaryReader and spent on a bulk read or an array allocation, checked for any comparison or bounding call on the value anywhere in the method. Deterministic, provable per finding. Advisory.

  • `length` is read from the bytes being parsed at line 142 (`readInt`), then used to size a `new Array[Byte]` at line 143 — and nowhere in its scope is `length` bounded from above — compared to a limit, clamped, or checked against the input that remains (a zero or sign test, or the loop that counts up to it, bounds nothing). Whoever wrote those bytes therefore chooses the allocation directly: a 32-bit length asks for up to 2 GiB before a single byte of the payload is known to exist, which either exhausts the heap with an `OutOfMemoryError` or, negative, throws `NegativeArraySizeException` out of a parser whose failure path was written for malformed input, not for hostile input. Bound `length` against the bytes actually remaining and a maximum the format allows before allocating. (×2) — backends-velox/src/main/scala/org/apache/gluten/expression/VeloxBloomFilterMightContain.scala:143, backends-bolt/src/main/scala/org/apache/gluten/expression/BoltBloomFilterMightContain.scala:143

What to do

  • Each finding names the read that takes the length from the input and the site that spends it, and states that the value is never compared in between. Confirm from the two, then bound the length against the remaining stream before using it.
X16 · Unfloored truncation loop10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a loop that shortens a string until it fits a length budget has a floor — one with none grinds the value down to the empty string, or past it into a negative-length `Substring`.

Method: Roslyn syntax + semantics: while/do loops whose body's only effect on a string is to drop its last character, checked for whether anything — a direct comparison on the length, a body guard, a break — bounds that length below. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `while`/`do` loop whose body’s one assignment to a value is `x = x.slice(0, -1)` or `x = x.slice|substring|substr(0, x.length - 1)`, driven by a condition that reads `x.length` only as a term of a larger expression — never compared directly, never tested for truthiness, and with no other read of `x` — and whose body has no `break`, `return`, `throw` or `if` naming `x`. Deterministic, provable per finding. Advisory.

X17 · Uncapped recursion over a caller-supplied document10.0 / 10Exemplary○ Nothing flagged

Other · Security — Whether a walk that recurses through a JSON/XML tree handed in by its caller bounds how deep it will go — an uncapped walk lets the document's nesting choose the stack depth, and the resulting StackOverflowException cannot be caught.

Method: Roslyn syntax + semantics: methods that take a JSON/XML document node and call themselves with a child of it, reachable from an externally-callable member of the same type that accepts a document, checked for any depth parameter, descent counter or threaded arithmetic anywhere in the walk. On a repository with no .NET source it reads TypeScript off the engine’s own token stream (test, vendored, generated and minified paths and `.d.ts` not) with the same rule: a function or method with a parameter typed as a document value — `unknown`, `any`, `object`, `Record<string, unknown|any>`, a JSON alias (`JsonValue`, `JSONObject`, …) or a DOM node global the file does not rebind — that calls itself (bare, or through `this` for a method, or hands itself to a call over the value as in `value.map(walk)`) with something it took out of that value and never through an ancestor accessor such as `closest()` or `parentElement`, that is exported or reached from an exported function (a public method of the same exported class) taking such a value, and that names no depth, level, nesting, recursion, remaining or budget anywhere and threads no `+`/`-` arithmetic through a self-call. Plain JavaScript is not read: with no annotation nothing tells a parsed document from a tree the code built itself. Deterministic, provable per finding. Advisory.

X18 · Disposal-pattern correctness6.2 / 10Adequate✓ Tool-verified

Other · Code Health — Whether a type's disposal matches what it OWNS — releasing what it created, leaving alone what it was handed, and not declaring a finalizer for state that has nothing unmanaged to finalize.

Method: Roslyn syntax + semantics: every assignment to a disposable field is read to decide whether the type CREATED the value or was handed it, and the type's disposal is checked against that answer — an injected interface it disposes, a value it constructed and never releases, a finalizer on a type holding nothing unmanaged, and a disposable local whose every reference is a plain member read. A value handed to a container that disposes its contents (a parent control's `Controls` collection, a component `IContainer`) is released by that container and is not reported; generated code is out of population. On a repository with no .NET source the same ownership questions are read in JavaScript/TypeScript off the engine’s own token stream (test, vendored, generated and minified paths not): a class declaring `dispose()`, `[Symbol.dispose]()` or `[Symbol.asyncDispose]()` that disposes a field it was handed through a constructor parameter typed as a repository interface or resolved by a dependency-injection container; that assigns a field only ever from `new X(…)` of a disposable class and neither releases it anywhere in the class nor names it in its disposal member or a method that member calls, nor hands it to anything else; and a `const`/`let` local built from literals only whose every reference opens a statement operating on a non-release member of it. A class is disposable when every repository declaration of its name declares or inherits a disposal member, or when it is a documented library disposable (`vscode` EventEmitter, CancellationTokenSource and Disposable; three.js geometries, materials, textures, render targets, renderers, controls and composers). The finalizer arm has no JavaScript counterpart: a class cannot declare one. Dart is read for the owned-and-never-released arm: a Flutter `State` (or a class declaring `dispose()`/`close()`) whose library-private field is written only with direct creations of a framework controller, `FocusNode`, `StreamController` or periodic `Timer` (or a `.listen(…)` into a field declared `StreamSubscription`), which nothing in the class or its library releases (`dispose`/`close`/`cancel`) and which is never handed on except as a named argument. Ruby is read for the owned-and-never-released arm and the abandoned-local arm: a class declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose instance variable is written only with a blockless core descriptor creation (`File.open`/`new`, `Tempfile`, `Dir.open`, `IO.popen`, the `socket` and `openssl` socket classes) that no method of the class closes and that is never handed on (passed, returned, stored, exposed by `attr_reader`, delegated) — a class whose superclass or mixin lies outside the repository is not judged — and a blockless creation read through and dropped (`File.open(path).read`) or held in a local that is never closed, returned, passed or stored (a `&:read` block-pass, an `autoclose: false` borrow and a `fileno` hand-over are not abandonment). PHP is read for the same two arms: a class (not a trait, and not one using a trait) declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose `private` property (or a `final` class's `protected` one) is written only with a direct core `fopen`, `tmpfile`, `popen`, `proc_open`, `fsockopen`, `stream_socket_client`/`server` or `opendir` that nothing in the class closes (`fclose`, `pclose`, `closedir`, `unset`, a reset to `null`) and that is never handed on, and a handle held in a function's local, or read through as the argument of a reader, that is never closed, returned, passed, captured or stored; a `php://` stream, `curl_init`, `SplFileObject`, `PDO` and a function the repository declares under the core name are not read. Deterministic, provable per finding. Advisory.

  • `Source.fromFile(…)` opens something that has to be given back — a file descriptor, a socket, a directory handle — and its only use reads `.getLines` through it and drops it, so this expression both creates the value and is the last place that can release it, and does not. Every call leaks one more open handle until the collector happens to reach it: `Too many open files` under load, and on Windows a file that cannot be replaced or deleted while it is held. Open it with `scala.util.Using.resource(Source.fromFile(…)) { r => … }`, which releases it on every path including a throw, or hold it and call `.close()` in a `finally`. (×2) — tools/workload/tpcds-delta/run_tpcds/tpcds_delta.scala:92, tools/workload/tpcds/run_tpcds/tpcds_parquet.scala:118
  • `Files.walk(…)` opens something that has to be given back — a file descriptor, a socket, a directory handle — and its only use reads `.iterator` through it and drops it, so this expression both creates the value and is the last place that can release it, and does not. Every call leaks one more open handle until the collector happens to reach it: `Too many open files` under load, and on Windows a file that cannot be replaced or deleted while it is held. Open it with `scala.util.Using.resource(Files.walk(…)) { r => … }`, which releases it on every path including a throw, or hold it and call `.close()` in a `finally`. (×2) — backends-velox/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:231, backends-bolt/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:227

What to do

  • Each finding names the value and the span that decides who owns it — the `new` that created it, or the constructor parameter that handed it over. Confirm ownership from that span, then make the disposal match it: release what this type created, leave what it was injected with to whoever created THAT, and drop a finalizer whose type holds nothing unmanaged to release.
X19 · Unrestored process-global state10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a method that temporarily changes state belonging to the whole process — the working directory, an environment variable — puts it back on EVERY path: a restore reached only when nothing throws leaks the change to the rest of the process.

Method: Roslyn syntax + semantics: method bodies that write the process working directory or an environment variable and write it back in the same body, checked for whether that restore sits in a `finally`/`catch` or only on the straight-line path. On a repository with no .NET source the same rule reads production JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not): `process.chdir`, `process.env.NAME =`/`["NAME"] =` and `delete process.env.NAME`, and Deno’s `Deno.chdir`/`Deno.env.set`/`Deno.env.delete`, paired per function body (a nested function or arrow is its own body, and module top-level code is none), where the last write puts back a local the body captured from the same global or deletes a variable the first write set, with at least one statement between them; a write in a `catch`/`finally` of that body silences it. Deterministic, provable per finding. Advisory.

X20 · Mistyped argument guard10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether an argument guard throws the exception its own condition describes — a guard that rejects a value for being EMPTY and reports it as `NullPointerException` (Java, Kotlin, Scala), `ArgumentError.notNull` (Dart) or `ArgumentNullException` (F#'s `nullArg`) tells the caller a parameter was null when it provably was not.

Method: Roslyn syntax: `throw new ArgumentNullException(nameof(p))` statements controlled by an `if`, whose condition is read for a test that is true of a NON-null `p` — an emptiness test that dereferences it (`p.Count == 0`, `!p.Any()`) or a BCL predicate documented true of the empty value (`string.IsNullOrEmpty(p)`). Deterministic, provable per finding. Advisory.

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.

X22 · Contradicted release guard10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a method that TAKES a lock or semaphore and gives it back from a flag-guarded `finally` returns the value that flag implies — reporting success while the guard hands the primitive back admits a second caller the exclusion was there to keep out, and reporting failure while the guard keeps it leaves nothing to ever give it back.

Method: Roslyn syntax: `try` statements whose `finally` releases a synchronisation primitive under a bare local-bool guard, where the method also TOOK that same primitive before the `try`, checked for a `return` of a bool literal whose value disagrees with the flag state the method's own straight-line assignments put it in. Deterministic, provable per finding. Advisory.

X23 · Unguarded diagnostic materialisation5.1 / 10Adequate✓ Tool-verified

Other · Code Health — Whether the work a diagnostic log line costs is paid only when that line is wanted — C# evaluates a call's arguments BEFORE the call, so a trace/debug message joined or projected out of a collection is built in full on every pass, and then discarded by a sink the shipped configuration leaves switched off.

Method: Roslyn syntax: log calls at a diagnostic level (a `Log`-prefixed method naming Trace/Debug/Verbose, or a bare `Debug`/`Trace`/`Verbose` on a receiver named for a logger), whose argument list is read for a call whose cost scales with a sequence — a LINQ operator, a materialisation, `string.Join`, a serializer — with no enclosing level check or conditional-compilation region. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `debug`/`trace`/`verbose` call on a receiver named for a logger, or a `log`-prefixed method naming the level, whose argument calls an array operator (`map`/`filter`/`reduce`/`sort`/…), `Array.from`, `Object.keys/values/entries`, `JSON.stringify`/`util.inspect` over anything but a literal, or an array `join` — outside any arrow or function passed as an argument, which the logger calls only when the level is on — with no enclosing `if`, `&&` or `?:` whose condition names a level, a level string, or the `NODE_ENV`/`__DEV__`/`DEV` build switch. Deterministic, provable per finding. Advisory.

  • `debug` at line 140 is called with an argument built by `Serde.toJson(mockInput)` (line 140), whose cost grows with the collection it walks. Java evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isDebugEnabled`/`isTraceEnabled` test, no debug flag, no lambda or `Supplier` the logger calls only when the level is on. — gluten-flink/runtime/src/main/java/org/apache/gluten/table/runtime/operators/GlutenOneInputOperator.java:140
  • `debug` at line 55 is called with an argument built by `Serde.toJson(getOperator().getPlanNode())` (line 55), whose cost grows with the collection it walks. Java evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isDebugEnabled`/`isTraceEnabled` test, no debug flag, no lambda or `Supplier` the logger calls only when the level is on. — gluten-flink/runtime/src/main/java/org/apache/gluten/streaming/api/operators/GlutenOneInputOperatorFactory.java:55
  • `debug` at line 56 is called with an argument built by `Serde.toJson(getOperator().getPlanNode())` (line 56), whose cost grows with the collection it walks. Java evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isDebugEnabled`/`isTraceEnabled` test, no debug flag, no lambda or `Supplier` the logger calls only when the level is on. — gluten-flink/runtime/src/main/java/org/apache/gluten/streaming/api/operators/GlutenTwoInputOperatorFactory.java:56

What to do

  • In Java, put the construction behind the logger's own check (`if (log.isDebugEnabled())` for SLF4J and Log4j, `if (logger.isLoggable(Level.FINE))` for java.util.logging), or hand the logger a lambda it calls only when the level is on (Log4j 2's `Supplier` overloads, SLF4J 2's `log.atDebug().addArgument(() -> …)`). A `{}` placeholder alone is not the fix: it defers the formatting, not the stream, join or serialisation in the argument.
X24 · Document value interpolated into markup unescaped10.0 / 10Exemplary○ Nothing flagged

Other · Security — Whether text read out of the document being converted is escaped before it is written into generated markup — a value the document's author chose, interpolated into an attribute the surrounding literal delimits, can close that attribute and open another.

Method: Roslyn semantic model over the whole compilation: a string-typed `Value`/`InnerText`/`InnerXml`/`Text` member declared inside `DocumentFormat.OpenXml` or `System.Xml` is a taint SOURCE, propagated through assignments, returns, arguments, tuple elements and string composition to its transitive closure, then read at interpolated-string holes that sit in a markup position the surrounding literal itself delimits. Escaper/encoder calls and enclosing validator conditions cut the flow. Flow- and container-insensitive by construction. A second arm needs no provenance at all and reports a type that CONTRADICTS ITSELF — the same expression escaped at one delimited markup hole and interpolated raw at another hole in the same markup position of the same type, which the type's own escaping proves is a defect without knowing where the value came from. On a repository with no .NET source it reads JavaScript/TypeScript off the token stream with the same rule: a DOM read of raw document text (`getAttribute`, `textContent`, `innerText`, `nodeValue`) is the source, propagated through local bindings and string composition, and judged at template-literal and concatenation holes in the same two delimited markup positions; escapers and validating conditions cut it, and documentation-site, test, vendored and minified scripts are not read. Deterministic, provable per finding. Advisory.

X25 · Inert configuration knob10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a value the caller is invited to supply is the value the type actually uses — a constructor parameter stored in a private field that nothing ever reads while the default it was given is spelled out a second time at the site that should have read it, a keyed lookup that falls back to a different setting than the one its key names while the same type falls back to the matching one for that same key, or a culture-sensitive parse given no format provider by a type that feeds its own settable culture to the same kind of parse elsewhere, or a number an entry point writes to standard output under the host's culture while the same entry point formats with the invariant culture elsewhere. Either way, every caller who supplies a value silently gets something else.

Method: Roslyn syntax: private instance fields of a non-partial type assigned in a constructor from one of its own parameters with a `??` fallback, checked for whether anything in the type body reads the field and whether that same fallback expression is spelled out again outside the constructor; and `??` fallbacks onto a member access from a lookup call carrying exactly one string literal, grouped by that key across the type and checked for a fallback member whose folded name disagrees with the key while a sibling site for the same key agrees with it. On a repository with no .NET source the first two arms read JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `#x`, `private` or `private` parameter-property instance field filled in the constructor from a parameter (or one member of one) through `??`/`||` or a parameter default, never read anywhere in the file by name, whose constructed default is spelled again in the class body; and `lookup("key") ?? s.member` grouped by key per class, or per module outside every class. The culture arm has no JavaScript counterpart: its parses take no locale. Deterministic, provable per finding. Advisory.

X26 · Unsynchronised callback handoff10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a value handed from a callback to the body that waits on it crosses on something built to be crossed — a `Queue<T>`/`List<T>`/`Dictionary<K,V>` written inside an event handler and read back outside it is mutated by two flows at once, and the semaphore or completion source beside it orders how MANY items exist while leaving the collection's own head, tail and backing array unprotected.

Method: Roslyn syntax: method, accessor, local-function and lambda bodies that declare BOTH a non-thread-safe generic collection (`Queue`/`Stack`/`List`/`Dictionary`/`HashSet`/`Sorted*`/`LinkedList`) and a synchronisation primitive (`SemaphoreSlim`/`TaskCompletionSource`/`ManualResetEvent(Slim)`/`AutoResetEvent`/`CountdownEvent`) as locals, then read for a `+=`-registered lambda that raises that primitive while the body outside every lambda waits on it — and, in that scope, a mutating call on the collection inside the lambda paired with a mention of it outside. Any `lock` in the scope abstains it. On a repository with no .NET source the same handoff is read in Java off the engine’s own token stream (test source sets, vendored and demonstration paths not): an `ArrayList`/`LinkedList`/`ArrayDeque`/`PriorityQueue`/`Hash*`/`LinkedHash*`/`Tree*` local and a `CountDownLatch`/`Semaphore`/`CompletableFuture` local, a lambda or anonymous class that raises the primitive and mutates the collection, and a wait outside it; any `synchronized` or `lock()` abstains the body. Because each of those primitives orders what the callback wrote before raising it, only a touch that provably overlaps the callback is convicted: one after the registration and before the next wait, or one in a loop registered-before, waiting on every pass and not declaring the collection. Deterministic, provable per finding. Advisory.

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

Other · Code Health — Whether an enhanced `for` leaves the collection it is walking alone — a body that adds to or removes from the very collection the loop is iterating invalidates the fail-fast iterator it is holding, so the next `next()` throws `ConcurrentModificationException` 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. Whether a `for` comprehension or `foreach` leaves the mutable collection it is walking alone — an `ArrayBuffer` or `ListBuffer` counts its changes and its iterator checks the count, an `ArrayDeque` (and `mutable.Queue`/`mutable.Stack`) is walked by index up to its starting length, and a `java.util` collection walked through `asScala` is fail-fast, so a body that adds to or removes from the very collection the loop is walking makes a later step throw `ConcurrentModificationException` (`IndexOutOfBoundsException` for a deque) and the remaining elements 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.

X3 · Exception handling6.9 / 10Adequate✓ Tool-verified

Other · Code Health — Whether exceptions are handled rather than silently swallowed or rethrown with lost stack traces.

Method: Roslyn syntax scan: every catch clause counted; empty catches and bare rethrows flagged. Population is all catch clauses, not estimated. Deterministic, hard fact.

  • An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it. (×4) — tools/scripts/gen-function-support-docs.py:943, backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:589, backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:619, …
  • `case _: Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. (×8) — gluten-substrait/src/main/scala/org/apache/gluten/extension/columnar/validator/Validators.scala:53, gluten-substrait/src/main/scala/org/apache/gluten/extension/columnar/validator/Validators.scala:245, gluten-arrow/src/main/scala/org/apache/spark/sql/utils/SparkArrowUtil.scala:176, …
  • `catch (Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. (×2) — gluten-flink/runtime/src/main/java/org/apache/gluten/util/ReflectUtils.java:48, gluten-flink/runtime/src/main/java/org/apache/gluten/table/runtime/metrics/SourceOperatorMetrics.java:57
  • `case _: Throwable` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. (×2) — backends-velox/src-iceberg/main/scala/org/apache/gluten/execution/VeloxIcebergWriteToDataSourceV2Exec.scala:64, backends-bolt/src-iceberg/main/scala/org/apache/gluten/execution/BoltIcebergWriteToDataSourceV2Exec.scala:64
  • `case NonFatal(_)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. (×2) — backends-velox/src/main/scala/org/apache/gluten/extension/ScanMapKeyPruning.scala:375, backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/DeltaLog.scala:514
  • `case _: RuntimeException` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — backends-bolt/src/main/scala/org/apache/gluten/utils/ParquetMetadataUtils.scala:126

What to do

  • Swallowed exception (empty catch)
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.

X4 · Structured logging5.0 / 10Adequate✓ Tool-verified

Other · Code Health — Whether log calls use message templates (queryable) rather than interpolated strings.

Method: Roslyn syntax scan: every log call-site counted; interpolated-string first-argument violations flagged. Population is all log calls, not estimated. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `trace`/`debug`/`info`/`warn`/`error`/`fatal`/`verbose`/`silly`/`http`/`log` call on a receiver named for a logger, in a package whose own or an enclosing `package.json` declares a logger that carries values as fields (pino, pino-http, nestjs-pino, Fastify, winston, bunyan, tslog, LogTape, roarr), whose first deciding argument is a template literal with substitutions; an object-literal fields argument is stepped over, a plain string message clears the call. Python is read the same way: a `debug`/`info`/`warning`/`error`/`exception`/`critical`/`log` call on a logger in a file that imports the standard library’s `logging` or structlog (loguru, which formats at the call, is not judged), whose message is a whole f-string with a non-constant field; a `%`-formatted, `.format()`-ed or concatenated message is not convicted, as in C#. PHP is read the same way: a PSR-3 level call (`emergency`…`debug`, `log`) on a logger (`$logger`, `$this->logger`, Laravel’s `Log::`, `logger()`, `\Drupal::logger()`) in a package whose `composer.json` requires a PSR-3 logger or a framework that hands one out (psr/log, Monolog, Laravel, Symfony, Drupal, CakePHP), or a file that imports one, whose message is a double-quoted string interpolating a variable; a single-quoted message clears the call, and `sprintf` or `.` concatenation is not convicted, as in C#. Dart is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on Sentry’s structured logger (`Sentry.logger`) whose message is a whole string literal interpolating a value (`$name`, `${…}`); the `Sentry.logger.fmt` template API clears the call. Dart that logs only through loggers with one message and no fields (package:logging, package:logger, talker, dart:developer) is not applicable rather than a reach gap. Ruby is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on the console gem’s `Console` (declared by a Gemfile, gemspec or Gemfile.lock, or required) or, where SemanticLogger, Ougai or dry-logger is declared or required, on a receiver named for a logger (`logger`, `@logger`, `Rails.logger`, `log`), whose first deciding argument is, as the whole argument, a double-quoted string interpolating a non-constant value (`#{…}`, `#@ivar`); a plain literal clears the call, keyword arguments are the fields, and a block, `%`-format or `+` concatenation is not convicted. Ruby that logs only through the standard Logger (Rails.logger) is not applicable rather than a reach gap. Deterministic.

  • `log` at line 893 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.log(logging.INFO, "order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — tools/scripts/gen-function-support-docs.py:893
  • `log` at line 1078 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.log(logging.INFO, "order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — tools/scripts/gen-function-support-docs.py:1078
  • `log` at line 1105 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.log(logging.INFO, "order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — tools/scripts/gen-function-support-docs.py:1105
  • `log` at line 1136 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.log(logging.INFO, "order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — tools/scripts/gen-function-support-docs.py:1136
  • `log` at line 1210 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.log(logging.INFO, "order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — tools/scripts/gen-function-support-docs.py:1210
  • `log` at line 1237 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.log(logging.INFO, "order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — tools/scripts/gen-function-support-docs.py:1237
  • `log` at line 1426 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.log(logging.INFO, "order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — tools/scripts/gen-function-support-docs.py:1426
  • `log` at line 1462 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.log(logging.INFO, "order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — tools/scripts/gen-function-support-docs.py:1462
  • `log` at line 1496 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.log(logging.INFO, "order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — tools/scripts/gen-function-support-docs.py:1496
  • `log` at line 1499 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.log(logging.INFO, "order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — tools/scripts/gen-function-support-docs.py:1499
  • `log` at line 1503 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.log(logging.INFO, "order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — tools/scripts/gen-function-support-docs.py:1503
  • `log` at line 1507 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.log(logging.INFO, "order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — tools/scripts/gen-function-support-docs.py:1507
  • `log` at line 1511 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.log(logging.INFO, "order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — tools/scripts/gen-function-support-docs.py:1511
  • `log` at line 1515 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.log(logging.INFO, "order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — tools/scripts/gen-function-support-docs.py:1515
  • `log` at line 1592 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.log(logging.INFO, "order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — tools/scripts/gen-function-support-docs.py:1592
  • `info` at line 63 is handed an interpolated string as its message through SLF4J, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.info("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. scala-logging's `LazyLogging` logger takes an `s"…"` message apart into that pattern at compile time, so switching to it is also a fix. — gluten-arrow/src/main/scala/org/apache/gluten/memory/NativeMemoryManager.scala:63
  • `warn` at line 194 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.warn("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — gluten-core/src/main/java/org/apache/gluten/memory/memtarget/DynamicOffHeapSizingMemoryTarget.java:194
  • `warn` at line 329 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.warn("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — gluten-core/src/main/java/org/apache/gluten/memory/memtarget/DynamicOffHeapSizingMemoryTarget.java:329
  • `warn` at line 370 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.warn("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — gluten-core/src/main/java/org/apache/gluten/memory/memtarget/DynamicOffHeapSizingMemoryTarget.java:370
  • `info` at line 410 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.info("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — gluten-core/src/main/java/org/apache/gluten/memory/memtarget/DynamicOffHeapSizingMemoryTarget.java:410
  • `info` at line 36 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.info("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — gluten-core/src/main/java/org/apache/gluten/memory/memtarget/LoggingMemoryTarget.java:36
  • `info` at line 47 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.info("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — gluten-core/src/main/java/org/apache/gluten/memory/memtarget/LoggingMemoryTarget.java:47
  • `warn` at line 101 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.warn("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — gluten-arrow/src/main/java/org/apache/gluten/memory/arrow/alloc/ArrowBufferAllocators.java:101
  • `warn` at line 107 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.warn("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — gluten-arrow/src/main/java/org/apache/gluten/memory/arrow/alloc/ArrowBufferAllocators.java:107
  • `info` at line 344 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.info("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — backends-bolt/src/main/java/org/apache/gluten/jni/BoltJniLibLoader.java:344

What to do

  • Interpolated log message defeats structured logging
X5 · Nullable reference types2.0 / 10Critical✓ Tool-verified

Other · Code Health — Whether Scala's null is held to the type system and not undermined by assertions — a file compiled with `-Yexplicit-nulls` is one where `String` excludes null and `String | Null` admits it, a file under WartRemover's `Null` wart or Scalafix's `DisableSyntax.noNulls` is one whose code cannot write `null` and must say `Option`, and each `.nn`, `import scala.language.unsafeNulls` or null-lint suppression is the author overruling that.

Method: Roslyn compiler-options scan: NullableContextOptions per project; null-forgiving (!) suppression density per 1k syntax nodes. Deterministic, adoption plus suppression penalty.

  • No build over this repository's 1002 Scala product file(s) passes `-Yexplicit-nulls`, enables WartRemover's `Null` wart or runs Scalafix's `DisableSyntax.noNulls`, so every reference type admits null and nothing reports a `null` written into the code or returned from a Java API — the first one to reach a method call is a `NullPointerException`. `Option` by convention is a habit no tool here holds the code to.

What to do

  • On Scala 3, add `-Yexplicit-nulls` to `scalacOptions` so `String` and `String | Null` mean different things, and type each Java API's result as nullable where it can return null; on Scala 2 (or as a first step), enable WartRemover's `Null` wart (`wartremoverErrors += Wart.Null`) or Scalafix's `DisableSyntax.noNulls = true` so the code holds absence in `Option`. Then pay the assertions down rather than adding to them: each `.nn` is a null the compiler could not rule out — wrap the Java value in `Option(…)` at the boundary, pattern-match on `null` once there, or change the API so the null cannot arrive; an `unsafeNulls` import switches the checking off for everything after it.

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 Health55%Adequate — gated by X5Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture63%Adequate — gated by AX8Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Maturity73%StrongSolid.
Readiness63%AdequateAcceptable, with room to improve.
Security46%Weak — gated by D29, D30, D31, D36Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Domain Modelling100%ExemplaryStrongest area.
Performance62%AdequateAcceptable, with room to improve.
Unscored — 1 check(s) recorded observations but carry no score

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

  • X10 Duplicated predicate — 25 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 — 66 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 — No web markup found — accessibility is not applicable to this repository.
  • AC2 Forms & labels — No web markup found — accessibility is not applicable to this repository.
  • AC3 Page structure — No web markup found — accessibility is not applicable to this repository.
  • AC4 Keyboard semantics — No web markup found — accessibility is not applicable to this repository.
  • AC5 ARIA correctness — No web markup found — accessibility is not applicable to this repository.
  • AC6 Visual & motion safety — No web markup found — accessibility is not applicable to this repository.
  • AC7 A11y enforcement — No web markup found — accessibility is not applicable to this repository.
  • AX1 Captive dependencies — Not applicable: this repository's Java 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; this repository's Scala 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.
  • AX2 Stateful singletons — No container singleton was found, so there is no shared instance for concurrent requests to race on. No class in this Java code is a Spring, JSR-330 or CDI singleton bean. 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. No class in this Scala code is a Play controller, a Cask routes object, a Scalatra servlet, a Finatra controller, an Akka/Pekko HTTP routes holder or a JSR-330/Spring singleton, so no instance is shared between request threads.
  • 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
  • AX7 Slice cohesion — not applicable — not a vertical-slice architecture
  • AX9 CQS / query purity — no CQRS query handlers detected — query purity is not applicable to this codebase
  • AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • AXR1 Runtime accessibility — docker build failed (exit 1) — 24 | # https://github.com/apache/gluten/issues/12412. 25 | 26 | >>> FROM almalinux:8 27 | 28 | ARG GLUTEN_REPO=https://github.com/apache/gluten -------------------- ERROR: failed to solve: almalinux:8: failed to resolve source metadata for docker.io/library/almalinux:8: failed to do request: Head "https://registry-1.docker.io/v2/library/almalinux/manifests/8": Forbidden; runtime evidence skipped This is a statement about this run, not a statement about your application: nothing here says the surface is inaccessible, only that it was never rendered.
  • C1 Data Protection — Not assessed: these personal data controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks personal data controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C2 Access Controls — Not assessed: these authorization controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks authorization controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C3 Audit Trail — No personal data detected in a persisted data model — no PII-named column (email, first_name, date_of_birth, phone_number, …) or stored credential on a Slick table or in a SQL migration's CREATE TABLE or ALTER TABLE — and no database client (Slick, Doobie, Quill, ScalikeJDBC, Anorm, Skunk, a MongoDB or Cassandra driver, JDBC) imported 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, firstName, dateOfBirth, phoneNumber, …) or stored credential on a Slick table or in a SQL migration's CREATE TABLE or ALTER TABLE — and no database or data-store client (Slick, Doobie, Quill, ScalikeJDBC, Anorm, Skunk, JDBC, MongoDB, Cassandra, …) imported 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, firstName, dateOfBirth, phoneNumber, …) or stored credential on a Slick table or in a SQL migration's CREATE TABLE or ALTER TABLE — and no database or data-store client (Slick, Doobie, Quill, ScalikeJDBC, Anorm, Skunk, JDBC, MongoDB, Cassandra, …) imported either, so this repository keeps no personal data for a data subject to erase, export or consent over.
  • D10 Test Quality — ~298417 lines of test source are present (.java, .scala) 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 — no .scala test runner
  • D12 Dependency Hygiene — Not scored — 41 Maven/Gradle manifest(s) were read, stating a version for 95 dependency(ies) and leaving 364 to a parent or an imported BOM, but no build resolved the dependency graph, so the outdated signal was not established. NOT a finding that these dependencies are current or healthy.
  • D14 License Compliance — Not scored — this repository's 95 declared JVM dependency coordinate(s) were read from its 41 Maven/Gradle manifest(s), but Maven Central could not be asked for the licence of 4 of them (HTTP 403 Forbidden from https://repo1.maven.org/maven2/org/scalacheck/scalacheck_${scala.binary.version}/1.17.0/scalacheck_${scala.binary.version}-1.17.0.pom), and a licence verdict over part of a dependency graph is not a licence verdict. Nothing is asserted about this repository's licensing in either direction.
  • 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.
  • D20 ADR Quality — N/A — ADRs are expected on deployable products with a user-facing host, not consumed libraries; no ADR log is required here.
  • D21 Naming Consistency — Naming consistency is measured on C# only; Java, Python, Scala not measured.
  • D22 Internal API Consistency — The exposed public-API surface could not be collected — no C#/VB projects loaded.
  • 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+ projects each declaring an entity of their own. 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# and Visual Basic comments only — this repository's production source is .java, .py, .scala, which was left unread. Not scored: this is a gap in the analyzer, not a verdict about this repository.
  • D25 ADR Conformance — no ADRs to check
  • D27 Navigability — D27 reads resolved call sites in the languages it reads only — this repository's production source is .cc, .cpp, .java, .py, which was left unread. Not scored: this is a gap in the analyzer, not a verdict about this repository.
  • D32 Data Compliance (PII/GDPR) — 2 file(s) were not parsed by semgrep — the PII/GDPR ruleset never ran over them
  • D37 Vulnerability-disclosure Policy — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
  • D39 IL Efficiency — D39 measures the IL emitted by a .NET build; this repository has no .NET solution or project files, so the dimension does not apply.
  • D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
  • D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
  • D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
  • D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
  • D8 Code Coverage — Coverage not included — suite not readable by the collector
  • DM1 Aggregate boundaries — no aggregates detected — aggregate-boundary check not applicable
  • DM10 One transaction, one aggregate — no repository writes detected — no operation to judge against the one-aggregate rule
  • DM11 Constructible invalid state — no entities detected — construction-time invariants not assessable
  • DM2 Strongly-typed ids — no id-bearing domain types detected — strongly-typed-id adoption not assessable
  • DM3 Integration-event coupling — no integration events detected — coupling check not applicable
  • DM4 Rich vs anemic model — no data-bearing entities detected — rich-vs-anemic model not assessable
  • DM5 Encapsulated state — no domain entities found — DM5 grades how entities protect their state, and this repository declares none
  • DM7 Repository granularity — no repository abstraction detected (e.g. uses a document session)
  • DM8 Value-object opportunities — not scored — the deterministic rule found 0 candidate clump(s); its rows are withheld until it has a measured precision of 95 % (a sample of fewer than 10 rows cannot show one)
  • ED1 Event-Driven — not scored — this repository shows none of the 3 signals this lens looks for
  • 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
  • M4 Documentation accuracy — Not applicable: the 79 current-state document(s) make no claim of a kind M4 checks. 193 claim(s) of kinds M4 does not check were not checked (path 60, command argument 49, environment variable 64, setting 18, cd 2); M4 checks only links and versions.
  • P12 CI test-gate honesty — Reported, not scored — and nothing was matched here. The coverage check applies to any stack, and the automatic-re-run check to any GitHub-Actions workflow, but the checks for excluded tests, skipped tests and sleep-based synchronisation currently recognise only some ecosystems' test-runner idioms, so on a repository built with another stack the zeros below mean 'not checked', not 'clean'.
  • P7 Outbound HTTP resilience — not applicable — no HTTP server, API framework or worker entry point was found in the JVM, Python source, so there is no service whose uptime a failing dependency could take down
  • P8 Schema migrations — SQLAlchemy is declared, but the schema-migration mechanism could not be identified. Our limit, not a verdict on this repository.
  • P9 Domain vs controller coverage — no coverage report found on disk — produce a coverage report in a standard format (`addSbtPlugin("org.scoverage" % "sbt-scoverage" % "<version>")` in `project/plugins.sbt`, then `sbt clean coverage test coverageReport`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures, or wire coverage collection into CI, to enable this cross-layer check
  • PF1 Benchmark discipline — Not applicable: no benchmark suite was found. This check searched for `@Benchmark` in a Java, Kotlin or Scala file importing JMH or kotlinx-benchmark, Jetpack Benchmark's `measureRepeated` in a file importing androidx.benchmark, or JMH/kotlinx-benchmark/androidx.benchmark in a REDACTED, Gradle or sbt build, and for a `*benchmark*` script that this repository's CI runs. Benchmarks are credited as a bonus, so their absence is neither scored nor deducted.
  • PF3 Async & latency hygiene — Not applicable: this repository declares no async functions, so there is no asynchronous code for a blocking call to stall.
  • S1 Web-Security Posture — Not assessed: these web-security controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks web-security controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • X2 Cancellation propagation — no C# was loaded; this repository's Scala, Java and Python were read, and no request in it can be cancelled by a caller — a Scala request takes no token: a Future cannot be cancelled, and cats-effect, ZIO and Monix interrupt the fiber that made the request from outside the call, not through a parameter; a Java request off Android takes no token: it is cancelled through the handle it returns (Future.cancel, Call.cancel, a Disposable), ambiently (io.grpc.Context) or by interrupting its thread, not through a parameter; 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
  • 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.
  • X6 Hand-rolled structured-format parsing — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • X7 Silent fallback defaults — 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 — 455 finding(s)
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • + 257 more in this group — see findings.md.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • + 25 more in this group — see findings.md.
D30 · Dependency Vulnerabilities · High CVE · ×25
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D31 · IaC & Container Security · High IaC · ×21
  • 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
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D35 · Change Coupling · Boundary-crossing change coupling · ×11
  • Boundary-crossing change coupling: CHIteratorApi.scala ↔ WholeStageZippedPartitionsRDD.scala backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHIteratorApi.scala:1 — `backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHIteratorApi.scala` (context backends-clickhouse) and `gluten-substrait/src/main/scala/org/apache/gluten/execution/WholeStageZippedPartitionsRDD.scala` (context gluten-substrait) sit in DIFFERENT parts of the tree yet change together 87% of the time (13 of the 15 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 13 shared commits counted here, the most recent 3 are `ec25cda1` [GLUTEN-11605][VL] Push dynamic filters down to ValueStream (#11657); `001a126f` [GLUTEN-10578] Remove `NUMA Binding` feature (#10579); `df7d62c2` [GLUTEN-8851][VL] GPU validate the plan and use runtime config to ena… — run `git show` on any of them.
  • Boundary-crossing change coupling: GlutenPlugin.scala ↔ BackendsApiManager.scala gluten-core/src/main/scala/org/apache/gluten/GlutenPlugin.scala:1 — `gluten-core/src/main/scala/org/apache/gluten/GlutenPlugin.scala` (context gluten-core) and `gluten-substrait/src/main/scala/org/apache/gluten/backendsapi/BackendsApiManager.scala` (context gluten-substrait) sit in DIFFERENT parts of the tree yet change together 82% of the time (9 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `92203a9d` [CORE] Query planner: Simplify validator `FallbackByNativeValidation`…; `1a0b9692` [CORE] Move driver/executor endpoint to CH backend (#5914) (at that commit the file was still `gluten-core/src/main/scala/org/apache/gluten/backendsapi/BackendsApiManager.scala`); `6dc7885f` [CORE] Move BackendBuildInfo case class from GlutenPlugin to Backend … (at that commit the files were still `gluten-core/src/main/scala/io/glutenproject/GlutenPlugin.scala` and `gluten-core/src/main/scala/io/glutenproject/backendsapi/BackendsApiManager.scala`) — run `git show` on any of them.
  • Boundary-crossing change coupling: VeloxIteratorApi.scala ↔ WholeStageZippedPartitionsRDD.scala backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxIteratorApi.scala:1 — `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxIteratorApi.scala` (context backends-velox) and `gluten-substrait/src/main/scala/org/apache/gluten/execution/WholeStageZippedPartitionsRDD.scala` (context gluten-substrait) sit in DIFFERENT parts of the tree yet change together 73% of the time (11 of the 15 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 11 shared commits counted here, the most recent 3 are `ec25cda1` [GLUTEN-11605][VL] Push dynamic filters down to ValueStream (#11657); `001a126f` [GLUTEN-10578] Remove `NUMA Binding` feature (#10579); `df7d62c2` [GLUTEN-8851][VL] GPU validate the plan and use runtime config to ena… — run `git show` on any of them.
  • Boundary-crossing change coupling: CHExpressionTransformer.scala ↔ SparkPlanExecApi.scala backends-clickhouse/src/main/scala/org/apache/gluten/expression/CHExpressionTransformer.scala:1 — `backends-clickhouse/src/main/scala/org/apache/gluten/expression/CHExpressionTransformer.scala` (context backends-clickhouse) and `gluten-substrait/src/main/scala/org/apache/gluten/backendsapi/SparkPlanExecApi.scala` (context gluten-substrait) sit in DIFFERENT parts of the tree yet change together 68% of the time (13 of the 19 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 13 shared commits counted here, the most recent 3 are `61e627b5` [GLUTEN-10781][VL] Add support for `months_between` function (#10782); `a305ba43` [GLUTEN-10397][VL] Add timestampadd support (#10400); `cd180f03` [GLUTEN-7116] [CH] support outer explode (#7207) — run `git show` on any of them.
  • Boundary-crossing change coupling: CHBackend.scala ↔ BackendsApiManager.scala backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHBackend.scala:1 — `backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHBackend.scala` (context backends-clickhouse) and `gluten-substrait/src/main/scala/org/apache/gluten/backendsapi/BackendsApiManager.scala` (context gluten-substrait) sit in DIFFERENT parts of the tree yet change together 64% of the time (7 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `92203a9d` [CORE] Query planner: Simplify validator `FallbackByNativeValidation`…; `1a0b9692` [CORE] Move driver/executor endpoint to CH backend (#5914) (at that commit the file was still `gluten-core/src/main/scala/org/apache/gluten/backendsapi/BackendsApiManager.scala`); `6dc7885f` [CORE] Move BackendBuildInfo case class from GlutenPlugin to Backend … (at that commit the files were still `backends-clickhouse/src/main/scala/io/glutenproject/backendsapi/clickhouse/CHBackend.scala` and `gluten-core/src/main/scala/io/glutenproject/backendsapi/BackendsApiManager.scala`) — run `git show` on any of them.
  • Boundary-crossing change coupling: VeloxBackend.scala ↔ BackendsApiManager.scala backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxBackend.scala:1 — `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxBackend.scala` (context backends-velox) and `gluten-substrait/src/main/scala/org/apache/gluten/backendsapi/BackendsApiManager.scala` (context gluten-substrait) sit in DIFFERENT parts of the tree yet change together 64% of the time (7 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `92203a9d` [CORE] Query planner: Simplify validator `FallbackByNativeValidation`…; `1a0b9692` [CORE] Move driver/executor endpoint to CH backend (#5914) (at that commit the file was still `gluten-core/src/main/scala/org/apache/gluten/backendsapi/BackendsApiManager.scala`); `6dc7885f` [CORE] Move BackendBuildInfo case class from GlutenPlugin to Backend … (at that commit the files were still `backends-velox/src/main/scala/io/glutenproject/backendsapi/velox/VeloxBackend.scala` and `gluten-core/src/main/scala/io/glutenproject/backendsapi/BackendsApiManager.scala`) — run `git show` on any of them.
  • Boundary-crossing change coupling: VeloxIntermediateData.scala ↔ ExpressionNames.scala backends-velox/src/main/scala/org/apache/gluten/utils/VeloxIntermediateData.scala:1 — `backends-velox/src/main/scala/org/apache/gluten/utils/VeloxIntermediateData.scala` (context backends-velox) and `shims/common/src/main/scala/org/apache/gluten/expression/ExpressionNames.scala` (context shims) sit in DIFFERENT parts of the tree yet 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 — 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) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `73a243c4` [VL] Support regr_sxy aggregate function (#5295); `7e5b4fc7` [VL] Support regr_intercept aggregate function (#5273); `5a11dd80` [VL] Support regr_slope aggregate function (#5216) — run `git show` on any of them.
  • Boundary-crossing change coupling: GlutenColumnarRule.scala ↔ TakeOrderedAndProjectExecTransformer.scala gluten-core/src/main/scala/org/apache/gluten/extension/GlutenColumnarRule.scala:1 — `gluten-core/src/main/scala/org/apache/gluten/extension/GlutenColumnarRule.scala` (context gluten-core) and `gluten-substrait/src/main/scala/org/apache/gluten/execution/TakeOrderedAndProjectExecTransformer.scala` (context gluten-substrait) sit in DIFFERENT parts of the tree yet change together 55% of the time (11 of the 20 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 11 shared commits counted here, the most recent 3 are `0220f458` [CORE] Fix limit with offset for Spark3.4 (#4607) (at that commit the files were still `gluten-core/src/main/scala/io/glutenproject/extension/ColumnarOverrides.scala` and `gluten-core/src/main/scala/io/glutenproject/execution/TakeOrderedAndProjectExecTransformer.scala`); `857872e3` [MINOR] Code refactor for ColumnarShuffleExchange constructing #3720 (at that commit the files were still `gluten-core/src/main/scala/io/glutenproject/extension/ColumnarOverrides.scala` and `gluten-core/src/main/scala/io/glutenproject/execution/TakeOrderedAndProjectExecTransformer.scala`); `c212c33d` [GLUTEN-1434] [CORE] Remove isAdaptiveContextOrTopParentExchange chec… (at that commit the files were still `gluten-core/src/main/scala/io/glutenproject/extension/ColumnarOverrides.scala` and `gluten-core/src/main/scala/io/glutenproject/execution/TakeOrderedAndProjectExecTransformer.scala`) — run `git show` on any of them.
  • Boundary-crossing change coupling: GlutenColumnarRule.scala ↔ GlutenFormatWriterInjectsBase.scala gluten-core/src/main/scala/org/apache/gluten/extension/GlutenColumnarRule.scala:1 — `gluten-core/src/main/scala/org/apache/gluten/extension/GlutenColumnarRule.scala` (context gluten-core) and `gluten-substrait/src/main/scala/org/apache/spark/sql/execution/datasources/GlutenFormatWriterInjectsBase.scala` (context gluten-substrait) sit in DIFFERENT parts of the tree yet change together 53% of the time (8 of the 15 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `dc4bc629` [VL] RAS: Add EnumeratedApplier to manage columnar rule applications … (at that commit the files were still `gluten-core/src/main/scala/org/apache/gluten/extension/ColumnarOverrides.scala` and `gluten-core/src/main/scala/org/apache/spark/sql/execution/datasources/GlutenFormatWriterInjectsBase.scala`); `fa0ebf57` [CORE] Add gen columnar shuffle exchange interface (#4712) (at that commit the files were still `gluten-core/src/main/scala/io/glutenproject/extension/ColumnarOverrides.scala` and `gluten-core/src/main/scala/org/apache/spark/sql/execution/datasources/GlutenFormatWriterInjectsBase.scala`); `b36d3e57` Improve rewrite spark plan rules framework (#4645) (at that commit the files were still `gluten-core/src/main/scala/io/glutenproject/extension/ColumnarOverrides.scala` and `gluten-core/src/main/scala/org/apache/spark/sql/execution/datasources/GlutenFormatWriterInjectsBase.scala`) — run `git show` on any of them.
  • Boundary-crossing change coupling: CHMetricsApi.scala ↔ VeloxMetricsApi.scala backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:1 — `backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala` (context backends-clickhouse) and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala` (context backends-velox) sit in DIFFERENT parts of the tree yet change together 53% of the time (17 of the 32 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 17 shared commits counted here, the most recent 3 are `fd0a3468` [VL] Report native metrics for TopNTransformer (#13116); `d2f81856` [GLUTEN-10761] Add iceberg write metrics (#10908); `736e71b3` [GLUTEN-10618][VL] Update input iterator metrics name to include more… — run `git show` on any of them.
  • Boundary-crossing change coupling: RewriteSparkPlanRulesManager.scala ↔ FallbackRules.scala gluten-core/src/main/scala/org/apache/gluten/extension/columnar/heuristic/RewriteSparkPlanRulesManager.scala:1 — `gluten-core/src/main/scala/org/apache/gluten/extension/columnar/heuristic/RewriteSparkPlanRulesManager.scala` (context gluten-core) and `gluten-substrait/src/main/scala/org/apache/gluten/extension/columnar/FallbackRules.scala` (context gluten-substrait) sit in DIFFERENT parts of the tree yet 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 — 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) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `f0d54412` [CORE] Consolidate RewriteSparkPlanRulesManager, AddFallbackTagRule, … (at that commit the file was still `gluten-substrait/src/main/scala/org/apache/gluten/extension/columnar/rewrite/RewriteSparkPlanRulesManager.scala`); `d589aa36` [CORE] Rename TransformHint to FallbackTag (#6254) (at that commit the files were still `gluten-core/src/main/scala/org/apache/gluten/extension/columnar/rewrite/RewriteSparkPlanRulesManager.scala` and `gluten-core/src/main/scala/org/apache/gluten/extension/columnar/FallbackTagRule.scala`); `b6776b69` [CORE] Rename isTransformable API to maybeTransformable (#6233) (at that commit the files were still `gluten-core/src/main/scala/org/apache/gluten/extension/columnar/rewrite/RewriteSparkPlanRulesManager.scala` and `gluten-core/src/main/scala/org/apache/gluten/extension/columnar/TransformHintRule.scala`) — run `git show` on any of them.
D30 · Dependency Vulnerabilities · Critical CVE · ×8
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D34 · Knowledge Freshness · Orphaned knowledge · ×7
  • Orphaned knowledge backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/DeltaLog.scala: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 backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/commands/VacuumCommand.scala: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 backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/Snapshot.scala: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 backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/commands/DMLWithDeletionVectorsHelper.scala: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 backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/execution/datasources/v2/clickhouse/ClickHouseSparkCatalog.scala: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 backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/commands/merge/MergeIntoMaterializeSource.scala: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 backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/execution/datasources/v1/clickhouse/MergeTreeFileFormatDataWriter.scala: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.
AX8 · Test isolation · Production project references a test project · ×6
  • Production project references a test project: gluten-ut-spark34 → gluten-ut-common (test-jar) — `gluten-ut-spark34` (production) references the test project `gluten-ut-common (test-jar)`. Production must never depend on test code — it pulls a unit-test framework and test fixtures into the shipped product and inverts the only correct direction (tests depend on production, never the reverse). Move any shared helper into a production support library, or invert the reference.
  • Production project references a test project: gluten-ut-spark35 → gluten-ut-common (test-jar) — `gluten-ut-spark35` (production) references the test project `gluten-ut-common (test-jar)`. Production must never depend on test code — it pulls a unit-test framework and test fixtures into the shipped product and inverts the only correct direction (tests depend on production, never the reverse). Move any shared helper into a production support library, or invert the reference.
  • Production project references a test project: gluten-ut-spark40 → gluten-ut-common (test-jar) — `gluten-ut-spark40` (production) references the test project `gluten-ut-common (test-jar)`. Production must never depend on test code — it pulls a unit-test framework and test fixtures into the shipped product and inverts the only correct direction (tests depend on production, never the reverse). Move any shared helper into a production support library, or invert the reference.
  • Production project references a test project: gluten-ut-spark41 → gluten-ut-common (test-jar) — `gluten-ut-spark41` (production) references the test project `gluten-ut-common (test-jar)`. Production must never depend on test code — it pulls a unit-test framework and test fixtures into the shipped product and inverts the only correct direction (tests depend on production, never the reverse). Move any shared helper into a production support library, or invert the reference.
  • Production project references a test project: gluten-ut-spark42 → gluten-ut-common (test-jar) — `gluten-ut-spark42` (production) references the test project `gluten-ut-common (test-jar)`. Production must never depend on test code — it pulls a unit-test framework and test fixtures into the shipped product and inverts the only correct direction (tests depend on production, never the reverse). Move any shared helper into a production support library, or invert the reference.
  • Production project references a test project: gluten-ut-test → gluten-ut-common (test-jar) — `gluten-ut-test` (production) references the test project `gluten-ut-common (test-jar)`. Production must never depend on test code — it pulls a unit-test framework and test fixtures into the shipped product and inverts the only correct direction (tests depend on production, never the reverse). Move any shared helper into a production support library, or invert the reference.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×2
  • REDACTED
  • REDACTED
D13 · Secret Scanning · Leaked secret · ×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
Serious — 1716 finding(s)
D17 · Explicit Debt · TodoComment · ×448
  • TodoComment tools/gluten-it/common/src/main/scala/org/apache/spark/sql/SparkQueryRunner.scala:108 — // TODO: sparkTracker and otherTracker include planning time information, — 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 shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1009 — // TODO: manage the memory used here, and spill it into disk in case of OOM. — 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 shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1009 — // TODO: manage the memory used here, and spill it into disk in case of OOM. — 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 shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1005 — // TODO: manage the memory used here, and spill it into disk in case of OOM. — 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 shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:995 — // TODO: manage the memory used here, and spill it into disk in case of OOM. — 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 shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:995 — // TODO: manage the memory used here, and spill it into disk in case of OOM. — 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 shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1023 — // TODO (SPARK-36284): Add shuffle checksum support for push-based shuffle
  • TodoComment shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1023 — // TODO (SPARK-36284): Add shuffle checksum support for push-based shuffle
  • TodoComment shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1019 — // TODO (SPARK-36284): Add shuffle checksum support for push-based shuffle
  • TodoComment shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1009 — // TODO (SPARK-36284): Add shuffle checksum support for push-based shuffle
  • TodoComment shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1009 — // TODO (SPARK-36284): Add shuffle checksum support for push-based shuffle
  • TodoComment shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1068 — // TODO: release the buf here to free memory earlier — 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 shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1068 — // TODO: release the buf here to free memory earlier — 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 shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1064 — // TODO: release the buf here to free memory earlier — 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 shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1051 — // TODO: release the buf here to free memory earlier — 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 shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1051 — // TODO: release the buf here to free memory earlier — 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 shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1296 — // TODO SPARK-36284 Add shuffle checksum support for push-based shuffle
  • TodoComment shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1296 — // TODO SPARK-36284 Add shuffle checksum support for push-based shuffle
  • TodoComment shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1292 — // TODO SPARK-36284 Add shuffle checksum support for push-based shuffle
  • TodoComment shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1277 — // TODO SPARK-36284 Add shuffle checksum support for push-based shuffle
  • TodoComment shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1277 — // TODO SPARK-36284 Add shuffle checksum support for push-based shuffle
  • TodoComment shims/spark42/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:75 — // TODO, fallback if user define same name column due to we can't right now — 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 shims/spark42/src/main/scala/org/apache/spark/sql/execution/datasources/v2/BatchScanExecShim.scala:70 — // TODO, fallback if user define same name column due to we can't right now — 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 shims/spark41/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:75 — // TODO, fallback if user define same name column due to we can't right now — 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 shims/spark41/src/main/scala/org/apache/spark/sql/execution/datasources/v2/BatchScanExecShim.scala:72 — // TODO, fallback if user define same name column due to we can't right now — 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.
  • + 423 more in this group — see findings.md.
D17 · Explicit Debt · FixmeComment · ×90
  • FixmeComment tools/gluten-it/common/src/main/scala/org/apache/spark/sql/SparkQueryRunner.scala:224 — // We have 50% chance to kill the task. FIXME make it configurable? — 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 shims/spark42/src/main/scala/org/apache/spark/sql/execution/datasources/v2/BatchScanExecShim.scala:134 — // FIXME(Spark 4.2, apache/gluten#13139): this collapsing is incorrect for Spark 4.2, which
  • FixmeComment shims/common/src/main/scala/org/apache/spark/sql/execution/datasources/BlockStripes.java:21 — // FIXME: The abstraction is broken: VL / CH don't rely on the same binary layout of — 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 gluten-ut/spark42/src/test/scala/org/apache/gluten/utils/velox/VeloxTestSettings.scala:470 — // FIXME: Array direct selection fails — 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 gluten-ut/spark42/src/test/scala/org/apache/gluten/utils/clickhouse/ClickHouseTestSettings.scala:1104 — // FIXME: Array direct selection fails — 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 gluten-ut/spark41/src/test/scala/org/apache/gluten/utils/velox/VeloxTestSettings.scala:438 — // FIXME: Array direct selection fails — 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 gluten-ut/spark41/src/test/scala/org/apache/gluten/utils/clickhouse/ClickHouseTestSettings.scala:1104 — // FIXME: Array direct selection fails — 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 gluten-ut/spark40/src/test/scala/org/apache/gluten/utils/velox/VeloxTestSettings.scala:464 — // FIXME: Array direct selection fails — 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 gluten-ut/spark40/src/test/scala/org/apache/gluten/utils/clickhouse/ClickHouseTestSettings.scala:1104 — // FIXME: Array direct selection fails — 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 gluten-ut/spark35/src/test/scala/org/apache/gluten/utils/clickhouse/ClickHouseTestSettings.scala:1143 — // FIXME: Array direct selection fails — 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 gluten-ut/spark42/src/test/scala/org/apache/gluten/utils/clickhouse/ClickHouseTestSettings.scala:736 — // FIXME: complex type result mismatch — 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 gluten-ut/spark41/src/test/scala/org/apache/gluten/utils/clickhouse/ClickHouseTestSettings.scala:736 — // FIXME: complex type result mismatch — 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 gluten-ut/spark40/src/test/scala/org/apache/gluten/utils/clickhouse/ClickHouseTestSettings.scala:736 — // FIXME: complex type result mismatch — 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 gluten-ut/spark35/src/test/scala/org/apache/gluten/utils/clickhouse/ClickHouseTestSettings.scala:761 — // FIXME: complex type result mismatch — 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 gluten-ut/spark35/src/test/scala/org/apache/gluten/utils/bolt/BoltTestSettings.scala:990 — // FIXME: complex type result mismatch — 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 gluten-ut/spark35/src/test/scala/org/apache/spark/sql/execution/adaptive/clickhouse/ClickHouseAdaptiveQueryExecSuite.scala:182 — // FIXME — 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 gluten-ut/spark35/src/test/scala/org/apache/spark/sql/execution/adaptive/clickhouse/ClickHouseAdaptiveQueryExecSuite.scala:252 — // FIXME — 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 gluten-ut/spark35/src/test/scala/org/apache/spark/sql/execution/adaptive/clickhouse/ClickHouseAdaptiveQueryExecSuite.scala:445 — // FIXME — 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 gluten-ut/spark35/src/test/scala/org/apache/spark/sql/execution/adaptive/clickhouse/ClickHouseAdaptiveQueryExecSuite.scala:604 — // FIXME — 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 gluten-ut/spark35/src/test/scala/org/apache/spark/sql/execution/adaptive/clickhouse/ClickHouseAdaptiveQueryExecSuite.scala:872 — // FIXME — 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 gluten-ut/spark35/src/test/scala/org/apache/spark/sql/execution/adaptive/clickhouse/ClickHouseAdaptiveQueryExecSuite.scala:1111 — // FIXME — 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 gluten-ut/spark35/src/test/scala/org/apache/spark/sql/execution/adaptive/clickhouse/ClickHouseAdaptiveQueryExecSuite.scala:1150 — // FIXME — 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 gluten-ut/spark35/src/test/scala/org/apache/spark/sql/execution/adaptive/clickhouse/ClickHouseAdaptiveQueryExecSuite.scala:1467 — // FIXME — 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 gluten-ut/spark34/src/test/scala/org/apache/spark/sql/GlutenSQLQueryTestSuite.scala:140 — // FIXME it's not needed to install Spark in testing since the following code only fetchs — 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 gluten-ut/common/src/test/scala/org/apache/gluten/utils/BackendTestUtils.scala:21 — // FIXME: We mixed the use of "Utils" and "Util" in utility class naming — 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.
  • + 65 more in this group — see findings.md.
D31 · IaC & Container Security · Medium IaC · ×79
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • + 54 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×34
  • Duplicated block (9 lines × 2) backends-bolt/src-celeborn/main/scala/org/apache/spark/shuffle/BoltCelebornColumnarShuffleWriter.scala:176 — backends-bolt/src-celeborn/main/scala/org/apache/spark/shuffle/BoltCelebornColumnarShuffleWriter.scala:176-184 | backends-velox/src-celeborn/main/scala/org/apache/spark/shuffle/VeloxCelebornColumnarShuffleWriter.scala:67-75 — 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 `backends-bolt/src-celeborn/main/scala/org/apache/spark/shuffle/BoltCelebornColumnarShuffleWriter.scala:176` 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, `backends-velox/src-celeborn/main/scala/org/apache/spark/shuffle/VeloxCelebornColumnarShuffleWriter.scala:76` calls `initShuffleWriter` and `backends-bolt/src-celeborn/main/scala/org/apache/spark/shuffle/BoltCelebornColumnarShuffleWriter.scala:185` 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 (9 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala:309 — backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala:309-317 | backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala:305-313 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 151 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 (9 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala:207 — backends-bolt/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala:207-215 | backends-velox/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala:211-219 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala` and `backends-velox/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 295 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/metrics/WriteFilesMetricsUpdater.scala:24 — backends-bolt/src/main/scala/org/apache/gluten/metrics/WriteFilesMetricsUpdater.scala:24-32 | backends-velox/src/main/scala/org/apache/gluten/metrics/WriteFilesMetricsUpdater.scala:24-32 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/metrics/WriteFilesMetricsUpdater.scala` and `backends-velox/src/main/scala/org/apache/gluten/metrics/WriteFilesMetricsUpdater.scala` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (9 lines × 2) backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:245 — backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:245-253 | backends-velox/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:348-356 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala` and `backends-velox/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 286 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 (9 lines × 2) backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:311 — backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:311-319 | backends-velox/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:418-426 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala` and `backends-velox/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 286 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 `backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:311` 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) backends-bolt/src/main/scala/org/apache/spark/sql/execution/BroadcastUtils.scala:207 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/BroadcastUtils.scala:207-215 | backends-velox/src/main/scala/org/apache/spark/sql/execution/BroadcastUtils.scala:261-269 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/BroadcastUtils.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/BroadcastUtils.scala` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 109 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 (9 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/execution/datasources/bolt/BoltParquetWriterInjects.scala:33 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/datasources/bolt/BoltParquetWriterInjects.scala:33-41 | backends-clickhouse/src/main/scala/org/apache/spark/sql/execution/datasources/v1/CHParquetWriterInjects.scala:34-42 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (9 lines × 2) backends-clickhouse/src/main/scala/org/apache/gluten/extension/CoalesceAggregationUnion.scala:665 — backends-clickhouse/src/main/scala/org/apache/gluten/extension/CoalesceAggregationUnion.scala:665-673 | backends-clickhouse/src/main/scala/org/apache/gluten/extension/CoalesceAggregationUnion.scala:1032-1040 — both copies are in the same file, so extract the 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 `backends-clickhouse/src/main/scala/org/apache/gluten/extension/CoalesceAggregationUnion.scala:665` 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) backends-clickhouse/src/main/scala/org/apache/gluten/extension/RewriteDateTimestampComparisonRule.scala:302 — backends-clickhouse/src/main/scala/org/apache/gluten/extension/RewriteDateTimestampComparisonRule.scala:302-310 | backends-clickhouse/src/main/scala/org/apache/gluten/extension/RewriteDateTimestampComparisonRule.scala:341-349 — both copies are in the same file, so extract the block into 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) backends-clickhouse/src/main/scala/org/apache/gluten/extension/RewriteDateTimestampComparisonRule.scala:315 — backends-clickhouse/src/main/scala/org/apache/gluten/extension/RewriteDateTimestampComparisonRule.scala:315-323 | backends-clickhouse/src/main/scala/org/apache/gluten/extension/RewriteDateTimestampComparisonRule.scala:328-336 — both copies are in the same file, so extract the block into 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) tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:347 — tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:347-355 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:412-420 — both copies are in the same file, so extract the block into 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) backends-bolt/src-celeborn/main/scala/org/apache/spark/shuffle/BoltCelebornColumnarBatchSerializer.scala:309 — backends-bolt/src-celeborn/main/scala/org/apache/spark/shuffle/BoltCelebornColumnarBatchSerializer.scala:309-317 | backends-velox/src-celeborn/main/scala/org/apache/spark/shuffle/VeloxCelebornColumnarBatchSerializer.scala:263-271 — before extracting anything, compare `backends-bolt/src-celeborn/main/scala/org/apache/spark/shuffle/BoltCelebornColumnarBatchSerializer.scala` and `backends-velox/src-celeborn/main/scala/org/apache/spark/shuffle/VeloxCelebornColumnarBatchSerializer.scala` as WHOLE FILES: this scan already matched 4 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.
  • Duplicated block (9 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala:269 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala:269-277 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxBackend.scala:277-285 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxBackend.scala` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 271 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala:269` 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) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:322 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:322-330 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala:347-355 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 498 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:322` 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) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:1179 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:1179-1187 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala:1616-1624 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 498 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltTransformerApi.scala:93 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltTransformerApi.scala:93-101 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxTransformerApi.scala:115-123 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltTransformerApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxTransformerApi.scala` as WHOLE FILES: 83% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltValidatorApi.scala:55 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltValidatorApi.scala:55-63 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxValidatorApi.scala:74-82 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (9 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialGenerateExec.scala:120 — backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialGenerateExec.scala:120-128 | backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarPartialGenerateExec.scala:119-127 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialGenerateExec.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarPartialGenerateExec.scala` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 122 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/extension/PartialProjectRule.scala:52 — backends-bolt/src/main/scala/org/apache/gluten/extension/PartialProjectRule.scala:52-60 | backends-velox/src/main/scala/org/apache/gluten/extension/PartialProjectRule.scala:52-60 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/extension/PartialProjectRule.scala` and `backends-velox/src/main/scala/org/apache/gluten/extension/PartialProjectRule.scala` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:540 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:540-548 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:780-788 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:110 — backends-bolt/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:110-118 | backends-velox/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:114-122 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 204 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 `backends-bolt/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:110` 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) backends-bolt/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:226 — backends-bolt/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:226-234 | backends-velox/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:230-238 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 204 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 `backends-bolt/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:226` 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) backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHWindowGroupLimitExecTransformer.scala:59 — backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHWindowGroupLimitExecTransformer.scala:59-67 | gluten-substrait/src/main/scala/org/apache/gluten/execution/WindowGroupLimitExecTransformer.scala:57-65 — before extracting anything, compare `backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHWindowGroupLimitExecTransformer.scala` and `gluten-substrait/src/main/scala/org/apache/gluten/execution/WindowGroupLimitExecTransformer.scala` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 119 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 2) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:154 — backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:154-162 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:148-156 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala` and `backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 385 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.
  • + 9 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (10 lines × 2) · ×33
  • Duplicated block (10 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:89 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:89-98 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala:94-103 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 498 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 (10 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:194 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:194-203 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala:206-215 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 498 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 (10 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:1103 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:1103-1112 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala:1467-1476 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 498 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:1103` 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) backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:303 — backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:303-312 | backends-velox/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:311-320 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 337 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 `backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:303` 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) backends-bolt/src/main/scala/org/apache/spark/sql/execution/BoltColumnarWriteFilesExec.scala:100 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/BoltColumnarWriteFilesExec.scala:100-109 | backends-velox/src/main/scala/org/apache/spark/sql/execution/VeloxColumnarWriteFilesExec.scala:101-110 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/BoltColumnarWriteFilesExec.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/VeloxColumnarWriteFilesExec.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 148 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 `backends-bolt/src/main/scala/org/apache/spark/sql/execution/BoltColumnarWriteFilesExec.scala:100` 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) backends-bolt/src/main/scala/org/apache/spark/sql/execution/BoltColumnarWriteFilesExec.scala:167 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/BoltColumnarWriteFilesExec.scala:167-176 | backends-velox/src/main/scala/org/apache/spark/sql/execution/VeloxColumnarWriteFilesExec.scala:172-181 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/BoltColumnarWriteFilesExec.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/VeloxColumnarWriteFilesExec.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 148 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 (10 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/execution/BroadcastUtils.scala:99 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/BroadcastUtils.scala:99-108 | backends-velox/src/main/scala/org/apache/spark/sql/execution/BroadcastUtils.scala:99-108 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/BroadcastUtils.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/BroadcastUtils.scala` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 109 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 `backends-bolt/src/main/scala/org/apache/spark/sql/execution/BroadcastUtils.scala:99` 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) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:209 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:209-218 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:354-363 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:766 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:766-775 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:1116-1125 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 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 `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:766` 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) backends-bolt/src/main/scala/org/apache/spark/sql/execution/SparkWriteFilesCommitProtocol.scala:95 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/SparkWriteFilesCommitProtocol.scala:95-104 | backends-velox/src/main/scala/org/apache/spark/sql/execution/SparkWriteFilesCommitProtocol.scala:99-108 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/SparkWriteFilesCommitProtocol.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/SparkWriteFilesCommitProtocol.scala` as WHOLE FILES: 93% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (10 lines × 2) backends-clickhouse/src/main/scala/org/apache/gluten/extension/EliminateDeduplicateAggregateWithAnyJoin.scala:52 — backends-clickhouse/src/main/scala/org/apache/gluten/extension/EliminateDeduplicateAggregateWithAnyJoin.scala:52-61 | backends-clickhouse/src/main/scala/org/apache/gluten/extension/EliminateDeduplicateAggregateWithAnyJoin.scala:76-85 — both copies are in the same file, so extract the 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 `backends-clickhouse/src/main/scala/org/apache/gluten/extension/EliminateDeduplicateAggregateWithAnyJoin.scala:52` 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) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:602 — backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:602-611 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:572-581 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala` and `backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 385 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 (10 lines × 2) backends-velox/src/main/scala/org/apache/gluten/execution/VeloxLocalTableScanTransformer.scala:56 — backends-velox/src/main/scala/org/apache/gluten/execution/VeloxLocalTableScanTransformer.scala:56-65 | backends-velox/src/main/scala/org/apache/gluten/execution/VeloxRDDScanTransformer.scala:62-71 — 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 before the matched lines, `backends-velox/src/main/scala/org/apache/gluten/execution/VeloxRDDScanTransformer.scala:60` calls `failed` and `backends-velox/src/main/scala/org/apache/gluten/execution/VeloxLocalTableScanTransformer.scala:55` 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 × 2) gluten-substrait/src/main/scala/org/apache/gluten/execution/JoinExecTransformer.scala:296 — gluten-substrait/src/main/scala/org/apache/gluten/execution/JoinExecTransformer.scala:296-305 | gluten-substrait/src/main/scala/org/apache/gluten/execution/SortMergeJoinExecTransformer.scala:130-139 — 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 `gluten-substrait/src/main/scala/org/apache/gluten/execution/JoinExecTransformer.scala:296` 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) tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/metrics/PlanMetric.scala:85 — tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/metrics/PlanMetric.scala:85-94 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/metrics/PlanMetric.scala:138-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. Read the line range as the matched WINDOW rather than a finished unit: at `tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/metrics/PlanMetric.scala:85` 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) backends-bolt/src-hudi/main/scala/org/apache/gluten/component/BoltHudiComponent.scala:36 — backends-bolt/src-hudi/main/scala/org/apache/gluten/component/BoltHudiComponent.scala:36-45 | backends-velox/src-hudi/main/scala/org/apache/gluten/component/VeloxHudiComponent.scala:37-46 — before extracting anything, compare `backends-bolt/src-hudi/main/scala/org/apache/gluten/component/BoltHudiComponent.scala` and `backends-velox/src-hudi/main/scala/org/apache/gluten/component/VeloxHudiComponent.scala` as WHOLE FILES: 89% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 2) backends-bolt/src-iceberg/main/scala/org/apache/iceberg/transforms/IcebergTransformUtil.scala:57 — backends-bolt/src-iceberg/main/scala/org/apache/iceberg/transforms/IcebergTransformUtil.scala:57-66 | backends-velox/src-iceberg/main/scala/org/apache/iceberg/transforms/IcebergTransformUtil.scala:57-66 — before extracting anything, compare `backends-bolt/src-iceberg/main/scala/org/apache/iceberg/transforms/IcebergTransformUtil.scala` and `backends-velox/src-iceberg/main/scala/org/apache/iceberg/transforms/IcebergTransformUtil.scala` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 32 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 2) backends-bolt/src-paimon/main/scala/org/apache/gluten/component/BoltPaimonComponent.scala:37 — backends-bolt/src-paimon/main/scala/org/apache/gluten/component/BoltPaimonComponent.scala:37-46 | backends-velox/src-paimon/main/scala/org/apache/gluten/component/VeloxPaimonComponent.scala:38-47 — before extracting anything, compare `backends-bolt/src-paimon/main/scala/org/apache/gluten/component/BoltPaimonComponent.scala` and `backends-velox/src-paimon/main/scala/org/apache/gluten/component/VeloxPaimonComponent.scala` as WHOLE FILES: 89% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala:257 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala:257-266 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxBackend.scala:265-274 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxBackend.scala` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 271 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:923 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:923-932 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala:1316-1325 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 498 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:923` 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) backends-bolt/src/main/scala/org/apache/gluten/extension/BloomFilterMightContainJointRewriteRule.scala:33 — backends-bolt/src/main/scala/org/apache/gluten/extension/BloomFilterMightContainJointRewriteRule.scala:33-42 | backends-velox/src/main/scala/org/apache/gluten/extension/BloomFilterMightContainJointRewriteRule.scala:33-42 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/extension/BloomFilterMightContainJointRewriteRule.scala` and `backends-velox/src/main/scala/org/apache/gluten/extension/BloomFilterMightContainJointRewriteRule.scala` as WHOLE FILES: 94% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/extension/RewriteUnboundedWindow.scala:73 — backends-bolt/src/main/scala/org/apache/gluten/extension/RewriteUnboundedWindow.scala:73-82 | backends-velox/src/main/scala/org/apache/gluten/extension/RewriteUnboundedWindow.scala:73-82 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/extension/RewriteUnboundedWindow.scala` and `backends-velox/src/main/scala/org/apache/gluten/extension/RewriteUnboundedWindow.scala` as WHOLE FILES: 92% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/utils/BoltIntermediateData.scala:142 — backends-bolt/src/main/scala/org/apache/gluten/utils/BoltIntermediateData.scala:142-151 | backends-velox/src/main/scala/org/apache/gluten/utils/VeloxIntermediateData.scala:142-151 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (10 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:460 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:460-469 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:623-632 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:172 — backends-bolt/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:172-181 | backends-velox/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:176-185 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 204 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 `backends-bolt/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:172` 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.
  • + 8 more in this group — see findings.md.
D4 · Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) · ×30
  • Members sharing a duplicated core (5 members, 50+ identical tokens) shims/spark34/src/main/scala/org/apache/gluten/sql/shims/spark34/Spark34Shims.scala:57 — shims/spark34/src/main/scala/org/apache/gluten/sql/shims/spark34/Spark34Shims.scala:57-68 | shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala:61-73 | shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala:67-83 | shims/spark41/src/main/scala/org/apache/gluten/sql/shims/spark41/Spark41Shims.scala:66-82 | shims/spark42/src/main/scala/org/apache/gluten/sql/shims/spark42/Spark42Shims.scala:66-82 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) shims/spark34/src/main/scala/org/apache/gluten/sql/shims/spark34/Spark34Shims.scala:364 — shims/spark34/src/main/scala/org/apache/gluten/sql/shims/spark34/Spark34Shims.scala:364-385 | shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala:421-442 | shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala:495-516 | shims/spark41/src/main/scala/org/apache/gluten/sql/shims/spark41/Spark41Shims.scala:522-543 | shims/spark42/src/main/scala/org/apache/gluten/sql/shims/spark42/Spark42Shims.scala:468-489 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) shims/spark34/src/main/scala/org/apache/spark/ShuffleUtils.scala:28 — shims/spark34/src/main/scala/org/apache/spark/ShuffleUtils.scala:28-47 | shims/spark35/src/main/scala/org/apache/spark/ShuffleUtils.scala:28-47 | shims/spark40/src/main/scala/org/apache/spark/ShuffleUtils.scala:28-47 | shims/spark41/src/main/scala/org/apache/spark/ShuffleUtils.scala:28-47 | shims/spark42/src/main/scala/org/apache/spark/ShuffleUtils.scala:28-47 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) shims/spark34/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:116 — shims/spark34/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:116-139 | shims/spark35/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:114-137 | shims/spark40/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:114-137 | shims/spark41/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:114-137 | shims/spark42/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:114-137 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) shims/spark34/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:141 — shims/spark34/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:141-163 | shims/spark35/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:139-161 | shims/spark40/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:139-161 | shims/spark41/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:139-161 | shims/spark42/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:139-161 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) shims/spark34/src/main/scala/org/apache/spark/sql/execution/ExpandOutputPartitioningShim.scala:68 — shims/spark34/src/main/scala/org/apache/spark/sql/execution/ExpandOutputPartitioningShim.scala:68-92 | shims/spark35/src/main/scala/org/apache/spark/sql/execution/ExpandOutputPartitioningShim.scala:68-92 | shims/spark40/src/main/scala/org/apache/spark/sql/execution/ExpandOutputPartitioningShim.scala:68-92 | shims/spark41/src/main/scala/org/apache/spark/sql/execution/ExpandOutputPartitioningShim.scala:68-92 | shims/spark42/src/main/scala/org/apache/spark/sql/execution/ExpandOutputPartitioningShim.scala:68-92 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) shims/spark34/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:83 — shims/spark34/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:83-96 | shims/spark35/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:80-93 | shims/spark40/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:91-104 | shims/spark41/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:90-103 | shims/spark42/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:90-103 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) shims/spark34/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:126 — shims/spark34/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:126-149 | shims/spark35/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:126-149 | shims/spark40/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:126-149 | shims/spark41/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:126-149 | shims/spark42/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:126-149 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) shims/spark34/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:159 — shims/spark34/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:159-176 | shims/spark35/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:159-176 | shims/spark40/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:159-176 | shims/spark41/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:159-176 | shims/spark42/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:159-176 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) shims/spark34/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:222 — shims/spark34/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:222-247 | shims/spark35/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:222-247 | shims/spark40/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:222-247 | shims/spark41/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:222-247 | shims/spark42/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:222-247 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:136 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:136-146 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:136-146 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:136-146 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:136-146 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:136-146 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:156 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:156-218 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:156-218 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:156-218 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:156-218 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:156-218 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:238 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:238-296 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:238-296 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:238-296 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:238-296 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:238-296 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:311 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:311-334 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:311-334 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:311-334 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:311-334 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:311-334 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:354 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:354-398 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:354-398 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:354-398 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:354-398 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:354-398 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:227 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:227-267 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:227-267 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:228-268 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:235-275 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:235-275 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:523 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:523-543 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:523-543 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:530-550 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:537-557 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:537-557 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:548 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:548-615 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:548-615 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:555-622 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:562-629 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:562-629 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:634 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:634-667 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:634-667 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:641-675 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:648-682 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:648-682 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:673 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:673-693 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:673-693 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:681-701 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:688-708 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:688-708 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:704 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:704-757 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:704-757 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:712-765 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:719-772 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:719-772 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:762 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:762-779 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:762-779 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:770-787 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:777-794 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:777-794 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:781 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:781-819 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:781-819 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:789-828 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:796-835 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:796-835 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:838 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:838-850 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:838-850 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:847-859 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:854-866 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:854-866 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:852 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:852-867 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:852-867 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:861-876 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:868-883 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:868-883 — 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.
  • + 5 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (11 lines × 2) · ×28
  • Duplicated block (11 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:500 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:500-510 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:514-524 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala` as WHOLE FILES: this scan already matched 35 separate duplicated blocks between them, totalling at least 485 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 (11 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/datasource/BoltDataSourceUtil.scala:44 — backends-bolt/src/main/scala/org/apache/gluten/datasource/BoltDataSourceUtil.scala:44-54 | backends-velox/src/main/scala/org/apache/gluten/datasource/VeloxDataSourceUtil.scala:44-54 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/datasource/BoltDataSourceUtil.scala` and `backends-velox/src/main/scala/org/apache/gluten/datasource/VeloxDataSourceUtil.scala` as WHOLE FILES: 93% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 `backends-bolt/src/main/scala/org/apache/gluten/datasource/BoltDataSourceUtil.scala: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 (11 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/BoltBroadcastNestedLoopJoinExecTransformer.scala:66 — backends-bolt/src/main/scala/org/apache/gluten/execution/BoltBroadcastNestedLoopJoinExecTransformer.scala:66-76 | backends-velox/src/main/scala/org/apache/gluten/execution/VeloxBroadcastNestedLoopJoinExecTransformer.scala:72-82 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/BoltBroadcastNestedLoopJoinExecTransformer.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/VeloxBroadcastNestedLoopJoinExecTransformer.scala` as WHOLE FILES: 95% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (11 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:114 — backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:114-124 | backends-velox/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:122-132 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 337 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 `backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:114` 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) backends-bolt/src/main/scala/org/apache/gluten/utils/ParquetMetadataUtils.scala:85 — backends-bolt/src/main/scala/org/apache/gluten/utils/ParquetMetadataUtils.scala:85-95 | backends-velox/src/main/scala/org/apache/gluten/utils/ParquetMetadataUtils.scala:113-123 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/utils/ParquetMetadataUtils.scala` and `backends-velox/src/main/scala/org/apache/gluten/utils/ParquetMetadataUtils.scala` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 117 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 (11 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/execution/BroadcastModeUtils.scala:74 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/BroadcastModeUtils.scala:74-84 | backends-velox/src/main/scala/org/apache/spark/sql/execution/BroadcastModeUtils.scala:74-84 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/BroadcastModeUtils.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/BroadcastModeUtils.scala` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 71 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 (11 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:626 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:626-636 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:877-887 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:888` calls `statsOrLegacySerializeInline` and `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:637` 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 (11 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:154 — backends-bolt/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:154-164 | backends-velox/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:158-168 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 204 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 (11 lines × 2) backends-clickhouse/src-celeborn/main/scala/org/apache/spark/shuffle/CHCelebornColumnarShuffleWriter.scala:62 — backends-clickhouse/src-celeborn/main/scala/org/apache/spark/shuffle/CHCelebornColumnarShuffleWriter.scala:62-72 | backends-clickhouse/src/main/scala/org/apache/spark/shuffle/CHColumnarShuffleWriter.scala:87-97 — 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) backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHBroadcastNestedLoopJoinExecTransformer.scala:55 — backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHBroadcastNestedLoopJoinExecTransformer.scala:55-65 | backends-velox/src/main/scala/org/apache/gluten/execution/HashJoinExecTransformer.scala:137-148 — 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) gluten-delta/src-delta33/main/scala/org/apache/gluten/execution/DeltaProjectExecTransformer.scala:81 — gluten-delta/src-delta33/main/scala/org/apache/gluten/execution/DeltaProjectExecTransformer.scala:81-91 | gluten-delta/src-delta4/main/scala/org/apache/gluten/execution/DeltaProjectExecTransformer.scala:81-91 — before extracting anything, compare `gluten-delta/src-delta33/main/scala/org/apache/gluten/execution/DeltaProjectExecTransformer.scala` and `gluten-delta/src-delta4/main/scala/org/apache/gluten/execution/DeltaProjectExecTransformer.scala` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (11 lines × 2) shims/spark41/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetFooterReaderShim.scala:32 — shims/spark41/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetFooterReaderShim.scala:32-42 | shims/spark42/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetFooterReaderShim.scala:32-42 — before extracting anything, compare `shims/spark41/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetFooterReaderShim.scala` and `shims/spark42/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetFooterReaderShim.scala` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 `shims/spark41/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetFooterReaderShim.scala:32` 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 lines × 2) backends-bolt/src-iceberg/main/scala/org/apache/iceberg/transforms/IcebergTransformUtil.scala:45 — backends-bolt/src-iceberg/main/scala/org/apache/iceberg/transforms/IcebergTransformUtil.scala:45-55 | backends-velox/src-iceberg/main/scala/org/apache/iceberg/transforms/IcebergTransformUtil.scala:45-55 — before extracting anything, compare `backends-bolt/src-iceberg/main/scala/org/apache/iceberg/transforms/IcebergTransformUtil.scala` and `backends-velox/src-iceberg/main/scala/org/apache/iceberg/transforms/IcebergTransformUtil.scala` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 32 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 (11 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala:507 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala:507-517 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxBackend.scala:502-516 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxBackend.scala` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 271 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala:505` calls `enableJoinKeysRewrite` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxBackend.scala: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.
  • Duplicated block (11 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:125 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:125-135 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala:130-140 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 498 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:125` 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 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/BoltColumnarToRowExec.scala:101 — backends-bolt/src/main/scala/org/apache/gluten/execution/BoltColumnarToRowExec.scala:101-111 | backends-velox/src/main/scala/org/apache/gluten/execution/VeloxColumnarToRowExec.scala:111-121 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/BoltColumnarToRowExec.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/VeloxColumnarToRowExec.scala` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 102 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 (11 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarRangeExec.scala:43 — backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarRangeExec.scala:43-53 | backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarRangeExec.scala:45-55 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarRangeExec.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarRangeExec.scala` as WHOLE FILES: 89% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (11 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala:76 — backends-bolt/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala:76-86 | backends-velox/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala:76-86 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 225 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 `backends-bolt/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala:76` 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 lines × 2) backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHBroadcastNestedLoopJoinExecTransformer.scala:85 — backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHBroadcastNestedLoopJoinExecTransformer.scala:85-95 | backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHHashJoinExecTransformer.scala:277-287 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (11 lines × 2) backends-clickhouse/src/main/scala/org/apache/gluten/parser/GlutenCacheFileSqlParserBase.scala:92 — backends-clickhouse/src/main/scala/org/apache/gluten/parser/GlutenCacheFileSqlParserBase.scala:92-102 | backends-clickhouse/src/main/scala/org/apache/gluten/parser/GlutenClickhouseSqlParserBase.scala:93-103 — before extracting anything, compare `backends-clickhouse/src/main/scala/org/apache/gluten/parser/GlutenCacheFileSqlParserBase.scala` and `backends-clickhouse/src/main/scala/org/apache/gluten/parser/GlutenClickhouseSqlParserBase.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 98 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) backends-clickhouse/src/main/scala/org/apache/gluten/parser/GlutenCacheFileSqlParserBase.scala:147 — backends-clickhouse/src/main/scala/org/apache/gluten/parser/GlutenCacheFileSqlParserBase.scala:147-157 | backends-clickhouse/src/main/scala/org/apache/gluten/parser/GlutenClickhouseSqlParserBase.scala:146-156 — before extracting anything, compare `backends-clickhouse/src/main/scala/org/apache/gluten/parser/GlutenCacheFileSqlParserBase.scala` and `backends-clickhouse/src/main/scala/org/apache/gluten/parser/GlutenClickhouseSqlParserBase.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 98 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) gluten-delta/src-delta33/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala:176 — gluten-delta/src-delta33/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala:176-186 | gluten-delta/src-delta4/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala:177-187 — before extracting anything, compare `gluten-delta/src-delta33/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala` and `gluten-delta/src-delta4/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 188 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 `gluten-delta/src-delta33/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala:176` 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 lines × 2) gluten-delta/src-delta33/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala:348 — gluten-delta/src-delta33/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala:348-358 | gluten-delta/src-delta4/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala:365-375 — before extracting anything, compare `gluten-delta/src-delta33/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala` and `gluten-delta/src-delta4/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 188 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 `gluten-delta/src-delta33/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala:348` 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 lines × 2) backends-bolt/src/main/java/org/apache/gluten/jni/BoltJniLibLoader.java:397 — backends-bolt/src/main/java/org/apache/gluten/jni/BoltJniLibLoader.java:397-407 | gluten-core/src/main/java/org/apache/gluten/jni/JniLibLoader.java:128-138 — 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 `backends-bolt/src/main/java/org/apache/gluten/jni/BoltJniLibLoader.java:397` 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. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (11 lines × 2) backends-clickhouse/src/main/java/org/apache/gluten/vectorized/LowCopyNettyShuffleInputStream.java:44 — backends-clickhouse/src/main/java/org/apache/gluten/vectorized/LowCopyNettyShuffleInputStream.java:44-54 | gluten-arrow/src/main/java/org/apache/gluten/vectorized/LowCopyNettyJniByteInputStream.java:66-76 — 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.
  • + 3 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (8 lines × 2) · ×26
  • Duplicated block (8 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:811 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:811-818 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:856-863 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala` as WHOLE FILES: this scan already matched 35 separate duplicated blocks between them, totalling at least 485 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:811` 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) backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala:299 — backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala:299-306 | backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala:295-302 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 151 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 (8 lines × 2) gluten-iceberg/src/main/scala/org/apache/gluten/execution/IcebergScanTransformer.scala:267 — gluten-iceberg/src/main/scala/org/apache/gluten/execution/IcebergScanTransformer.scala:267-274 | gluten-paimon/src-paimon/main/scala/org/apache/gluten/execution/PaimonScanTransformer.scala:205-212 — 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 (8 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala:279 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala:279-286 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxBackend.scala:287-294 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxBackend.scala` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 271 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) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:1153 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:1153-1160 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala:1590-1597 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 498 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:1153` 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) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltTransformerApi.scala:84 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltTransformerApi.scala:84-91 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxTransformerApi.scala:106-113 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltTransformerApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxTransformerApi.scala` as WHOLE FILES: 83% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltTransformerApi.scala:84` 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) backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:69 — backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:69-76 | backends-velox/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:77-84 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 337 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) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:163 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:163-170 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:234-241 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 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) backends-bolt/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:215 — backends-bolt/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:215-222 | backends-velox/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:219-226 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 204 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) backends-bolt/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:273 — backends-bolt/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:273-280 | backends-velox/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:277-284 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 204 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) backends-clickhouse/src/main/scala/org/apache/spark/sql/execution/commands/GlutenCacheFilesCommand.scala:189 — backends-clickhouse/src/main/scala/org/apache/spark/sql/execution/commands/GlutenCacheFilesCommand.scala:189-196 | gluten-substrait/src/main/scala/org/apache/spark/sql/hive/HivePartitionConverter.scala:65-72 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8 lines × 2) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:406 — backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:406-413 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:412-419 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala` and `backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 536 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 `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:406` 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) shims/spark41/src/main/scala/org/apache/gluten/sql/shims/spark41/Spark41Shims.scala:434 — shims/spark41/src/main/scala/org/apache/gluten/sql/shims/spark41/Spark41Shims.scala:434-441 | shims/spark42/src/main/scala/org/apache/gluten/sql/shims/spark42/Spark42Shims.scala:380-387 — before extracting anything, compare `shims/spark41/src/main/scala/org/apache/gluten/sql/shims/spark41/Spark41Shims.scala` and `shims/spark42/src/main/scala/org/apache/gluten/sql/shims/spark42/Spark42Shims.scala` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 170 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) gluten-flink/runtime/src/main/java/org/apache/gluten/table/runtime/operators/GlutenOneInputOperator.java:89 — gluten-flink/runtime/src/main/java/org/apache/gluten/table/runtime/operators/GlutenOneInputOperator.java:89-96 | gluten-flink/runtime/src/main/java/org/apache/gluten/table/runtime/operators/GlutenTwoInputOperator.java:102-109 — before extracting anything, compare `gluten-flink/runtime/src/main/java/org/apache/gluten/table/runtime/operators/GlutenOneInputOperator.java` and `gluten-flink/runtime/src/main/java/org/apache/gluten/table/runtime/operators/GlutenTwoInputOperator.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 45 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 `gluten-flink/runtime/src/main/java/org/apache/gluten/table/runtime/operators/GlutenOneInputOperator.java:89` 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) gluten-substrait/src/main/java/org/apache/gluten/substrait/rel/InputIteratorRelNode.java:89 — gluten-substrait/src/main/java/org/apache/gluten/substrait/rel/InputIteratorRelNode.java:89-96 | gluten-substrait/src/main/java/org/apache/gluten/substrait/rel/ReadRelNode.java:127-134 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (8 lines × 2) backends-bolt/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java:84 — backends-bolt/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java:84-91 | backends-velox/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java:84-91 — before extracting anything, compare `backends-bolt/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java` and `backends-velox/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java` as WHOLE FILES: this scan already matched 12 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. 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) backends-bolt/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java:116 — backends-bolt/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java:116-123 | backends-velox/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java:116-123 — before extracting anything, compare `backends-bolt/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java` and `backends-velox/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java` as WHOLE FILES: this scan already matched 12 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. 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) backends-bolt/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java:126 — backends-bolt/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java:126-133 | backends-velox/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java:126-133 — before extracting anything, compare `backends-bolt/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java` and `backends-velox/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java` as WHOLE FILES: this scan already matched 12 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. 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) backends-bolt/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java:218 — backends-bolt/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java:218-225 | backends-velox/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java:218-225 — before extracting anything, compare `backends-bolt/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java` and `backends-velox/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java` as WHOLE FILES: this scan already matched 12 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. 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) backends-bolt/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java:265 — backends-bolt/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java:265-272 | backends-velox/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java:265-272 — before extracting anything, compare `backends-bolt/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java` and `backends-velox/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java` as WHOLE FILES: this scan already matched 12 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. 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) backends-bolt/src/main/java/org/apache/gluten/utils/BoltBloomFilter.java:69 — backends-bolt/src/main/java/org/apache/gluten/utils/BoltBloomFilter.java:69-76 | backends-velox/src/main/java/org/apache/gluten/utils/VeloxBloomFilter.java:64-71 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8 lines × 2) gluten-flink/runtime/src/main/java/org/apache/gluten/table/runtime/operators/GlutenOneInputOperator.java:155 — gluten-flink/runtime/src/main/java/org/apache/gluten/table/runtime/operators/GlutenOneInputOperator.java:155-162 | gluten-flink/runtime/src/main/java/org/apache/gluten/table/runtime/operators/GlutenTwoInputOperator.java:129-136 — before extracting anything, compare `gluten-flink/runtime/src/main/java/org/apache/gluten/table/runtime/operators/GlutenOneInputOperator.java` and `gluten-flink/runtime/src/main/java/org/apache/gluten/table/runtime/operators/GlutenTwoInputOperator.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 45 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 2) backends-bolt/src/main/java/org/apache/gluten/columnarbatch/BoltColumnarBatches.java:93 — backends-bolt/src/main/java/org/apache/gluten/columnarbatch/BoltColumnarBatches.java:93-100 | backends-velox/src/main/java/org/apache/gluten/columnarbatch/VeloxColumnarBatches.java:93-100 — before extracting anything, compare `backends-bolt/src/main/java/org/apache/gluten/columnarbatch/BoltColumnarBatches.java` and `backends-velox/src/main/java/org/apache/gluten/columnarbatch/VeloxColumnarBatches.java` as WHOLE FILES: this scan already matched 3 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. 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 × 2) backends-bolt/src/main/java/org/apache/gluten/utils/BoltBloomFilter.java:52 — backends-bolt/src/main/java/org/apache/gluten/utils/BoltBloomFilter.java:52-59 | backends-velox/src/main/java/org/apache/gluten/utils/VeloxBloomFilter.java:51-58 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8 lines × 2) cpp-ch/local-engine/tool/parquet_to_mergetree.py:59 — cpp-ch/local-engine/tool/parquet_to_mergetree.py:59-66 | cpp-ch/local-engine/tool/parquet_to_mergetree.py:85-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.
  • + 1 more in this group — see findings.md.
D3 · God Classes · FileTooLong · ×25
  • FileTooLong: REDACTED REDACTED — FileTooLong — 1406 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 906 over it, 2.81× 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: velox/VeloxSparkPlanExecApi.scala backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala — FileTooLong — 1269 significant lines (blank, comment-only and punctuation-only lines excluded), about 96% of them inside a single declaration: VeloxSparkPlanExecApi (76-1764). The bar is 500 significant lines; this is 769 over it, 2.54× 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: scripts/gen-function-support-docs.py tools/scripts/gen-function-support-docs.py — FileTooLong — 1190 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 690 over it, 2.38× 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: storage/GlutenShuffleBlockFetcherIterator.scala shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala — FileTooLong — 982 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 482 over it, 1.96× 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: storage/GlutenShuffleBlockFetcherIterator.scala shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala — FileTooLong — 982 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 482 over it, 1.96× 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: bolt/BoltSparkPlanExecApi.scala backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala — FileTooLong — 980 significant lines (blank, comment-only and punctuation-only lines excluded), about 95% of them inside a single declaration: BoltSparkPlanExecApi (72-1327). The bar is 500 significant lines; this is 480 over it, 1.96× 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: storage/GlutenShuffleBlockFetcherIterator.scala shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala — FileTooLong — 980 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 480 over it, 1.96× 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: storage/GlutenShuffleBlockFetcherIterator.scala shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala — FileTooLong — 963 significant lines (blank, comment-only and punctuation-only lines excluded), about 93% of them inside a single declaration: GlutenShuffleBlockFetcherIterator (93-1482). The bar is 500 significant lines; this is 463 over it, 1.93× 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: storage/GlutenShuffleBlockFetcherIterator.scala shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala — FileTooLong — 961 significant lines (blank, comment-only and punctuation-only lines excluded), about 93% of them inside a single declaration: GlutenShuffleBlockFetcherIterator (93-1480). The bar is 500 significant lines; this is 461 over it, 1.92× 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: config/VeloxConfig.scala backends-velox/src/main/scala/org/apache/gluten/config/VeloxConfig.scala — FileTooLong — 882 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 382 over it, 1.76× 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: config/BoltConfig.scala backends-bolt/src/main/scala/org/apache/gluten/config/BoltConfig.scala — FileTooLong — 875 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 375 over it, 1.75× 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/ColumnarCachedBatchSerializer.scala backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala — FileTooLong — 861 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 361 over it, 1.72× 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: expression/ExpressionConverter.scala gluten-substrait/src/main/scala/org/apache/gluten/expression/ExpressionConverter.scala — FileTooLong — 792 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 292 over it, 1.58× 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: clickhouse/CHSparkPlanExecApi.scala backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHSparkPlanExecApi.scala — FileTooLong — 789 significant lines (blank, comment-only and punctuation-only lines excluded), about 94% of them inside a single declaration: CHSparkPlanExecApi (72-1077). The bar is 500 significant lines; this is 289 over it, 1.58× 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: extension/CoalesceAggregationUnion.scala backends-clickhouse/src/main/scala/org/apache/gluten/extension/CoalesceAggregationUnion.scala — FileTooLong — 753 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 253 over it, 1.51× 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: velox/VeloxMetricsApi.scala backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala — FileTooLong — 749 significant lines (blank, comment-only and punctuation-only lines excluded), about 98% of them inside a single declaration: VeloxMetricsApi (33-867). The bar is 500 significant lines; this is 249 over it, 1.50× 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: bolt/BoltMetricsApi.scala backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala — FileTooLong — 709 significant lines (blank, comment-only and punctuation-only lines excluded), about 98% of them inside a single declaration: BoltMetricsApi (33-822). The bar is 500 significant lines; this is 209 over it, 1.42× 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: extension/JoinAggregateToAggregateUnion.scala backends-clickhouse/src/main/scala/org/apache/gluten/extension/JoinAggregateToAggregateUnion.scala — FileTooLong — 695 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 195 over it, 1.39× 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/ColumnarCachedBatchSerializer.scala backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala — FileTooLong — 689 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 189 over it, 1.38× 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: commands/VacuumCommand.scala backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/commands/VacuumCommand.scala — FileTooLong — 687 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 187 over it, 1.37× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: delta/DeltaLog.scala backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/DeltaLog.scala — FileTooLong — 595 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 95 over it, 1.19× 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: celeborn/CelebornUtils.java gluten-celeborn/src/main/java/org/apache/spark/shuffle/gluten/celeborn/CelebornUtils.java — FileTooLong — 589 significant lines (blank, comment-only and punctuation-only lines excluded), about 96% of them inside a single declaration: CelebornUtils (45-753). The bar is 500 significant lines; this is 89 over it, 1.18× 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: utils/MergeTreePartsPartitionsUtil.scala backends-clickhouse/src/main/scala/org/apache/spark/sql/execution/datasources/clickhouse/utils/MergeTreePartsPartitionsUtil.scala — FileTooLong — 558 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 58 over it, 1.12× 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: taskexecutor/TaskManagerRunner.java gluten-flink/runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskManagerRunner.java — FileTooLong — 553 significant lines (blank, comment-only and punctuation-only lines excluded), about 85% of them inside a single declaration: TaskManagerRunner (111-798). The bar is 500 significant lines; this is 53 over it, 1.11× 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: ds/TpcdsTableLayout.scala tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala — FileTooLong — 544 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 44 over it, 1.09× 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.
D4 · Code Duplication · Duplicated block (12 lines × 2) · ×22
  • Duplicated block (12 lines × 2) backends-bolt/src-iceberg/main/scala/org/apache/gluten/connector/write/IcebergColumnarBatchDataWriter.scala:65 — backends-bolt/src-iceberg/main/scala/org/apache/gluten/connector/write/IcebergColumnarBatchDataWriter.scala:65-76 | backends-velox/src-iceberg/main/scala/org/apache/gluten/connector/write/IcebergColumnarBatchDataWriter.scala:69-80 — before extracting anything, compare `backends-bolt/src-iceberg/main/scala/org/apache/gluten/connector/write/IcebergColumnarBatchDataWriter.scala` and `backends-velox/src-iceberg/main/scala/org/apache/gluten/connector/write/IcebergColumnarBatchDataWriter.scala` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (12 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:999 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:999-1010 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala:1369-1380 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 498 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala:176 — backends-bolt/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala:176-187 | backends-velox/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala:172-183 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 225 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 `backends-bolt/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala:176` 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) backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:702 — backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:702-713 | backends-velox/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:708-719 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 337 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 (12 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/metrics/GenerateMetricsUpdater.scala:23 — backends-bolt/src/main/scala/org/apache/gluten/metrics/GenerateMetricsUpdater.scala:23-34 | backends-velox/src/main/scala/org/apache/gluten/metrics/GenerateMetricsUpdater.scala:23-34 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/metrics/GenerateMetricsUpdater.scala` and `backends-velox/src/main/scala/org/apache/gluten/metrics/GenerateMetricsUpdater.scala` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (12 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/utils/ParquetMetadataUtils.scala:103 — backends-bolt/src/main/scala/org/apache/gluten/utils/ParquetMetadataUtils.scala:103-114 | backends-velox/src/main/scala/org/apache/gluten/utils/ParquetMetadataUtils.scala:148-159 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/utils/ParquetMetadataUtils.scala` and `backends-velox/src/main/scala/org/apache/gluten/utils/ParquetMetadataUtils.scala` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 117 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 (12 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/hive/BoltHiveUDFTransformer.scala:30 — backends-bolt/src/main/scala/org/apache/spark/sql/hive/BoltHiveUDFTransformer.scala:30-41 | backends-velox/src/main/scala/org/apache/spark/sql/hive/VeloxHiveUDFTransformer.scala:30-41 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/hive/BoltHiveUDFTransformer.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/hive/VeloxHiveUDFTransformer.scala` as WHOLE FILES: 93% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (12 lines × 2) backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHWindowGroupLimitExecTransformer.scala:163 — backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHWindowGroupLimitExecTransformer.scala:163-174 | gluten-substrait/src/main/scala/org/apache/gluten/execution/WindowGroupLimitExecTransformer.scala:153-164 — before extracting anything, compare `backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHWindowGroupLimitExecTransformer.scala` and `gluten-substrait/src/main/scala/org/apache/gluten/execution/WindowGroupLimitExecTransformer.scala` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 119 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 (12 lines × 2) backends-clickhouse/src/main/scala/org/apache/gluten/parser/GlutenCacheFileSqlParserBase.scala:122 — backends-clickhouse/src/main/scala/org/apache/gluten/parser/GlutenCacheFileSqlParserBase.scala:122-133 | backends-clickhouse/src/main/scala/org/apache/gluten/parser/GlutenClickhouseSqlParserBase.scala:122-133 — before extracting anything, compare `backends-clickhouse/src/main/scala/org/apache/gluten/parser/GlutenCacheFileSqlParserBase.scala` and `backends-clickhouse/src/main/scala/org/apache/gluten/parser/GlutenClickhouseSqlParserBase.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 98 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 (12 lines × 2) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:305 — backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:305-321 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:301-312 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala` and `backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 385 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 `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:305` 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) backends-velox/src/main/scala/org/apache/gluten/execution/VeloxLocalTableScanTransformer.scala:82 — backends-velox/src/main/scala/org/apache/gluten/execution/VeloxLocalTableScanTransformer.scala:82-93 | backends-velox/src/main/scala/org/apache/gluten/execution/VeloxRDDScanTransformer.scala:197-208 — 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.
  • Duplicated block (12 lines × 2) shims/spark34/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:85 — shims/spark34/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:85-96 | shims/spark35/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:82-93 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala` and `shims/spark35/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala` as WHOLE FILES: 93% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 `shims/spark34/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:85` 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) tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:304 — tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:304-315 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:538-549 — both copies are in the same file, so extract the block into 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) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:821 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:821-832 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala:1187-1201 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 498 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:821` 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) backends-bolt/src/main/scala/org/apache/gluten/extension/HLLRewriteRule.scala:54 — backends-bolt/src/main/scala/org/apache/gluten/extension/HLLRewriteRule.scala:54-65 | backends-velox/src/main/scala/org/apache/gluten/extension/HLLRewriteRule.scala:54-65 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/extension/HLLRewriteRule.scala` and `backends-velox/src/main/scala/org/apache/gluten/extension/HLLRewriteRule.scala` as WHOLE FILES: 92% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/extension/PartialGenerateRule.scala:51 — backends-bolt/src/main/scala/org/apache/gluten/extension/PartialGenerateRule.scala:51-62 | backends-velox/src/main/scala/org/apache/gluten/extension/PartialGenerateRule.scala:51-62 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (12 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/metrics/JoinMetricsUpdater.scala:45 — backends-bolt/src/main/scala/org/apache/gluten/metrics/JoinMetricsUpdater.scala:45-56 | backends-velox/src/main/scala/org/apache/gluten/metrics/JoinMetricsUpdater.scala:45-56 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/metrics/JoinMetricsUpdater.scala` and `backends-velox/src/main/scala/org/apache/gluten/metrics/JoinMetricsUpdater.scala` 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. 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 `backends-bolt/src/main/scala/org/apache/gluten/metrics/JoinMetricsUpdater.scala:45` 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) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/stats/GlutenDeltaJobStatsTracker.scala:105 — backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/stats/GlutenDeltaJobStatsTracker.scala:105-116 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/stats/GlutenDeltaJobStatsTracker.scala:105-116 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/stats/GlutenDeltaJobStatsTracker.scala` and `backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/stats/GlutenDeltaJobStatsTracker.scala` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 119 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 2) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/stats/GlutenDeltaJobStatsTracker.scala:282 — backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/stats/GlutenDeltaJobStatsTracker.scala:282-293 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/stats/GlutenDeltaJobStatsTracker.scala:286-297 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/stats/GlutenDeltaJobStatsTracker.scala` and `backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/stats/GlutenDeltaJobStatsTracker.scala` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 119 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 2) gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGlobalWindowAggregate.java:206 — gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGlobalWindowAggregate.java:206-217 | gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWindowAggregate.java:207-218 — before extracting anything, compare `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGlobalWindowAggregate.java` and `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWindowAggregate.java` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 89 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, `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWindowAggregate.java:219` calls `isRowtime` and `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGlobalWindowAggregate.java:218` 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 (12 lines × 2) gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecLocalWindowAggregate.java:227 — gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecLocalWindowAggregate.java:227-239 | gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWatermarkAssigner.java:156-167 — 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 `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecLocalWindowAggregate.java:227` 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 (12 lines × 2) gluten-flink/runtime/src/main/java/org/apache/gluten/table/runtime/operators/GlutenSourceFunction.java:238 — gluten-flink/runtime/src/main/java/org/apache/gluten/table/runtime/operators/GlutenSourceFunction.java:238-249 | gluten-flink/runtime/src/main/java/org/apache/gluten/table/runtime/operators/GlutenStreamingFileWriterOperator.java:86-97 — 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 first that the copies are not typed on the same thing: the declarations holding them bind `context` to `FunctionInitializationContext` in one and `StateInitializationContext` 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.
D30 · Dependency Vulnerabilities · Medium CVE · ×19
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (7 lines × 2) · ×19
  • Duplicated block (7 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:380 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:380-386 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:269-277 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala` and `backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 127 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:387` calls `createNanoTimingMetric` and `backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:278` 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) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltRuleApi.scala:130 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltRuleApi.scala:130-136 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxRuleApi.scala:147-153 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltRuleApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxRuleApi.scala` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 36 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltRuleApi.scala:130` 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 before the matched lines, `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxRuleApi.scala:146` calls `injectPost`, `GenerateTransformStageId` and `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltRuleApi.scala:129` 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 (7 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:329 — backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:329-335 | backends-velox/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:337-343 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 337 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 `backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:329` 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) backends-bolt/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala:176 — backends-bolt/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala:176-182 | backends-velox/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala:131-137 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala` and `backends-velox/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 75 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 `backends-bolt/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala:176` 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) backends-clickhouse/src/main/scala/org/apache/gluten/extension/JoinAggregateToAggregateUnion.scala:603 — backends-clickhouse/src/main/scala/org/apache/gluten/extension/JoinAggregateToAggregateUnion.scala:603-609 | backends-clickhouse/src/main/scala/org/apache/gluten/extension/JoinAggregateToAggregateUnion.scala:615-621 — both copies are in the same file, so extract the 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 `backends-clickhouse/src/main/scala/org/apache/gluten/extension/JoinAggregateToAggregateUnion.scala:603` 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) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltIteratorApi.scala:160 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltIteratorApi.scala:160-166 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxIteratorApi.scala:179-185 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltIteratorApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxIteratorApi.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 110 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltIteratorApi.scala:160` 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, `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltIteratorApi.scala:168` calls `getFileInfo`, `valueOf` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxIteratorApi.scala:187` 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) backends-bolt/src/main/scala/org/apache/gluten/execution/BoltBroadcastNestedLoopJoinExecTransformer.scala:45 — backends-bolt/src/main/scala/org/apache/gluten/execution/BoltBroadcastNestedLoopJoinExecTransformer.scala:45-51 | backends-bolt/src/main/scala/org/apache/gluten/execution/HashJoinExecTransformer.scala:126-132 — 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) backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialGenerateExec.scala:182 — backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialGenerateExec.scala:182-188 | backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarPartialGenerateExec.scala:181-187 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialGenerateExec.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarPartialGenerateExec.scala` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 122 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala:319 — backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala:319-325 | backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala:315-321 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 151 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/TopNTransformer.scala:69 — backends-bolt/src/main/scala/org/apache/gluten/execution/TopNTransformer.scala:69-75 | backends-velox/src/main/scala/org/apache/gluten/execution/TopNTransformer.scala:69-75 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/TopNTransformer.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/TopNTransformer.scala` 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. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:428 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:428-434 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:589-595 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/hive/BoltHiveUDFTransformer.scala:47 — backends-bolt/src/main/scala/org/apache/spark/sql/hive/BoltHiveUDFTransformer.scala:47-53 | backends-velox/src/main/scala/org/apache/spark/sql/hive/VeloxHiveUDFTransformer.scala:47-53 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/hive/BoltHiveUDFTransformer.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/hive/VeloxHiveUDFTransformer.scala` as WHOLE FILES: 93% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 2) backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHWindowGroupLimitExecTransformer.scala:69 — backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHWindowGroupLimitExecTransformer.scala:69-75 | gluten-substrait/src/main/scala/org/apache/gluten/execution/WindowGroupLimitExecTransformer.scala:67-73 — before extracting anything, compare `backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHWindowGroupLimitExecTransformer.scala` and `gluten-substrait/src/main/scala/org/apache/gluten/execution/WindowGroupLimitExecTransformer.scala` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 119 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 2) backends-clickhouse/src/main/scala/org/apache/gluten/parser/GlutenCacheFileSqlParserBase.scala:108 — backends-clickhouse/src/main/scala/org/apache/gluten/parser/GlutenCacheFileSqlParserBase.scala:108-114 | backends-clickhouse/src/main/scala/org/apache/gluten/parser/GlutenClickhouseSqlParserBase.scala:109-115 — before extracting anything, compare `backends-clickhouse/src/main/scala/org/apache/gluten/parser/GlutenCacheFileSqlParserBase.scala` and `backends-clickhouse/src/main/scala/org/apache/gluten/parser/GlutenClickhouseSqlParserBase.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 98 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 2) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:589 — backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:589-595 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:559-565 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala` and `backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 385 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 `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:589` 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) gluten-delta/src-delta33/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala:228 — gluten-delta/src-delta33/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala:228-234 | gluten-delta/src-delta4/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala:229-235 — before extracting anything, compare `gluten-delta/src-delta33/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala` and `gluten-delta/src-delta4/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 188 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 `gluten-delta/src-delta33/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala: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 (7 lines × 2) shims/spark34/src/main/scala/org/apache/gluten/sql/shims/spark34/Spark34Shims.scala:335 — shims/spark34/src/main/scala/org/apache/gluten/sql/shims/spark34/Spark34Shims.scala:335-341 | shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala:396-402 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/gluten/sql/shims/spark34/Spark34Shims.scala` and `shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 168 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 2) shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:210 — shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:210-216 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:210-216 — before extracting anything, compare `shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 1133 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 2) gluten-substrait/src/main/java/org/apache/gluten/substrait/rel/WindowGroupLimitRelNode.java:75 — gluten-substrait/src/main/java/org/apache/gluten/substrait/rel/WindowGroupLimitRelNode.java:75-81 | gluten-substrait/src/main/java/org/apache/gluten/substrait/rel/WindowRelNode.java:80-86 — 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, `gluten-substrait/src/main/java/org/apache/gluten/substrait/rel/WindowGroupLimitRelNode.java:83` calls `setLimit` and `gluten-substrait/src/main/java/org/apache/gluten/substrait/rel/WindowRelNode.java:88` 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 (6 lines × 2) · ×18
  • Duplicated block (6 lines × 2) backends-bolt/src-iceberg/main/scala/org/apache/iceberg/transforms/IcebergTransformUtil.scala:38 — backends-bolt/src-iceberg/main/scala/org/apache/iceberg/transforms/IcebergTransformUtil.scala:38-43 | backends-velox/src-iceberg/main/scala/org/apache/iceberg/transforms/IcebergTransformUtil.scala:38-43 — before extracting anything, compare `backends-bolt/src-iceberg/main/scala/org/apache/iceberg/transforms/IcebergTransformUtil.scala` and `backends-velox/src-iceberg/main/scala/org/apache/iceberg/transforms/IcebergTransformUtil.scala` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 32 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 `backends-bolt/src-iceberg/main/scala/org/apache/iceberg/transforms/IcebergTransformUtil.scala:38` 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) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:387 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:387-392 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:426-433 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala` as WHOLE FILES: this scan already matched 35 separate duplicated blocks between them, totalling at least 485 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 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) backends-bolt/src/main/scala/org/apache/gluten/metrics/UnionMetricsUpdater.scala:30 — backends-bolt/src/main/scala/org/apache/gluten/metrics/UnionMetricsUpdater.scala:30-35 | backends-velox/src/main/scala/org/apache/gluten/metrics/UnionMetricsUpdater.scala:30-35 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/metrics/UnionMetricsUpdater.scala` and `backends-velox/src/main/scala/org/apache/gluten/metrics/UnionMetricsUpdater.scala` as WHOLE FILES: 96% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (6 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:516 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:516-521 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:530-535 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala` as WHOLE FILES: this scan already matched 35 separate duplicated blocks between them, totalling at least 485 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 (6 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:602 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:602-607 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:398-403 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala` and `backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 127 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 (6 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltValidatorApi.scala:48 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltValidatorApi.scala:48-53 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxValidatorApi.scala:48-53 — 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) backends-bolt/src/main/scala/org/apache/gluten/execution/BoltBroadcastNestedLoopJoinExecTransformer.scala:53 — backends-bolt/src/main/scala/org/apache/gluten/execution/BoltBroadcastNestedLoopJoinExecTransformer.scala:53-58 | backends-velox/src/main/scala/org/apache/gluten/execution/VeloxBroadcastNestedLoopJoinExecTransformer.scala:59-64 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/BoltBroadcastNestedLoopJoinExecTransformer.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/VeloxBroadcastNestedLoopJoinExecTransformer.scala` as WHOLE FILES: 95% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (6 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala:77 — backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala:77-82 | backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala:81-86 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 151 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 (6 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/expression/BoltBloomFilterMightContain.scala:133 — backends-bolt/src/main/scala/org/apache/gluten/expression/BoltBloomFilterMightContain.scala:133-138 | backends-velox/src/main/scala/org/apache/gluten/expression/VeloxBloomFilterMightContain.scala:133-138 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/expression/BoltBloomFilterMightContain.scala` and `backends-velox/src/main/scala/org/apache/gluten/expression/VeloxBloomFilterMightContain.scala` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 32 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 (6 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/expression/BoltBloomFilterMightContain.scala:141 — backends-bolt/src/main/scala/org/apache/gluten/expression/BoltBloomFilterMightContain.scala:141-146 | backends-velox/src/main/scala/org/apache/gluten/expression/VeloxBloomFilterMightContain.scala:141-146 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/expression/BoltBloomFilterMightContain.scala` and `backends-velox/src/main/scala/org/apache/gluten/expression/VeloxBloomFilterMightContain.scala` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 32 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 (6 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:421 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:421-426 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:582-587 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 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 (6 lines × 2) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:606 — backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:606-611 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:604-609 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala` and `backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 536 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 (6 lines × 2) backends-velox/src-delta33/main/scala/org/apache/spark/sql/execution/datasources/v2/OffloadDeltaCommand.scala:55 — backends-velox/src-delta33/main/scala/org/apache/spark/sql/execution/datasources/v2/OffloadDeltaCommand.scala:55-60 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/execution/datasources/v2/OffloadDeltaCommand.scala:55-60 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/spark/sql/execution/datasources/v2/OffloadDeltaCommand.scala` and `backends-velox/src-delta4/main/scala/org/apache/spark/sql/execution/datasources/v2/OffloadDeltaCommand.scala` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (6 lines × 2) backends-bolt/src/main/java/org/apache/gluten/metrics/BatchWriteMetrics.java:39 — backends-bolt/src/main/java/org/apache/gluten/metrics/BatchWriteMetrics.java:39-44 | backends-velox/src/main/java/org/apache/gluten/metrics/BatchWriteMetrics.java:39-44 — before extracting anything, compare `backends-bolt/src/main/java/org/apache/gluten/metrics/BatchWriteMetrics.java` and `backends-velox/src/main/java/org/apache/gluten/metrics/BatchWriteMetrics.java` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 `backends-bolt/src/main/java/org/apache/gluten/metrics/BatchWriteMetrics.java:39` 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. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (6 lines × 2) tools/qualification-tool/src/main/java/org/apache/gluten/qt/support/NodeSupportVisitor.java:218 — tools/qualification-tool/src/main/java/org/apache/gluten/qt/support/NodeSupportVisitor.java:218-223 | tools/qualification-tool/src/main/java/org/apache/gluten/qt/support/NodeSupportVisitor.java:241-246 — both copies are in the same file, so extract the 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 `tools/qualification-tool/src/main/java/org/apache/gluten/qt/support/NodeSupportVisitor.java:218` 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 (6 lines × 2) backends-bolt/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java:44 — backends-bolt/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java:44-49 | backends-velox/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java:44-49 — before extracting anything, compare `backends-bolt/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java` and `backends-velox/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java` as WHOLE FILES: this scan already matched 12 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. 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 (6 lines × 2) backends-bolt/src/main/java/org/apache/gluten/utils/BoltBloomFilter.java:172 — backends-bolt/src/main/java/org/apache/gluten/utils/BoltBloomFilter.java:172-177 | backends-velox/src/main/java/org/apache/gluten/utils/VeloxBloomFilter.java:167-172 — 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. 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) gluten-substrait/src/main/java/org/apache/gluten/substrait/rel/JoinRelNode.java:86 — gluten-substrait/src/main/java/org/apache/gluten/substrait/rel/JoinRelNode.java:86-91 | gluten-substrait/src/main/java/org/apache/gluten/substrait/rel/NestedLoopJoinRelNode.java:76-81 — 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. 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.
D35 · Change Coupling · Change coupling · ×17
  • Change coupling: Spark40Shims.scala ↔ Spark41Shims.scala shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala:1 — `shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala` and `shims/spark41/src/main/scala/org/apache/gluten/sql/shims/spark41/Spark41Shims.scala` change together 90% of the time (18 of the 20 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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 18 shared commits counted here, the most recent 3 are `7e309eec` [GLUTEN-12569][CORE] Fix compatibility issues addressed in Spark 4.2 …; `05087f9d` [GLUTEN-13003][CORE] Move version-independent helpers out of SparkShi…; `95ed1d4a` [GLUTEN-12991][CORE] Remove the leftover PromotePrecision shim and it… — run `git show` on any of them.
  • Change coupling: FileSourceScanMetricsUpdater.scala ↔ HiveTableScanMetricsUpdater.scala backends-velox/src/main/scala/org/apache/gluten/metrics/FileSourceScanMetricsUpdater.scala:1 — `backends-velox/src/main/scala/org/apache/gluten/metrics/FileSourceScanMetricsUpdater.scala` and `backends-velox/src/main/scala/org/apache/gluten/metrics/HiveTableScanMetricsUpdater.scala` change together 90% of the time (9 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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). They sit in the same directory, and in this ecosystem sibling files there normally share one namespace/package — so a direct reference between them needs no import and this pass cannot see whether one exists. Read the pair before acting: if one file only DECLARES what the other consumes (a constants/types file beside its user), the co-change is definitional and the question is whether the split earns its keep; if they duplicate structure, extract the common part into a shared function or type they both call; if neither holds, 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 `aa82d4aa` [VL] Reduce Velox scan SQL metrics by default to mitigate driver OOM …; `52dd67cf` Add storageReads metric to track number of storage read operations (#…; `c3fcc4db` Add page load time metric (#10294) — run `git show` on any of them.
  • Change coupling: IteratorApi.scala ↔ WholeStageZippedPartitionsRDD.scala gluten-substrait/src/main/scala/org/apache/gluten/backendsapi/IteratorApi.scala:1 — `gluten-substrait/src/main/scala/org/apache/gluten/backendsapi/IteratorApi.scala` and `gluten-substrait/src/main/scala/org/apache/gluten/execution/WholeStageZippedPartitionsRDD.scala` change together 80% of the time (12 of the 15 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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 12 shared commits counted here, the most recent 3 are `ec25cda1` [GLUTEN-11605][VL] Push dynamic filters down to ValueStream (#11657); `001a126f` [GLUTEN-10578] Remove `NUMA Binding` feature (#10579); `df7d62c2` [GLUTEN-8851][VL] GPU validate the plan and use runtime config to ena… — run `git show` on any of them.
  • Change coupling: FileSourceScanMetricsUpdater.scala ↔ MetricsUtil.scala backends-velox/src/main/scala/org/apache/gluten/metrics/FileSourceScanMetricsUpdater.scala:1 — `backends-velox/src/main/scala/org/apache/gluten/metrics/FileSourceScanMetricsUpdater.scala` and `backends-velox/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala` change together 80% of the time (8 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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). They sit in the same directory, and in this ecosystem sibling files there normally share one namespace/package — so a direct reference between them needs no import and this pass cannot see whether one exists. Read the pair before acting: if one file only DECLARES what the other consumes (a constants/types file beside its user), the co-change is definitional and the question is whether the split earns its keep; if they duplicate structure, extract the common part into a shared function or type they both call; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `52dd67cf` Add storageReads metric to track number of storage read operations (#…; `c3fcc4db` Add page load time metric (#10294); `0cb8b980` Add datasource metrics (#10787) — run `git show` on any of them.
  • Change coupling: VeloxCelebornColumnarShuffleWriter.scala ↔ ColumnarShuffleWriter.scala backends-velox/src-celeborn/main/scala/org/apache/spark/shuffle/VeloxCelebornColumnarShuffleWriter.scala:1 — `backends-velox/src-celeborn/main/scala/org/apache/spark/shuffle/VeloxCelebornColumnarShuffleWriter.scala` and `backends-velox/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleWriter.scala` change together 74% of the time (28 of the 38 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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 `4634c80a` [GLUTEN-11915][VL] Support RowBasedChecksum in ColumnarShuffleWriter …; `0b1e5115` [VL] Reduce Velox hash shuffle partition buffer memory by evicting la…; `0f760348` [VL] Update shuffle write metrics per batch (#11083) — run `git show` on any of them.
  • Change coupling: ColumnarBuildSideRelation.scala ↔ UnsafeColumnarBuildSideRelation.scala backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:1 — `backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala` change together 71% of the time (12 of the 17 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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 12 shared commits counted here, the most recent 3 are `cf2bd18d` [VL] Remap generated build key aliases in the driver-side hash table …; `05087f9d` [GLUTEN-13003][CORE] Move version-independent helpers out of SparkShi…; `f9c1152f` [VL] Deserialize broadcast build side per the consuming stage's cuDF … — run `git show` on any of them.
  • Change coupling: HiveTableScanMetricsUpdater.scala ↔ MetricsUtil.scala backends-velox/src/main/scala/org/apache/gluten/metrics/HiveTableScanMetricsUpdater.scala:1 — `backends-velox/src/main/scala/org/apache/gluten/metrics/HiveTableScanMetricsUpdater.scala` and `backends-velox/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala` change together 70% of the time (7 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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). They sit in the same directory, and in this ecosystem sibling files there normally share one namespace/package — so a direct reference between them needs no import and this pass cannot see whether one exists. Read the pair before acting: if one file only DECLARES what the other consumes (a constants/types file beside its user), the co-change is definitional and the question is whether the split earns its keep; if they duplicate structure, extract the common part into a shared function or type they both call; 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 `52dd67cf` Add storageReads metric to track number of storage read operations (#…; `c3fcc4db` Add page load time metric (#10294); `0cb8b980` Add datasource metrics (#10787) — run `git show` on any of them.
  • Change coupling: OperatorMetrics.java ↔ VeloxMetricsApi.scala backends-velox/src/main/java/org/apache/gluten/metrics/OperatorMetrics.java:1 — `backends-velox/src/main/java/org/apache/gluten/metrics/OperatorMetrics.java` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala` change together 67% of the time (16 of the 24 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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 16 shared commits counted here, the most recent 3 are `6b58b705` [VL] Add toIntermediateFastPathCalls metric to HashAggregate metrics …; `17d4e039` [VL] Enable in-probe bloom filter for left / existence / anti joins (…; `b8c5711d` [VL] Add metric abandonedPartialAggregation (#12106) — run `git show` on any of them.
  • Change coupling: GlutenOneInputOperator.java ↔ GlutenSourceFunction.java gluten-flink/runtime/src/main/java/org/apache/gluten/table/runtime/operators/GlutenOneInputOperator.java:1 — `gluten-flink/runtime/src/main/java/org/apache/gluten/table/runtime/operators/GlutenOneInputOperator.java` and `gluten-flink/runtime/src/main/java/org/apache/gluten/table/runtime/operators/GlutenSourceFunction.java` change together 64% of the time (7 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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). They sit in the same directory, and in this ecosystem sibling files there normally share one namespace/package — so a direct reference between them needs no import and this pass cannot see whether one exists. Read the pair before acting: if one file only DECLARES what the other consumes (a constants/types file beside its user), the co-change is definitional and the question is whether the split earns its keep; if they duplicate structure, extract the common part into a shared function or type they both call; 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 `9685185b` [GLUTEN-12206][FLINK] Support native checkpoint snapshot and restore …; `48849115` [GLUTEN-9939][FLINK] Support nexmark q3 (#9940) (at that commit the file was still `gluten-flink/runtime/src/main/java/org/apache/gluten/table/runtime/operators/GlutenSingleInputOperator.java`); `9d36fdd2` Revert "[GLUTEN-9567][FLINK] Add container class `Velox4JBean` for pr… (at that commit the file was still `gluten-flink/runtime/src/main/java/org/apache/gluten/table/runtime/operators/GlutenSingleInputOperator.java`) — run `git show` on any of them.
  • Change coupling: CHExpressionUtil.scala ↔ VeloxIntermediateData.scala backends-clickhouse/src/main/scala/org/apache/gluten/utils/CHExpressionUtil.scala:1 — `backends-clickhouse/src/main/scala/org/apache/gluten/utils/CHExpressionUtil.scala` and `backends-velox/src/main/scala/org/apache/gluten/utils/VeloxIntermediateData.scala` 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 — 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 `73a243c4` [VL] Support regr_sxy aggregate function (#5295); `7e5b4fc7` [VL] Support regr_intercept aggregate function (#5273); `5a11dd80` [VL] Support regr_slope aggregate function (#5216) — run `git show` on any of them.
  • Change coupling: MemoryTargets.java ↔ SparkMemoryUtil.scala gluten-core/src/main/java/org/apache/gluten/memory/memtarget/MemoryTargets.java:1 — `gluten-core/src/main/java/org/apache/gluten/memory/memtarget/MemoryTargets.java` and `gluten-core/src/main/scala/org/apache/spark/memory/SparkMemoryUtil.scala` 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 — 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 `cb3979e8` [GLUTEN-10932][VL] Pass memory changes to taskMemoryManager for dynam…; `083ecfbb` [VL] Move pre-configuration code of dynamic off-heap sizing to its ow…; `88ec4469` [VL] Fix `RetryOnOomMemoryTarget` only spills one single consumer on … — run `git show` on any of them.
  • Change coupling: BasicPhysicalOperatorTransformer.scala ↔ SortExecTransformer.scala gluten-substrait/src/main/scala/org/apache/gluten/execution/BasicPhysicalOperatorTransformer.scala:1 — `gluten-substrait/src/main/scala/org/apache/gluten/execution/BasicPhysicalOperatorTransformer.scala` and `gluten-substrait/src/main/scala/org/apache/gluten/execution/SortExecTransformer.scala` change together 57% of the time (13 of the 23 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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). They sit in the same directory, and in this ecosystem sibling files there normally share one namespace/package — so a direct reference between them needs no import and this pass cannot see whether one exists. Read the pair before acting: if one file only DECLARES what the other consumes (a constants/types file beside its user), the co-change is definitional and the question is whether the split earns its keep; if they duplicate structure, extract the common part into a shared function or type they both call; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 13 shared commits counted here, the most recent 3 are `e3682fda` [GLUTEN-8010][CORE] Don't generate native metrics if transformer don'…; `1fd405e3` [GLUTEN-4105][VL] Fix parse substrait plan to json plan error when va… (at that commit the files were still `gluten-core/src/main/scala/io/glutenproject/execution/BasicPhysicalOperatorTransformer.scala` and `gluten-core/src/main/scala/io/glutenproject/execution/SortExecTransformer.scala`); `75b5d27c` [GLUTEN-4060][MINOR] Remove the override method that is consistent wi… (at that commit the files were still `gluten-core/src/main/scala/io/glutenproject/execution/BasicPhysicalOperatorTransformer.scala` and `gluten-core/src/main/scala/io/glutenproject/execution/SortExecTransformer.scala`) — run `git show` on any of them.
  • Change coupling: LimitExecTransformer.scala ↔ SortExecTransformer.scala gluten-substrait/src/main/scala/org/apache/gluten/execution/LimitExecTransformer.scala:1 — `gluten-substrait/src/main/scala/org/apache/gluten/execution/LimitExecTransformer.scala` and `gluten-substrait/src/main/scala/org/apache/gluten/execution/SortExecTransformer.scala` change together 53% of the time (8 of the 15 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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). They sit in the same directory, and in this ecosystem sibling files there normally share one namespace/package — so a direct reference between them needs no import and this pass cannot see whether one exists. Read the pair before acting: if one file only DECLARES what the other consumes (a constants/types file beside its user), the co-change is definitional and the question is whether the split earns its keep; if they duplicate structure, extract the common part into a shared function or type they both call; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `1fd405e3` [GLUTEN-4105][VL] Fix parse substrait plan to json plan error when va… (at that commit the files were still `gluten-core/src/main/scala/io/glutenproject/execution/LimitTransformer.scala` and `gluten-core/src/main/scala/io/glutenproject/execution/SortExecTransformer.scala`); `75b5d27c` [GLUTEN-4060][MINOR] Remove the override method that is consistent wi… (at that commit the files were still `gluten-core/src/main/scala/io/glutenproject/execution/LimitTransformer.scala` and `gluten-core/src/main/scala/io/glutenproject/execution/SortExecTransformer.scala`); `b3af425f` [Gluten-1147][Gluten-core]Make validate failure logLevel configuable … (at that commit the files were still `gluten-core/src/main/scala/io/glutenproject/execution/LimitTransformer.scala` and `gluten-core/src/main/scala/io/glutenproject/execution/SortExecTransformer.scala`) — run `git show` on any of them.
  • Change coupling: ExpandExecTransformer.scala ↔ LimitExecTransformer.scala gluten-substrait/src/main/scala/org/apache/gluten/execution/ExpandExecTransformer.scala:1 — `gluten-substrait/src/main/scala/org/apache/gluten/execution/ExpandExecTransformer.scala` and `gluten-substrait/src/main/scala/org/apache/gluten/execution/LimitExecTransformer.scala` change together 53% of the time (8 of the 15 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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). They sit in the same directory, and in this ecosystem sibling files there normally share one namespace/package — so a direct reference between them needs no import and this pass cannot see whether one exists. Read the pair before acting: if one file only DECLARES what the other consumes (a constants/types file beside its user), the co-change is definitional and the question is whether the split earns its keep; if they duplicate structure, extract the common part into a shared function or type they both call; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `1fd405e3` [GLUTEN-4105][VL] Fix parse substrait plan to json plan error when va… (at that commit the files were still `gluten-core/src/main/scala/io/glutenproject/execution/ExpandExecTransformer.scala` and `gluten-core/src/main/scala/io/glutenproject/execution/LimitTransformer.scala`); `75b5d27c` [GLUTEN-4060][MINOR] Remove the override method that is consistent wi… (at that commit the files were still `gluten-core/src/main/scala/io/glutenproject/execution/ExpandExecTransformer.scala` and `gluten-core/src/main/scala/io/glutenproject/execution/LimitTransformer.scala`); `b3af425f` [Gluten-1147][Gluten-core]Make validate failure logLevel configuable … (at that commit the files were still `gluten-core/src/main/scala/io/glutenproject/execution/ExpandExecTransformer.scala` and `gluten-core/src/main/scala/io/glutenproject/execution/LimitTransformer.scala`) — run `git show` on any of them.
  • Change coupling: GlutenWholeStageColumnarRDD.scala ↔ WholeStageZippedPartitionsRDD.scala gluten-substrait/src/main/scala/org/apache/gluten/execution/GlutenWholeStageColumnarRDD.scala:1 — `gluten-substrait/src/main/scala/org/apache/gluten/execution/GlutenWholeStageColumnarRDD.scala` and `gluten-substrait/src/main/scala/org/apache/gluten/execution/WholeStageZippedPartitionsRDD.scala` change together 53% of the time (8 of the 15 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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). They sit in the same directory, and in this ecosystem sibling files there normally share one namespace/package — so a direct reference between them needs no import and this pass cannot see whether one exists. Read the pair before acting: if one file only DECLARES what the other consumes (a constants/types file beside its user), the co-change is definitional and the question is whether the split earns its keep; if they duplicate structure, extract the common part into a shared function or type they both call; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `001a126f` [GLUTEN-10578] Remove `NUMA Binding` feature (#10579); `df7d62c2` [GLUTEN-8851][VL] GPU validate the plan and use runtime config to ena…; `e78ee439` [VL] Pass partition id to velox functions (#4344) (at that commit the files were still `gluten-core/src/main/scala/io/glutenproject/execution/GlutenWholeStageColumnarRDD.scala` and `gluten-core/src/main/scala/io/glutenproject/execution/WholeStageZippedPartitionsRDD.scala`) — run `git show` on any of them.
  • Change coupling: ColumnarBuildSideRelation.scala ↔ ExecUtil.scala backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:1 — `backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/utils/ExecUtil.scala` change together 52% of the time (13 of the 25 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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 13 shared commits counted here, the most recent 3 are `51e67932` [GLUTEN-7031] Move iterator wrappers to gluten-core (#7095) (at that commit the files were still `gluten-data/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala` and `gluten-data/src/main/scala/org/apache/spark/sql/execution/utils/ExecUtil.scala`); `f7b40275` [VL] Add conf option to limit C2R memory usage (#5952) (at that commit the files were still `gluten-data/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala` and `gluten-data/src/main/scala/org/apache/spark/sql/execution/utils/ExecUtil.scala`); `529d3f40` [VL] Add a benchmark to track on iterator facility's performance (#6225) (at that commit the files were still `gluten-data/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala` and `gluten-data/src/main/scala/org/apache/spark/sql/execution/utils/ExecUtil.scala`) — run `git show` on any of them.
  • Change coupling: CHColumnarShuffleWriter.scala ↔ ColumnarShuffleWriter.scala backends-clickhouse/src/main/scala/org/apache/spark/shuffle/CHColumnarShuffleWriter.scala:1 — `backends-clickhouse/src/main/scala/org/apache/spark/shuffle/CHColumnarShuffleWriter.scala` and `backends-velox/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleWriter.scala` change together 52% of the time (13 of the 25 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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 13 shared commits counted here, the most recent 3 are `d077f936` [GLUTEN-9163][VL] Separate compression buffer and disk write buffer c…; `256cca23` [VL] Remove preferSpill=true for VeloxShuffleWriter (#3091) (at that commit the file was still `gluten-data/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleWriter.scala`); `9e627a6c` [VL] Remove shuffle write schema option (#2831) (at that commit the file was still `gluten-data/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleWriter.scala`) — run `git show` on any of them.
D4 · Code Duplication · Duplicated block (17 lines × 2) · ×15
  • Duplicated block (17 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltIteratorApi.scala:247 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltIteratorApi.scala:247-263 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxIteratorApi.scala:243-259 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltIteratorApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxIteratorApi.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 110 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltIteratorApi.scala:247` 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 before the matched lines, `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxIteratorApi.scala:240` calls `ColumnarBatchInIterator` and `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltIteratorApi.scala:245` 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 (17 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltListenerApi.scala:188 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltListenerApi.scala:188-204 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxListenerApi.scala:198-214 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltListenerApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxListenerApi.scala` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 112 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 (17 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:147 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:147-163 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala:152-168 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 498 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 (17 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:572 — backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:572-588 | backends-velox/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:580-596 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 337 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 `backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:572` 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 (17 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/extension/FlushableHashAggregateRule.scala:67 — backends-bolt/src/main/scala/org/apache/gluten/extension/FlushableHashAggregateRule.scala:67-83 | backends-velox/src/main/scala/org/apache/gluten/extension/FlushableHashAggregateRule.scala:50-66 — 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 `backends-bolt/src/main/scala/org/apache/gluten/extension/FlushableHashAggregateRule.scala: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 (17 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/utils/ParquetMetadataUtils.scala:153 — backends-bolt/src/main/scala/org/apache/gluten/utils/ParquetMetadataUtils.scala:153-169 | backends-velox/src/main/scala/org/apache/gluten/utils/ParquetMetadataUtils.scala:208-224 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/utils/ParquetMetadataUtils.scala` and `backends-velox/src/main/scala/org/apache/gluten/utils/ParquetMetadataUtils.scala` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 117 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 (17 lines × 2) backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:185 — backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:185-201 | backends-velox/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:282-303 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala` and `backends-velox/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 286 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 `backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:185` 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 (17 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:143 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:143-159 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:209-225 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 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 (17 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/execution/utils/ExecUtil.scala:161 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/utils/ExecUtil.scala:161-177 | backends-velox/src/main/scala/org/apache/spark/sql/execution/utils/ExecUtil.scala:163-179 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/utils/ExecUtil.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/utils/ExecUtil.scala` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 128 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 `backends-bolt/src/main/scala/org/apache/spark/sql/execution/utils/ExecUtil.scala:161` 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, `backends-velox/src/main/scala/org/apache/spark/sql/execution/utils/ExecUtil.scala:181` calls `GlutenNotSupportException` and `backends-bolt/src/main/scala/org/apache/spark/sql/execution/utils/ExecUtil.scala:178` 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 (17 lines × 2) backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHHashJoinExecTransformer.scala:125 — backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHHashJoinExecTransformer.scala:125-141 | gluten-substrait/src/main/scala/org/apache/gluten/execution/JoinExecTransformer.scala:283-299 — 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) gluten-delta/src-delta24/main/scala/org/apache/gluten/extension/DeltaCDFRelationHelper.scala:27 — gluten-delta/src-delta24/main/scala/org/apache/gluten/extension/DeltaCDFRelationHelper.scala:27-43 | gluten-delta/src-delta33/main/scala/org/apache/gluten/extension/DeltaCDFRelationHelper.scala:27-43 — before extracting anything, compare `gluten-delta/src-delta24/main/scala/org/apache/gluten/extension/DeltaCDFRelationHelper.scala` and `gluten-delta/src-delta33/main/scala/org/apache/gluten/extension/DeltaCDFRelationHelper.scala` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (17 lines × 2) gluten-delta/src/main/scala/org/apache/gluten/execution/DeltaScanTransformer.scala:185 — gluten-delta/src/main/scala/org/apache/gluten/execution/DeltaScanTransformer.scala:185-201 | gluten-delta/src/main/scala/org/apache/gluten/execution/DeltaScanTransformer.scala:215-231 — both copies are in the same file, so extract the 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 `gluten-delta/src/main/scala/org/apache/gluten/execution/DeltaScanTransformer.scala:185` 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 (17 lines × 2) tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/stat/RamStat.scala:44 — tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/stat/RamStat.scala:44-60 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/stat/RamStat.scala:66-82 — both copies are in the same file, so extract the block into 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) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:814 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:814-830 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:1192-1208 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 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 (17 lines × 2) gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGlobalWindowAggregate.java:272 — gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGlobalWindowAggregate.java:272-288 | gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWindowAggregate.java:285-301 — before extracting anything, compare `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGlobalWindowAggregate.java` and `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWindowAggregate.java` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 89 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 `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGlobalWindowAggregate.java:272` 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.
X3 · Exception handling · Swallowed exception (caught, then discarded) · ×15
  • Swallowed exception (caught, then discarded) gluten-substrait/src/main/scala/org/apache/gluten/extension/columnar/validator/Validators.scala:53 — `case _: Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) gluten-substrait/src/main/scala/org/apache/gluten/extension/columnar/validator/Validators.scala:245 — `case _: Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) gluten-flink/runtime/src/main/java/org/apache/gluten/util/ReflectUtils.java:48 — `catch (Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) gluten-flink/runtime/src/main/java/org/apache/gluten/table/runtime/metrics/SourceOperatorMetrics.java:57 — `catch (Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) gluten-arrow/src/main/scala/org/apache/spark/sql/utils/SparkArrowUtil.scala:176 — `case _: Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) backends-velox/src-iceberg/main/scala/org/apache/gluten/execution/VeloxIcebergWriteToDataSourceV2Exec.scala:64 — `case _: Throwable` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) backends-velox/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:282 — `case _: Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) backends-velox/src/main/scala/org/apache/gluten/extension/ScanMapKeyPruning.scala:375 — `case NonFatal(_)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxBackend.scala:220 — `case _: Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/execution/datasources/v2/clickhouse/ClickHouseSparkCatalog.scala:469 — `case _: Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/DeltaLog.scala:514 — `case NonFatal(_)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) backends-bolt/src-iceberg/main/scala/org/apache/gluten/execution/BoltIcebergWriteToDataSourceV2Exec.scala:64 — `case _: Throwable` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) backends-bolt/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:278 — `case _: Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) backends-bolt/src/main/scala/org/apache/gluten/utils/ParquetMetadataUtils.scala:126 — `case _: RuntimeException` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala:211 — `case _: Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
D4 · Code Duplication · Duplicated block (16 lines × 2) · ×14
  • Duplicated block (16 lines × 2) backends-bolt/src-iceberg/main/scala/org/apache/gluten/execution/BoltIcebergWriteToDataSourceV2Exec.scala:53 — backends-bolt/src-iceberg/main/scala/org/apache/gluten/execution/BoltIcebergWriteToDataSourceV2Exec.scala:53-68 | backends-velox/src-iceberg/main/scala/org/apache/gluten/execution/VeloxIcebergWriteToDataSourceV2Exec.scala:53-68 — before extracting anything, compare `backends-bolt/src-iceberg/main/scala/org/apache/gluten/execution/BoltIcebergWriteToDataSourceV2Exec.scala` and `backends-velox/src-iceberg/main/scala/org/apache/gluten/execution/VeloxIcebergWriteToDataSourceV2Exec.scala` as WHOLE FILES: 93% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (16 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/BoltColumnarToRowExec.scala:53 — backends-bolt/src/main/scala/org/apache/gluten/execution/BoltColumnarToRowExec.scala:53-68 | backends-velox/src/main/scala/org/apache/gluten/execution/VeloxColumnarToRowExec.scala:54-69 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/BoltColumnarToRowExec.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/VeloxColumnarToRowExec.scala` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 102 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 `backends-bolt/src/main/scala/org/apache/gluten/execution/BoltColumnarToRowExec.scala:53` 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 (16 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/metrics/JoinMetricsUpdater.scala:111 — backends-bolt/src/main/scala/org/apache/gluten/metrics/JoinMetricsUpdater.scala:111-126 | backends-velox/src/main/scala/org/apache/gluten/metrics/JoinMetricsUpdater.scala:116-131 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/metrics/JoinMetricsUpdater.scala` and `backends-velox/src/main/scala/org/apache/gluten/metrics/JoinMetricsUpdater.scala` 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. 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `backends-bolt/src/main/scala/org/apache/gluten/metrics/JoinMetricsUpdater.scala:131` calls `get` and `backends-velox/src/main/scala/org/apache/gluten/metrics/JoinMetricsUpdater.scala:133` 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 (16 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/metrics/SortMetricsUpdater.scala:34 — backends-bolt/src/main/scala/org/apache/gluten/metrics/SortMetricsUpdater.scala:34-49 | backends-velox/src/main/scala/org/apache/gluten/metrics/SortMetricsUpdater.scala:34-49 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/metrics/SortMetricsUpdater.scala` and `backends-velox/src/main/scala/org/apache/gluten/metrics/SortMetricsUpdater.scala` 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. 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 `backends-bolt/src/main/scala/org/apache/gluten/metrics/SortMetricsUpdater.scala:34` 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) backends-bolt/src/main/scala/org/apache/spark/sql/execution/BroadcastModeUtils.scala:55 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/BroadcastModeUtils.scala:55-70 | backends-velox/src/main/scala/org/apache/spark/sql/execution/BroadcastModeUtils.scala:55-70 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/BroadcastModeUtils.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/BroadcastModeUtils.scala` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 71 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 (16 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:507 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:507-522 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:688-703 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 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 `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:507` 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) backends-clickhouse/src/main/scala/org/apache/gluten/metrics/CHRangeMetricsUpdater.scala:29 — backends-clickhouse/src/main/scala/org/apache/gluten/metrics/CHRangeMetricsUpdater.scala:29-44 | backends-clickhouse/src/main/scala/org/apache/gluten/metrics/GenerateMetricsUpdater.scala:30-45 — before extracting anything, compare `backends-clickhouse/src/main/scala/org/apache/gluten/metrics/CHRangeMetricsUpdater.scala` and `backends-clickhouse/src/main/scala/org/apache/gluten/metrics/GenerateMetricsUpdater.scala` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 32 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 `backends-clickhouse/src/main/scala/org/apache/gluten/metrics/CHRangeMetricsUpdater.scala:29` 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) backends-clickhouse/src/main/scala/org/apache/spark/rpc/GlutenDriverEndpoint.scala:47 — backends-clickhouse/src/main/scala/org/apache/spark/rpc/GlutenDriverEndpoint.scala:47-62 | backends-velox/src/main/scala/org/apache/spark/rpc/GlutenDriverEndpoint.scala:45-60 — before extracting anything, compare `backends-clickhouse/src/main/scala/org/apache/spark/rpc/GlutenDriverEndpoint.scala` and `backends-velox/src/main/scala/org/apache/spark/rpc/GlutenDriverEndpoint.scala` 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. 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 `backends-clickhouse/src/main/scala/org/apache/spark/rpc/GlutenDriverEndpoint.scala:47` 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 (16 lines × 2) tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/action/QueriesCompare.scala:53 — tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/action/QueriesCompare.scala:53-68 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/action/QueriesCompare.scala:79-94 — both copies are in the same file, so extract the 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 `tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/action/QueriesCompare.scala:53` 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) backends-velox/src-delta33/main/scala/org/apache/gluten/component/VeloxDelta33WriteComponent.scala:27 — backends-velox/src-delta33/main/scala/org/apache/gluten/component/VeloxDelta33WriteComponent.scala:27-42 | backends-velox/src-delta4/main/scala/org/apache/gluten/component/VeloxDelta4WriteComponent.scala:27-42 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/gluten/component/VeloxDelta33WriteComponent.scala` and `backends-velox/src-delta4/main/scala/org/apache/gluten/component/VeloxDelta4WriteComponent.scala` as WHOLE FILES: 94% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (16 lines × 2) shims/spark34/src/main/scala/org/apache/spark/sql/execution/python/BasePythonRunnerShim.scala:52 — shims/spark34/src/main/scala/org/apache/spark/sql/execution/python/BasePythonRunnerShim.scala:52-67 | shims/spark35/src/main/scala/org/apache/spark/sql/execution/python/BasePythonRunnerShim.scala:53-68 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/sql/execution/python/BasePythonRunnerShim.scala` and `shims/spark35/src/main/scala/org/apache/spark/sql/execution/python/BasePythonRunnerShim.scala` as WHOLE FILES: 98% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 `shims/spark34/src/main/scala/org/apache/spark/sql/execution/python/BasePythonRunnerShim.scala:52` 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 (16 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:256 — backends-bolt/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:256-271 | backends-velox/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:260-275 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 204 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 (16 lines × 2) backends-bolt/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java:137 — backends-bolt/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java:137-152 | backends-velox/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java:137-152 — before extracting anything, compare `backends-bolt/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java` and `backends-velox/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java` as WHOLE FILES: this scan already matched 12 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. 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 (16 lines × 2) gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecJoin.java:177 — gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecJoin.java:177-192 | gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWindowJoin.java:159-174 — before extracting anything, compare `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecJoin.java` and `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWindowJoin.java` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWindowJoin.java:157` calls `getWindowEnd` and `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecJoin.java:176` 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 (20 lines × 2) · ×13
  • Duplicated block (20 lines × 2) backends-bolt/src-celeborn/main/scala/org/apache/spark/shuffle/BoltCelebornColumnarBatchSerializer.scala:191 — backends-bolt/src-celeborn/main/scala/org/apache/spark/shuffle/BoltCelebornColumnarBatchSerializer.scala:191-210 | backends-velox/src-celeborn/main/scala/org/apache/spark/shuffle/VeloxCelebornColumnarBatchSerializer.scala:154-173 — before extracting anything, compare `backends-bolt/src-celeborn/main/scala/org/apache/spark/shuffle/BoltCelebornColumnarBatchSerializer.scala` and `backends-velox/src-celeborn/main/scala/org/apache/spark/shuffle/VeloxCelebornColumnarBatchSerializer.scala` as WHOLE FILES: this scan already matched 4 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 `backends-bolt/src-celeborn/main/scala/org/apache/spark/shuffle/BoltCelebornColumnarBatchSerializer.scala:191` 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 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialGenerateExec.scala:92 — backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialGenerateExec.scala:92-111 | backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarPartialGenerateExec.scala:91-110 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialGenerateExec.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarPartialGenerateExec.scala` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 122 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 (20 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/TopNTransformer.scala:103 — backends-bolt/src/main/scala/org/apache/gluten/execution/TopNTransformer.scala:103-122 | backends-velox/src/main/scala/org/apache/gluten/execution/TopNTransformer.scala:103-122 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/TopNTransformer.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/TopNTransformer.scala` 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. 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 `backends-bolt/src/main/scala/org/apache/gluten/execution/TopNTransformer.scala:103` 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 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/expression/BoltBloomFilterMightContain.scala:93 — backends-bolt/src/main/scala/org/apache/gluten/expression/BoltBloomFilterMightContain.scala:93-112 | backends-velox/src/main/scala/org/apache/gluten/expression/VeloxBloomFilterMightContain.scala:93-112 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/expression/BoltBloomFilterMightContain.scala` and `backends-velox/src/main/scala/org/apache/gluten/expression/VeloxBloomFilterMightContain.scala` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 32 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 (20 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/extension/PushdownProjectExecBeforeGeneratorRule.scala:36 — backends-bolt/src/main/scala/org/apache/gluten/extension/PushdownProjectExecBeforeGeneratorRule.scala:36-55 | backends-bolt/src/main/scala/org/apache/gluten/extension/PushdownProjectExecBeforeGeneratorRule.scala:72-91 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (20 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/extension/RewriteCastFromArray.scala:38 — backends-bolt/src/main/scala/org/apache/gluten/extension/RewriteCastFromArray.scala:38-57 | backends-velox/src/main/scala/org/apache/gluten/extension/RewriteCastFromArray.scala:38-57 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/extension/RewriteCastFromArray.scala` and `backends-velox/src/main/scala/org/apache/gluten/extension/RewriteCastFromArray.scala` as WHOLE FILES: 93% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 `backends-bolt/src/main/scala/org/apache/gluten/extension/RewriteCastFromArray.scala:38` 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 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/metrics/JoinMetricsUpdater.scala:191 — backends-bolt/src/main/scala/org/apache/gluten/metrics/JoinMetricsUpdater.scala:191-210 | backends-velox/src/main/scala/org/apache/gluten/metrics/JoinMetricsUpdater.scala:206-225 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/metrics/JoinMetricsUpdater.scala` and `backends-velox/src/main/scala/org/apache/gluten/metrics/JoinMetricsUpdater.scala` 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. 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 (20 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/metrics/NestedLoopJoinMetricsUpdater.scala:56 — backends-bolt/src/main/scala/org/apache/gluten/metrics/NestedLoopJoinMetricsUpdater.scala:56-75 | backends-velox/src/main/scala/org/apache/gluten/metrics/NestedLoopJoinMetricsUpdater.scala:56-75 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/metrics/NestedLoopJoinMetricsUpdater.scala` and `backends-velox/src/main/scala/org/apache/gluten/metrics/NestedLoopJoinMetricsUpdater.scala` as WHOLE FILES: 98% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (20 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:722 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:722-741 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:1039-1058 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 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 (20 lines × 2) backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:336 — backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:336-355 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:721-740 — both copies are in the same file, so extract the 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 `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:336` 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, `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:356` calls `createMetric` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:741` 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 (20 lines × 2) shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:753 — shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:753-772 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:753-772 — before extracting anything, compare `shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 1133 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 `shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:753` 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 lines × 2) shims/spark40/src/main/scala/org/apache/spark/sql/execution/python/BasePythonRunnerShim.scala:50 — shims/spark40/src/main/scala/org/apache/spark/sql/execution/python/BasePythonRunnerShim.scala:50-69 | shims/spark41/src/main/scala/org/apache/spark/sql/execution/python/BasePythonRunnerShim.scala:50-69 — before extracting anything, compare `shims/spark40/src/main/scala/org/apache/spark/sql/execution/python/BasePythonRunnerShim.scala` and `shims/spark41/src/main/scala/org/apache/spark/sql/execution/python/BasePythonRunnerShim.scala` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 `shims/spark40/src/main/scala/org/apache/spark/sql/execution/python/BasePythonRunnerShim.scala:50` 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) backends-bolt/src/main/java/org/apache/gluten/metrics/IteratorMetricsJniWrapper.java:28 — backends-bolt/src/main/java/org/apache/gluten/metrics/IteratorMetricsJniWrapper.java:28-47 | backends-velox/src/main/java/org/apache/gluten/metrics/IteratorMetricsJniWrapper.java:28-47 — before extracting anything, compare `backends-bolt/src/main/java/org/apache/gluten/metrics/IteratorMetricsJniWrapper.java` and `backends-velox/src/main/java/org/apache/gluten/metrics/IteratorMetricsJniWrapper.java` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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. 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.
D4 · Code Duplication · Duplicated block (14 lines × 2) · ×13
  • Duplicated block (14 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltIteratorApi.scala:348 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltIteratorApi.scala:348-361 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxIteratorApi.scala:346-359 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltIteratorApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxIteratorApi.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 110 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltIteratorApi.scala:348` 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) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:390 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:390-403 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala:415-428 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 498 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:390` 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) backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:229 — backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:229-242 | backends-velox/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:238-251 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 337 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 `backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:229` 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) backends-bolt/src/main/scala/org/apache/spark/sql/execution/BoltColumnarWriteFilesExec.scala:180 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/BoltColumnarWriteFilesExec.scala:180-193 | backends-velox/src/main/scala/org/apache/spark/sql/execution/VeloxColumnarWriteFilesExec.scala:185-198 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/BoltColumnarWriteFilesExec.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/VeloxColumnarWriteFilesExec.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 148 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (14 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:796 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:796-809 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:1170-1183 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 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 (14 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/execution/datasources/bolt/BoltFormatWriterInjects.scala:50 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/datasources/bolt/BoltFormatWriterInjects.scala:50-63 | backends-velox/src/main/scala/org/apache/spark/sql/execution/datasources/velox/VeloxFormatWriterInjects.scala:50-63 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/datasources/bolt/BoltFormatWriterInjects.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/datasources/velox/VeloxFormatWriterInjects.scala` as WHOLE FILES: 84% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (14 lines × 2) backends-clickhouse/src/main/scala/org/apache/gluten/parser/GlutenCacheFileSqlParserBase.scala:186 — backends-clickhouse/src/main/scala/org/apache/gluten/parser/GlutenCacheFileSqlParserBase.scala:186-199 | backends-clickhouse/src/main/scala/org/apache/gluten/parser/GlutenClickhouseSqlParserBase.scala:211-224 — before extracting anything, compare `backends-clickhouse/src/main/scala/org/apache/gluten/parser/GlutenCacheFileSqlParserBase.scala` and `backends-clickhouse/src/main/scala/org/apache/gluten/parser/GlutenClickhouseSqlParserBase.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 98 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (14 lines × 2) backends-clickhouse/src/main/scala/org/apache/spark/rpc/GlutenExecutorEndpoint.scala:47 — backends-clickhouse/src/main/scala/org/apache/spark/rpc/GlutenExecutorEndpoint.scala:47-60 | backends-velox/src/main/scala/org/apache/spark/rpc/GlutenExecutorEndpoint.scala:46-59 — before extracting anything, compare `backends-clickhouse/src/main/scala/org/apache/spark/rpc/GlutenExecutorEndpoint.scala` and `backends-velox/src/main/scala/org/apache/spark/rpc/GlutenExecutorEndpoint.scala` as WHOLE FILES: 88% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (14 lines × 2) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:591 — backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:591-604 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:589-602 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala` and `backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 536 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (14 lines × 2) gluten-delta/src-delta33/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala:370 — gluten-delta/src-delta33/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala:370-383 | gluten-delta/src-delta4/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala:381-394 — before extracting anything, compare `gluten-delta/src-delta33/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala` and `gluten-delta/src-delta4/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 188 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 `gluten-delta/src-delta33/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala:370` 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) gluten-substrait/src/main/scala/org/apache/gluten/execution/BasicPhysicalOperatorTransformer.scala:75 — gluten-substrait/src/main/scala/org/apache/gluten/execution/BasicPhysicalOperatorTransformer.scala:75-88 | gluten-substrait/src/main/scala/org/apache/gluten/execution/SampleExecTransformer.scala:76-89 — 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 `gluten-substrait/src/main/scala/org/apache/gluten/execution/BasicPhysicalOperatorTransformer.scala:75` 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) shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1565 — shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1565-1578 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1565-1578 — before extracting anything, compare `shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 1133 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (14 lines × 2) gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGroupWindowAggregate.java:132 — gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGroupWindowAggregate.java:132-145 | gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWindowAggregate.java:135-148 — before extracting anything, compare `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGroupWindowAggregate.java` and `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWindowAggregate.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 37 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 `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGroupWindowAggregate.java:132` 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 (21 lines × 2) · ×12
  • Duplicated block (21 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:1013 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:1013-1033 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala:1383-1403 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 498 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:1013` 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) backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialGenerateExec.scala:160 — backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialGenerateExec.scala:160-180 | backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarPartialGenerateExec.scala:159-179 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialGenerateExec.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarPartialGenerateExec.scala` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 122 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 `backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialGenerateExec.scala:160` 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) backends-bolt/src/main/scala/org/apache/gluten/extension/HLLRewriteRule.scala:32 — backends-bolt/src/main/scala/org/apache/gluten/extension/HLLRewriteRule.scala:32-52 | backends-velox/src/main/scala/org/apache/gluten/extension/HLLRewriteRule.scala:32-52 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/extension/HLLRewriteRule.scala` and `backends-velox/src/main/scala/org/apache/gluten/extension/HLLRewriteRule.scala` as WHOLE FILES: 92% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (21 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/metrics/HashAggregateMetricsUpdater.scala:60 — backends-bolt/src/main/scala/org/apache/gluten/metrics/HashAggregateMetricsUpdater.scala:60-80 | backends-velox/src/main/scala/org/apache/gluten/metrics/HashAggregateMetricsUpdater.scala:65-85 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/metrics/HashAggregateMetricsUpdater.scala` and `backends-velox/src/main/scala/org/apache/gluten/metrics/HashAggregateMetricsUpdater.scala` as WHOLE FILES: 98% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (21 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala:83 — backends-bolt/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala:83-103 | backends-velox/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala:87-107 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala` and `backends-velox/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 295 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 `backends-bolt/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala:83` 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) backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:264 — backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:264-284 | backends-velox/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:367-387 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala` and `backends-velox/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 286 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 (21 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/execution/BroadcastModeUtils.scala:113 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/BroadcastModeUtils.scala:113-133 | backends-velox/src/main/scala/org/apache/spark/sql/execution/BroadcastModeUtils.scala:113-133 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/BroadcastModeUtils.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/BroadcastModeUtils.scala` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 71 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 (21 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/execution/BroadcastUtils.scala:175 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/BroadcastUtils.scala:175-195 | backends-velox/src/main/scala/org/apache/spark/sql/execution/BroadcastUtils.scala:226-246 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/BroadcastUtils.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/BroadcastUtils.scala` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 109 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 `backends-bolt/src/main/scala/org/apache/spark/sql/execution/BroadcastUtils.scala:175` 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 (21 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/execution/datasources/bolt/BoltParquetWriterInjects.scala:34 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/datasources/bolt/BoltParquetWriterInjects.scala:34-54 | backends-velox/src/main/scala/org/apache/spark/sql/execution/datasources/velox/VeloxParquetWriterInjects.scala:37-57 — 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 `backends-bolt/src/main/scala/org/apache/spark/sql/execution/datasources/bolt/BoltParquetWriterInjects.scala:34` 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 (21 lines × 2) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/stats/GlutenDeltaJobStatsTracker.scala:260 — backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/stats/GlutenDeltaJobStatsTracker.scala:260-280 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/stats/GlutenDeltaJobStatsTracker.scala:264-284 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/stats/GlutenDeltaJobStatsTracker.scala` and `backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/stats/GlutenDeltaJobStatsTracker.scala` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 119 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 (21 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/extension/PartialFallback.scala:26 — backends-bolt/src/main/scala/org/apache/gluten/extension/PartialFallback.scala:26-46 | backends-velox/src/main/scala/org/apache/gluten/extension/PartialFallback.scala:26-46 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/extension/PartialFallback.scala` and `backends-velox/src/main/scala/org/apache/gluten/extension/PartialFallback.scala` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 `backends-bolt/src/main/scala/org/apache/gluten/extension/PartialFallback.scala:26` 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 (21 lines × 2) backends-bolt/src/main/java/org/apache/gluten/metrics/OperatorMetrics.java:140 — backends-bolt/src/main/java/org/apache/gluten/metrics/OperatorMetrics.java:140-160 | backends-velox/src/main/java/org/apache/gluten/metrics/OperatorMetrics.java:146-166 — before extracting anything, compare `backends-bolt/src/main/java/org/apache/gluten/metrics/OperatorMetrics.java` and `backends-velox/src/main/java/org/apache/gluten/metrics/OperatorMetrics.java` as WHOLE FILES: 98% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 `backends-bolt/src/main/java/org/apache/gluten/metrics/OperatorMetrics.java:140` 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 (19 lines × 2) · ×12
  • Duplicated block (19 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:762 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:762-780 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:807-825 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala` as WHOLE FILES: this scan already matched 35 separate duplicated blocks between them, totalling at least 485 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:762` 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 × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala:343 — backends-bolt/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala:343-361 | backends-velox/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala:344-362 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 225 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 `backends-bolt/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala:343` 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 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:440 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:440-458 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:603-621 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 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 (19 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:475 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:475-493 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:643-661 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 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 (19 lines × 2) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:631 — backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:631-649 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:601-619 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala` and `backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 385 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 (19 lines × 2) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:525 — backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:525-543 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:525-543 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala` and `backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 536 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 (19 lines × 2) backends-velox/src-delta33/main/scala/org/apache/spark/sql/execution/datasources/v2/OffloadDeltaCommand.scala:32 — backends-velox/src-delta33/main/scala/org/apache/spark/sql/execution/datasources/v2/OffloadDeltaCommand.scala:32-50 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/execution/datasources/v2/OffloadDeltaCommand.scala:32-50 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/spark/sql/execution/datasources/v2/OffloadDeltaCommand.scala` and `backends-velox/src-delta4/main/scala/org/apache/spark/sql/execution/datasources/v2/OffloadDeltaCommand.scala` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (19 lines × 2) gluten-delta/src-delta33/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala:87 — gluten-delta/src-delta33/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala:87-105 | gluten-delta/src-delta4/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala:88-106 — before extracting anything, compare `gluten-delta/src-delta33/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala` and `gluten-delta/src-delta4/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 188 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 (19 lines × 2) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1419 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1419-1437 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1421-1439 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 1116 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 `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1419` 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 lines × 2) shims/spark41/src/main/scala/org/apache/gluten/execution/GenerateTreeStringShim.scala:47 — shims/spark41/src/main/scala/org/apache/gluten/execution/GenerateTreeStringShim.scala:47-65 | shims/spark42/src/main/scala/org/apache/gluten/execution/GenerateTreeStringShim.scala:47-65 — before extracting anything, compare `shims/spark41/src/main/scala/org/apache/gluten/execution/GenerateTreeStringShim.scala` and `shims/spark42/src/main/scala/org/apache/gluten/execution/GenerateTreeStringShim.scala` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (19 lines × 2) tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/action/Queries.scala:83 — tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/action/Queries.scala:83-101 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/action/QueriesCompare.scala:110-128 — 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 `tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/action/Queries.scala:83` 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 (19 lines × 2) gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGlobalWindowAggregate.java:247 — gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGlobalWindowAggregate.java:247-265 | gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWindowAggregate.java:253-271 — before extracting anything, compare `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGlobalWindowAggregate.java` and `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWindowAggregate.java` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 89 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, `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGlobalWindowAggregate.java:266` calls `convertToLogicalTypes`, `getAccTypes` and `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWindowAggregate.java:272` 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 (13 lines × 2) · ×12
  • Duplicated block (13 lines × 2) backends-bolt/src-iceberg/main/scala/org/apache/gluten/execution/AbstractIcebergWriteExec.scala:36 — backends-bolt/src-iceberg/main/scala/org/apache/gluten/execution/AbstractIcebergWriteExec.scala:36-48 | backends-velox/src-iceberg/main/scala/org/apache/gluten/execution/AbstractIcebergWriteExec.scala:49-61 — before extracting anything, compare `backends-bolt/src-iceberg/main/scala/org/apache/gluten/execution/AbstractIcebergWriteExec.scala` and `backends-velox/src-iceberg/main/scala/org/apache/gluten/execution/AbstractIcebergWriteExec.scala` as WHOLE FILES: 83% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 `backends-bolt/src-iceberg/main/scala/org/apache/gluten/execution/AbstractIcebergWriteExec.scala:36` 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) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:371 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:371-383 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:416-428 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala` as WHOLE FILES: this scan already matched 35 separate duplicated blocks between them, totalling at least 485 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:370` calls `createSizeMetric` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:415` 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 (13 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:305 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:305-317 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala:330-342 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 498 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 (13 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/BoltColumnarToRowExec.scala:40 — backends-bolt/src/main/scala/org/apache/gluten/execution/BoltColumnarToRowExec.scala:40-52 | backends-velox/src/main/scala/org/apache/gluten/execution/VeloxColumnarToRowExec.scala:40-52 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/BoltColumnarToRowExec.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/VeloxColumnarToRowExec.scala` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 102 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 `backends-bolt/src/main/scala/org/apache/gluten/execution/BoltColumnarToRowExec.scala:40` 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) backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:215 — backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:215-227 | backends-velox/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:224-236 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 337 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 `backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:215` 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) backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:252 — backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:252-264 | backends-velox/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:261-273 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 337 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 `backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:252` 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 (13 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/TopNTransformer.scala:78 — backends-bolt/src/main/scala/org/apache/gluten/execution/TopNTransformer.scala:78-90 | backends-velox/src/main/scala/org/apache/gluten/execution/TopNTransformer.scala:78-90 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/TopNTransformer.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/TopNTransformer.scala` 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. 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 (13 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltIteratorApi.scala:145 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltIteratorApi.scala:145-157 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxIteratorApi.scala:164-176 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltIteratorApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxIteratorApi.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 110 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltIteratorApi.scala:145` 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 (13 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:937 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:937-949 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala:1330-1342 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 498 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:937` 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 (13 lines × 2) shims/spark41/src/main/scala/org/apache/gluten/execution/GenerateTreeStringShim.scala:80 — shims/spark41/src/main/scala/org/apache/gluten/execution/GenerateTreeStringShim.scala:80-92 | shims/spark42/src/main/scala/org/apache/gluten/execution/GenerateTreeStringShim.scala:80-92 — before extracting anything, compare `shims/spark41/src/main/scala/org/apache/gluten/execution/GenerateTreeStringShim.scala` and `shims/spark42/src/main/scala/org/apache/gluten/execution/GenerateTreeStringShim.scala` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 `shims/spark41/src/main/scala/org/apache/gluten/execution/GenerateTreeStringShim.scala:80` 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 (13 lines × 2) backends-bolt/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java:95 — backends-bolt/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java:95-107 | backends-velox/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java:95-107 — before extracting anything, compare `backends-bolt/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java` and `backends-velox/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java` as WHOLE FILES: this scan already matched 12 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. 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 (13 lines × 2) backends-bolt/src/main/java/org/apache/gluten/metrics/BatchWriteMetrics.java:46 — backends-bolt/src/main/java/org/apache/gluten/metrics/BatchWriteMetrics.java:46-58 | backends-velox/src/main/java/org/apache/gluten/metrics/BatchWriteMetrics.java:46-58 — before extracting anything, compare `backends-bolt/src/main/java/org/apache/gluten/metrics/BatchWriteMetrics.java` and `backends-velox/src/main/java/org/apache/gluten/metrics/BatchWriteMetrics.java` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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. 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.
D15 · Churn × Complexity Hotspots · Hotspot · ×11
  • Hotspot: gluten-substrait/src/main/scala/org/apache/gluten/expression/ExpressionConverter.scala gluten-substrait/src/main/scala/org/apache/gluten/expression/ExpressionConverter.scala:301 — gluten-substrait/src/main/scala/org/apache/gluten/expression/ExpressionConverter.scala changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 101 in ExpressionConverter.transformExpression at line 301. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 11:15:01 +08:00' --until='2026-10-26 11:15:01 +08:00' --full-history --no-merges -- gluten-substrait/src/main/scala/org/apache/gluten/expression/ExpressionConverter.scala`: 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: backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala:743 — backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 49 in VeloxSparkPlanExecApi.createBroadcastRelation at line 743. 1 of those changes was a fix/bug commit, and the other 13 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 11:15:01 +08:00' --until='2026-10-26 11:15:01 +08:00' --full-history --no-merges -- backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala`: 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: gluten-substrait/src/main/scala/org/apache/gluten/extension/columnar/validator/Validators.scala gluten-substrait/src/main/scala/org/apache/gluten/extension/columnar/validator/Validators.scala:252 — gluten-substrait/src/main/scala/org/apache/gluten/extension/columnar/validator/Validators.scala changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 33 in FallbackByTimestampNTZ.validate at line 252. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 11:15:01 +08:00' --until='2026-10-26 11:15:01 +08:00' --full-history --no-merges -- gluten-substrait/src/main/scala/org/apache/gluten/extension/columnar/validator/Validators.scala`: 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: gluten-substrait/src/main/scala/org/apache/gluten/extension/columnar/offload/OffloadSingleNodeRules.scala gluten-substrait/src/main/scala/org/apache/gluten/extension/columnar/offload/OffloadSingleNodeRules.scala:203 — gluten-substrait/src/main/scala/org/apache/gluten/extension/columnar/offload/OffloadSingleNodeRules.scala changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 33 in ReplaceSingleNode.doReplace at line 203. 1 of those changes was a fix/bug commit, and the other 4 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 11:15:01 +08:00' --until='2026-10-26 11:15:01 +08:00' --full-history --no-merges -- gluten-substrait/src/main/scala/org/apache/gluten/extension/columnar/offload/OffloadSingleNodeRules.scala`: 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: gluten-iceberg/src/main/scala/org/apache/gluten/execution/IcebergScanTransformer.scala gluten-iceberg/src/main/scala/org/apache/gluten/execution/IcebergScanTransformer.scala:89 — gluten-iceberg/src/main/scala/org/apache/gluten/execution/IcebergScanTransformer.scala changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 24 in IcebergScanTransformer.doValidateInternal at line 89. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 11:15:01 +08:00' --until='2026-10-26 11:15:01 +08:00' --full-history --no-merges -- gluten-iceberg/src/main/scala/org/apache/gluten/execution/IcebergScanTransformer.scala`: 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: gluten-substrait/src/main/scala/org/apache/gluten/expression/ConverterUtils.scala gluten-substrait/src/main/scala/org/apache/gluten/expression/ConverterUtils.scala:419 — gluten-substrait/src/main/scala/org/apache/gluten/expression/ConverterUtils.scala changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 20 in ConverterUtils.getTypeSigName at line 419. 2 of those changes were fix/bug commits, and the other 3 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 11:15:01 +08:00' --until='2026-10-26 11:15:01 +08:00' --full-history --no-merges -- gluten-substrait/src/main/scala/org/apache/gluten/expression/ConverterUtils.scala`: 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: gluten-iceberg/src/main/scala/org/apache/gluten/execution/IcebergWriteExec.scala gluten-iceberg/src/main/scala/org/apache/gluten/execution/IcebergWriteExec.scala:113 — gluten-iceberg/src/main/scala/org/apache/gluten/execution/IcebergWriteExec.scala changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 15 in IcebergWriteExec.doValidateInternal at line 113. 2 of those changes were fix/bug commits, and the other 4 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 11:15:01 +08:00' --until='2026-10-26 11:15:01 +08:00' --full-history --no-merges -- gluten-iceberg/src/main/scala/org/apache/gluten/execution/IcebergWriteExec.scala`: 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: .github/workflows/util/iceberg-upstream/compare.py .github/workflows/util/iceberg-upstream/compare.py:265 — .github/workflows/util/iceberg-upstream/compare.py changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 33 in compare.main at line 265. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 11:15:01 +08:00' --until='2026-10-26 11:15:01 +08:00' --full-history --no-merges -- .github/workflows/util/iceberg-upstream/compare.py`: 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: gluten-substrait/src/main/scala/org/apache/spark/sql/execution/GlutenAutoAdjustStageResourceProfile.scala gluten-substrait/src/main/scala/org/apache/spark/sql/execution/GlutenAutoAdjustStageResourceProfile.scala:64 — gluten-substrait/src/main/scala/org/apache/spark/sql/execution/GlutenAutoAdjustStageResourceProfile.scala changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 16 in GlutenAutoAdjustStageResourceProfile.apply at line 64. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 11:15:01 +08:00' --until='2026-10-26 11:15:01 +08:00' --full-history --no-merges -- gluten-substrait/src/main/scala/org/apache/spark/sql/execution/GlutenAutoAdjustStageResourceProfile.scala`: 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: gluten-substrait/src/main/java/org/apache/gluten/substrait/rel/LocalFilesNode.java gluten-substrait/src/main/java/org/apache/gluten/substrait/rel/LocalFilesNode.java:191 — gluten-substrait/src/main/java/org/apache/gluten/substrait/rel/LocalFilesNode.java changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 22 in LocalFilesNode.toProtobuf at line 191. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 11:15:01 +08:00' --until='2026-10-26 11:15:01 +08:00' --full-history --no-merges -- gluten-substrait/src/main/java/org/apache/gluten/substrait/rel/LocalFilesNode.java`: 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: backends-velox/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala backends-velox/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:150 — backends-velox/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 15 in ColumnarArrowPythonRunner.createNewWriter 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-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 11:15:01 +08:00' --until='2026-10-26 11:15:01 +08:00' --full-history --no-merges -- backends-velox/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala`: 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.
D4 · Code Duplication · Duplicated block (25 lines × 2) · ×11
  • Duplicated block (25 lines × 2) backends-bolt/src-iceberg/main/scala/org/apache/gluten/connector/write/IcebergDataWriteFactory.scala:67 — backends-bolt/src-iceberg/main/scala/org/apache/gluten/connector/write/IcebergDataWriteFactory.scala:67-91 | backends-velox/src-iceberg/main/scala/org/apache/gluten/connector/write/IcebergDataWriteFactory.scala:67-91 — before extracting anything, compare `backends-bolt/src-iceberg/main/scala/org/apache/gluten/connector/write/IcebergDataWriteFactory.scala` and `backends-velox/src-iceberg/main/scala/org/apache/gluten/connector/write/IcebergDataWriteFactory.scala` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (25 lines × 2) backends-bolt/src-iceberg/main/scala/org/apache/gluten/connector/write/IcebergDataWriteFactory.scala:104 — backends-bolt/src-iceberg/main/scala/org/apache/gluten/connector/write/IcebergDataWriteFactory.scala:104-128 | backends-velox/src-iceberg/main/scala/org/apache/gluten/connector/write/IcebergDataWriteFactory.scala:104-128 — before extracting anything, compare `backends-bolt/src-iceberg/main/scala/org/apache/gluten/connector/write/IcebergDataWriteFactory.scala` and `backends-velox/src-iceberg/main/scala/org/apache/gluten/connector/write/IcebergDataWriteFactory.scala` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (25 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarCollectTailExec.scala:37 — backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarCollectTailExec.scala:37-61 | backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarCollectTailExec.scala:37-61 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarCollectTailExec.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarCollectTailExec.scala` as WHOLE FILES: 95% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 `backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarCollectTailExec.scala:37` 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 (25 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala:183 — backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala:183-207 | backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala:192-216 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 151 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 `backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala:183` 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) backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:276 — backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:276-300 | backends-velox/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:284-308 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 337 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 `backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:276` 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 (25 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:400 — backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:400-424 | backends-velox/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:408-432 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 337 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 (25 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala:216 — backends-bolt/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala:216-240 | backends-velox/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala:220-244 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala` and `backends-velox/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 295 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 (25 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:71 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:71-95 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:107-131 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 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 (25 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:455 — backends-bolt/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:455-479 | backends-velox/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:508-532 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 204 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 (25 lines × 2) shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:896 — shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:896-920 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:896-920 — before extracting anything, compare `shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 1133 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 `shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:896` 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 (25 lines × 2) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala:339 — backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala:339-363 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala:339-363 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala` and `backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 238 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 `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala:339` 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 (24 lines × 2) · ×11
  • Duplicated block (24 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltRuleApi.scala:88 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltRuleApi.scala:88-111 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxRuleApi.scala:105-128 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltRuleApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxRuleApi.scala` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 36 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxRuleApi.scala:129` calls `injectPostTransform` and `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltRuleApi.scala:112` 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 (24 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala:98 — backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala:98-121 | backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala:102-125 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 151 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 (24 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala:248 — backends-bolt/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala:248-271 | backends-velox/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala:246-269 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 225 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 `backends-bolt/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala:248` 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 (24 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/extension/RewriteUnboundedWindow.scala:48 — backends-bolt/src/main/scala/org/apache/gluten/extension/RewriteUnboundedWindow.scala:48-71 | backends-velox/src/main/scala/org/apache/gluten/extension/RewriteUnboundedWindow.scala:48-71 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/extension/RewriteUnboundedWindow.scala` and `backends-velox/src/main/scala/org/apache/gluten/extension/RewriteUnboundedWindow.scala` as WHOLE FILES: 92% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 `backends-bolt/src/main/scala/org/apache/gluten/extension/RewriteUnboundedWindow.scala:48` 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 (24 lines × 2) backends-bolt/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala:105 — backends-bolt/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala:105-128 | backends-velox/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala:49-72 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala` and `backends-velox/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 75 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 (24 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:667 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:667-690 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:954-977 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 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 `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:667` 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 (24 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/execution/utils/ExecUtil.scala:180 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/utils/ExecUtil.scala:180-203 | backends-velox/src/main/scala/org/apache/spark/sql/execution/utils/ExecUtil.scala:185-208 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/utils/ExecUtil.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/utils/ExecUtil.scala` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 128 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 `backends-bolt/src/main/scala/org/apache/spark/sql/execution/utils/ExecUtil.scala:180` 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 (24 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:190 — backends-bolt/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:190-213 | backends-velox/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:194-217 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 204 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 (24 lines × 2) gluten-delta/src-delta33/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala:403 — gluten-delta/src-delta33/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala:403-426 | gluten-delta/src-delta4/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala:414-437 — before extracting anything, compare `gluten-delta/src-delta33/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala` and `gluten-delta/src-delta4/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 188 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 (24 lines × 2) gluten-delta/src-delta33/main/scala/org/apache/gluten/execution/DeltaProjectExecTransformer.scala:52 — gluten-delta/src-delta33/main/scala/org/apache/gluten/execution/DeltaProjectExecTransformer.scala:52-75 | gluten-delta/src-delta4/main/scala/org/apache/gluten/execution/DeltaProjectExecTransformer.scala:52-75 — before extracting anything, compare `gluten-delta/src-delta33/main/scala/org/apache/gluten/execution/DeltaProjectExecTransformer.scala` and `gluten-delta/src-delta4/main/scala/org/apache/gluten/execution/DeltaProjectExecTransformer.scala` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (24 lines × 2) backends-bolt/src/main/java/org/apache/gluten/metrics/OperatorMetrics.java:116 — backends-bolt/src/main/java/org/apache/gluten/metrics/OperatorMetrics.java:116-139 | backends-velox/src/main/java/org/apache/gluten/metrics/OperatorMetrics.java:121-144 — before extracting anything, compare `backends-bolt/src/main/java/org/apache/gluten/metrics/OperatorMetrics.java` and `backends-velox/src/main/java/org/apache/gluten/metrics/OperatorMetrics.java` as WHOLE FILES: 98% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 what the matched lines are: every one of them assigns one field to another, so the block is a hand-written mapper between two data shapes rather than behaviour with a helper inside it. Extracting one shared function only works if both sites map the SAME pair of types in the same direction — check that first, because inverse or differently-typed mappers have no single function they can both call. Where they do not, the moves that exist are a generated or reflective mapper, a common embedded/base type the fields live on once, or accepting the run and covering it with a test that fails when a field is added to one side only.
D4 · Code Duplication · Duplicated block (15 lines × 2) · ×11
  • Duplicated block (15 lines × 2) backends-bolt/src-iceberg/main/scala/org/apache/gluten/extension/OffloadIcebergWrite.scala:74 — backends-bolt/src-iceberg/main/scala/org/apache/gluten/extension/OffloadIcebergWrite.scala:74-88 | backends-velox/src-iceberg/main/scala/org/apache/gluten/extension/OffloadIcebergWrite.scala:99-113 — 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 (15 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:904 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:904-918 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala:1297-1311 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 498 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 (15 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala:167 — backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala:167-181 | backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala:176-190 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 151 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 `backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala:167` 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 before the matched lines, `backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala:174` calls `initialize`, `getPartitionId` and `backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala:165` 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 (15 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/expression/ExpressionTransformer.scala:63 — backends-bolt/src/main/scala/org/apache/gluten/expression/ExpressionTransformer.scala:63-77 | backends-velox/src/main/scala/org/apache/gluten/expression/ExpressionTransformer.scala:63-77 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/expression/ExpressionTransformer.scala` and `backends-velox/src/main/scala/org/apache/gluten/expression/ExpressionTransformer.scala` as WHOLE FILES: 96% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (15 lines × 2) backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:432 — backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:432-446 | backends-velox/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:547-561 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala` and `backends-velox/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 286 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 (15 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:193 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:193-207 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:336-350 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 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 `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:193` 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) backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHSparkPlanExecApi.scala:220 — backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHSparkPlanExecApi.scala:220-234 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHSparkPlanExecApi.scala:246-260 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/extension/BloomFilterMightContainJointRewriteRule.scala:51 — backends-bolt/src/main/scala/org/apache/gluten/extension/BloomFilterMightContainJointRewriteRule.scala:51-65 | backends-velox/src/main/scala/org/apache/gluten/extension/BloomFilterMightContainJointRewriteRule.scala:51-65 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/extension/BloomFilterMightContainJointRewriteRule.scala` and `backends-velox/src/main/scala/org/apache/gluten/extension/BloomFilterMightContainJointRewriteRule.scala` as WHOLE FILES: 94% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 `backends-bolt/src/main/scala/org/apache/gluten/extension/BloomFilterMightContainJointRewriteRule.scala:51` 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 (15 lines × 2) backends-bolt/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleWriter.scala:401 — backends-bolt/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleWriter.scala:401-415 | backends-velox/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleWriter.scala:316-330 — 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 (15 lines × 2) gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGroupAggregate.java:208 — gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGroupAggregate.java:208-222 | gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGroupWindowAggregate.java:241-255 — before extracting anything, compare `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGroupAggregate.java` and `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGroupWindowAggregate.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 36 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 `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGroupAggregate.java:208` 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) gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGroupAggregate.java:225 — gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGroupAggregate.java:225-239 | gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGroupWindowAggregate.java:258-272 — before extracting anything, compare `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGroupAggregate.java` and `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGroupWindowAggregate.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 36 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 `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGroupAggregate.java: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. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (5 lines × 2) · ×10
  • Duplicated block (5 lines × 2) backends-bolt/src-iceberg/main/scala/org/apache/iceberg/transforms/IcebergTransformUtil.scala:27 — backends-bolt/src-iceberg/main/scala/org/apache/iceberg/transforms/IcebergTransformUtil.scala:27-31 | backends-velox/src-iceberg/main/scala/org/apache/iceberg/transforms/IcebergTransformUtil.scala:27-31 — before extracting anything, compare `backends-bolt/src-iceberg/main/scala/org/apache/iceberg/transforms/IcebergTransformUtil.scala` and `backends-velox/src-iceberg/main/scala/org/apache/iceberg/transforms/IcebergTransformUtil.scala` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 32 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 `backends-bolt/src-iceberg/main/scala/org/apache/iceberg/transforms/IcebergTransformUtil.scala:27` 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) backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:80 — backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:80-84 | backends-velox/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:88-92 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 337 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 × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:92 — backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:92-96 | backends-velox/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:100-104 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 337 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 × 2) backends-clickhouse/src/main/scala/org/apache/spark/rpc/GlutenDriverEndpoint.scala:120 — backends-clickhouse/src/main/scala/org/apache/spark/rpc/GlutenDriverEndpoint.scala:120-124 | backends-velox/src/main/scala/org/apache/spark/rpc/GlutenDriverEndpoint.scala:118-122 — before extracting anything, compare `backends-clickhouse/src/main/scala/org/apache/spark/rpc/GlutenDriverEndpoint.scala` and `backends-velox/src/main/scala/org/apache/spark/rpc/GlutenDriverEndpoint.scala` 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. 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 × 2) backends-velox/src/main/scala/org/apache/spark/sql/execution/joins/SparkHashJoinUtils.scala:26 — backends-velox/src/main/scala/org/apache/spark/sql/execution/joins/SparkHashJoinUtils.scala:26-30 | gluten-substrait/src/main/scala/org/apache/spark/sql/execution/ColumnarSubqueryBroadcastExec.scala:73-77 — 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) gluten-delta/src-delta33/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala:165 — gluten-delta/src-delta33/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala:165-169 | gluten-delta/src-delta4/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala:166-170 — before extracting anything, compare `gluten-delta/src-delta33/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala` and `gluten-delta/src-delta4/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 188 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 `gluten-delta/src-delta33/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala:165` 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 (5 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltRuleApi.scala:125 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltRuleApi.scala:125-129 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxRuleApi.scala:141-145 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltRuleApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxRuleApi.scala` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 36 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxRuleApi.scala:146` calls `injectPost`, `GenerateTransformStageId` and `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltRuleApi.scala:130` 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 (5 lines × 2) gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecExchange.java:149 — gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecExchange.java:149-153 | gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecJoin.java:253-257 — 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) gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecJoin.java:255 — gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecJoin.java:255-259 | gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWindowJoin.java:182-186 — before extracting anything, compare `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecJoin.java` and `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWindowJoin.java` 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.
  • Duplicated block (5 lines × 2) gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecCalc.java:124 — gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecCalc.java:124-128 | gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWatermarkAssigner.java:133-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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWatermarkAssigner.java:130` calls `get`, `toMillis` and `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecCalc.java:121` 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.
D3 · God Classes · ClassTooLong · ×9
  • ClassTooLong: BoltSparkPlanExecApi backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:72 — ClassTooLong — 932 significant lines (blank, comment-only and punctuation-only lines excluded), 0 methods. The bar is 400 significant lines; this is 532 over it, 2.33× 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: GlutenShuffleBlockFetcherIterator shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:93 — ClassTooLong — 891 significant lines (blank, comment-only and punctuation-only lines excluded), 24 methods. The bar is 400 significant lines; this is 491 over it, 2.23× 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: GlutenShuffleBlockFetcherIterator shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:93 — ClassTooLong — 889 significant lines (blank, comment-only and punctuation-only lines excluded), 24 methods. The bar is 400 significant lines; this is 489 over it, 2.22× 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: CHSparkPlanExecApi backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHSparkPlanExecApi.scala:72 — ClassTooLong — 740 significant lines (blank, comment-only and punctuation-only lines excluded), 4 methods. The bar is 400 significant lines; this is 340 over it, 1.85× 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: VeloxMetricsApi backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:33 — ClassTooLong — 737 significant lines (blank, comment-only and punctuation-only lines excluded), 6 methods. The bar is 400 significant lines; this is 337 over it, 1.84× 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: BoltMetricsApi backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:33 — ClassTooLong — 697 significant lines (blank, comment-only and punctuation-only lines excluded), 2 methods. The bar is 400 significant lines; this is 297 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: CelebornUtils gluten-celeborn/src/main/java/org/apache/spark/shuffle/gluten/celeborn/CelebornUtils.java:45 — ClassTooLong — 564 significant lines (blank, comment-only and punctuation-only lines excluded), 22 methods. The bar is 400 significant lines; this is 164 over it, 1.41× 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: TaskManagerRunner gluten-flink/runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskManagerRunner.java:111 — ClassTooLong — 471 significant lines (blank, comment-only and punctuation-only lines excluded), 23 methods. The bar is 400 significant lines; this is 71 over it, 1.18× 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: ClickHouseSparkCatalog backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/execution/datasources/v2/clickhouse/ClickHouseSparkCatalog.scala:52 — ClassTooLong — 439 significant lines (blank, comment-only and punctuation-only lines excluded), 8 methods. The bar is 400 significant lines; this is 39 over it, 1.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.
D36 · Supply-chain Provenance & Signing REDACTED · ×9
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D3 · God Classes · TooManyMethods · ×8
  • TooManyMethods: SparkPlanExecApi gluten-substrait/src/main/scala/org/apache/gluten/backendsapi/SparkPlanExecApi.scala:53 — TooManyMethods — 64 methods. The bar is 30 methods; this is 34 over it, 2.13× 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: GlutenAbstractStreamOperator gluten-flink/runtime/src/main/java/org/apache/gluten/streaming/api/operators/GlutenAbstractStreamOperator.java:121 — TooManyMethods — 54 methods. The bar is 30 methods; this is 24 over it, 1.80× 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: ExpressionBuilder gluten-substrait/src/main/java/org/apache/gluten/substrait/expression/ExpressionBuilder.java:34 — 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: Snapshot backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/Snapshot.scala:84 — TooManyMethods — 36 methods. The bar is 30 methods; this is 6 over it, 1.20× 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: RelBuilder gluten-substrait/src/main/java/org/apache/gluten/substrait/rel/RelBuilder.java:38 — TooManyMethods — 34 methods. The bar is 30 methods; this is 4 over it, 1.13× 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: GlutenTwoInputOperator gluten-flink/runtime/src/main/java/org/apache/gluten/table/runtime/operators/GlutenTwoInputOperator.java:60 — TooManyMethods — 33 methods. The bar is 30 methods; this is 3 over it, 1.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.
  • TooManyMethods: DeltaLog backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/DeltaLog.scala:83 — TooManyMethods — 31 methods. The bar is 30 methods; this is 1 over it, 1.03× 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: DeltaLog backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/DeltaLog.scala:694 — TooManyMethods — 31 methods. The bar is 30 methods; this is 1 over it, 1.03× 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.
D4 · Code Duplication · Duplicated block (27 lines × 2) · ×8
  • Duplicated block (27 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:48 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:48-74 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:48-74 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala` as WHOLE FILES: this scan already matched 35 separate duplicated blocks between them, totalling at least 485 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:48` 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 (27 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:592 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:592-618 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala:635-661 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 498 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 `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala:635` 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, `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala:631` calls `contains` and `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:591` 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 (27 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/BoltColumnarToRowExec.scala:118 — backends-bolt/src/main/scala/org/apache/gluten/execution/BoltColumnarToRowExec.scala:118-144 | backends-velox/src/main/scala/org/apache/gluten/execution/VeloxColumnarToRowExec.scala:128-154 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/BoltColumnarToRowExec.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/VeloxColumnarToRowExec.scala` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 102 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 (27 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialGenerateExec.scala:131 — backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialGenerateExec.scala:131-157 | backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarPartialGenerateExec.scala:130-156 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialGenerateExec.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarPartialGenerateExec.scala` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 122 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 `backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialGenerateExec.scala:131` 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 (27 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/execution/BroadcastUtils.scala:125 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/BroadcastUtils.scala:125-151 | backends-velox/src/main/scala/org/apache/spark/sql/execution/BroadcastUtils.scala:116-142 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/BroadcastUtils.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/BroadcastUtils.scala` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 109 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 `backends-bolt/src/main/scala/org/apache/spark/sql/execution/BroadcastUtils.scala:125` 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 (27 lines × 2) backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/ClickhouseOptimisticTransaction.scala:344 — backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/ClickhouseOptimisticTransaction.scala:344-370 | backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala:208-234 — before extracting anything, compare `backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/ClickhouseOptimisticTransaction.scala` and `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 90 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 `backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/ClickhouseOptimisticTransaction.scala:344` 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, `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala:237` calls `appendAll` and `backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/ClickhouseOptimisticTransaction.scala:372` 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 (27 lines × 2) backends-velox/src-celeborn/main/scala/org/apache/spark/shuffle/VeloxCelebornColumnarBatchSerializer.scala:201 — backends-velox/src-celeborn/main/scala/org/apache/spark/shuffle/VeloxCelebornColumnarBatchSerializer.scala:201-227 | backends-velox/src/main/scala/org/apache/gluten/vectorized/ColumnarBatchSerializer.scala:192-218 — 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 `backends-velox/src-celeborn/main/scala/org/apache/spark/shuffle/VeloxCelebornColumnarBatchSerializer.scala:201` 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, `backends-velox/src-celeborn/main/scala/org/apache/spark/shuffle/VeloxCelebornColumnarBatchSerializer.scala:199` calls `initStream` and `backends-velox/src/main/scala/org/apache/gluten/vectorized/ColumnarBatchSerializer.scala:190` 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 (27 lines × 2) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala:201 — backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala:201-227 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala:201-227 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala` and `backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 238 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.
D4 · Code Duplication · Duplicated block (11 lines × 3) · ×8
  • Duplicated block (11 lines × 3) backends-bolt/src/main/scala/org/apache/spark/sql/execution/BoltColumnarWriteFilesExec.scala:185 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/BoltColumnarWriteFilesExec.scala:185-195 | backends-clickhouse/src/main/scala/org/apache/spark/sql/execution/CHColumnarWriteFilesExec.scala:75-85 | backends-velox/src/main/scala/org/apache/spark/sql/execution/VeloxColumnarWriteFilesExec.scala:190-200 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/BoltColumnarWriteFilesExec.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/VeloxColumnarWriteFilesExec.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 148 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 `backends-bolt/src/main/scala/org/apache/spark/sql/execution/BoltColumnarWriteFilesExec.scala:185` 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) backends-bolt/src/main/scala/org/apache/spark/sql/execution/BoltColumnarWriteFilesExec.scala:275 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/BoltColumnarWriteFilesExec.scala:275-285 | backends-clickhouse/src/main/scala/org/apache/spark/sql/execution/CHColumnarWriteFilesExec.scala:172-182 | backends-velox/src/main/scala/org/apache/spark/sql/execution/VeloxColumnarWriteFilesExec.scala:277-287 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/BoltColumnarWriteFilesExec.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/VeloxColumnarWriteFilesExec.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 148 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 `backends-bolt/src/main/scala/org/apache/spark/sql/execution/BoltColumnarWriteFilesExec.scala:275` 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 × 3) backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/execution/datasources/v1/clickhouse/MergeTreeFileFormatWriter.scala:157 — backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/execution/datasources/v1/clickhouse/MergeTreeFileFormatWriter.scala:157-167 | backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:154-164 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:165-175 — before extracting anything, compare `backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/execution/datasources/v1/clickhouse/MergeTreeFileFormatWriter.scala` and `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 55 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 (11 lines × 3) backends-clickhouse/src/main/scala/org/apache/gluten/utils/CHPartitionsUtil.scala:59 — backends-clickhouse/src/main/scala/org/apache/gluten/utils/CHPartitionsUtil.scala:59-69 | shims/spark34/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:265-275 | shims/spark35/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:256-266 — 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 `backends-clickhouse/src/main/scala/org/apache/gluten/utils/CHPartitionsUtil.scala:59` 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 × 3) shims/spark35/src/main/scala/org/apache/spark/sql/execution/datasources/v2/AbstractBatchScanExec.scala:124 — shims/spark35/src/main/scala/org/apache/spark/sql/execution/datasources/v2/AbstractBatchScanExec.scala:124-134 | shims/spark40/src/main/scala/org/apache/spark/sql/execution/datasources/v2/AbstractBatchScanExec.scala:128-138 | shims/spark41/src/main/scala/org/apache/spark/sql/execution/datasources/v2/AbstractBatchScanExec.scala:129-139 — before extracting anything, compare `shims/spark40/src/main/scala/org/apache/spark/sql/execution/datasources/v2/AbstractBatchScanExec.scala` and `shims/spark41/src/main/scala/org/apache/spark/sql/execution/datasources/v2/AbstractBatchScanExec.scala` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 3 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (11 lines × 3) tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:300 — tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:300-310 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:534-544 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:624-634 — 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) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala:518 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala:518-528 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHBackend.scala:480-490 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxBackend.scala:517-528 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxBackend.scala` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 271 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 (11 lines × 3) gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecCalc.java:147 — gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecCalc.java:147-157 | gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecLocalWindowAggregate.java:227-239 | gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWatermarkAssigner.java:156-167 — 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 `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecCalc.java:147` 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.
D4 · Code Duplication · Duplicated block (35 lines × 2) · ×7
  • Duplicated block (35 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/BoltColumnarToRowExec.scala:169 — backends-bolt/src/main/scala/org/apache/gluten/execution/BoltColumnarToRowExec.scala:169-203 | backends-velox/src/main/scala/org/apache/gluten/execution/VeloxColumnarToRowExec.scala:179-213 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/BoltColumnarToRowExec.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/VeloxColumnarToRowExec.scala` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 102 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 `backends-bolt/src/main/scala/org/apache/gluten/execution/BoltColumnarToRowExec.scala:169` 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 (35 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:343 — backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:343-377 | backends-velox/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:351-385 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 337 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 `backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:343` 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 (35 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:418 — backends-bolt/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:418-452 | backends-velox/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:471-505 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 204 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 (35 lines × 2) backends-clickhouse/src/main/scala/org/apache/gluten/metrics/HashJoinMetricsUpdater.scala:26 — backends-clickhouse/src/main/scala/org/apache/gluten/metrics/HashJoinMetricsUpdater.scala:26-60 | backends-clickhouse/src/main/scala/org/apache/gluten/metrics/SortMergeJoinMetricsUpdater.scala:27-61 — before extracting anything, compare `backends-clickhouse/src/main/scala/org/apache/gluten/metrics/HashJoinMetricsUpdater.scala` and `backends-clickhouse/src/main/scala/org/apache/gluten/metrics/SortMergeJoinMetricsUpdater.scala` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 94 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 `backends-clickhouse/src/main/scala/org/apache/gluten/metrics/HashJoinMetricsUpdater.scala:26` 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 (35 lines × 2) backends-clickhouse/src/main/scala/org/apache/gluten/utils/CHPartitionsUtil.scala:115 — backends-clickhouse/src/main/scala/org/apache/gluten/utils/CHPartitionsUtil.scala:115-149 | gluten-substrait/src/main/scala/org/apache/gluten/utils/PartitionsUtil.scala:110-144 — 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 (35 lines × 2) backends-bolt/src/main/scala/org/apache/spark/metrics/TaskStatsAccumulator.scala:25 — backends-bolt/src/main/scala/org/apache/spark/metrics/TaskStatsAccumulator.scala:25-59 | backends-velox/src/main/scala/org/apache/spark/metrics/TaskStatsAccumulator.scala:25-59 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/metrics/TaskStatsAccumulator.scala` and `backends-velox/src/main/scala/org/apache/spark/metrics/TaskStatsAccumulator.scala` as WHOLE FILES: 97% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (35 lines × 2) backends-clickhouse/src-delta33/main/scala/org/apache/gluten/parser/GlutenCacheFilesSqlParser.scala:30 — backends-clickhouse/src-delta33/main/scala/org/apache/gluten/parser/GlutenCacheFilesSqlParser.scala:30-64 | backends-clickhouse/src-delta33/main/scala/org/apache/gluten/parser/GlutenClickhouseSqlParser.scala:30-64 — before extracting anything, compare `backends-clickhouse/src-delta33/main/scala/org/apache/gluten/parser/GlutenCacheFilesSqlParser.scala` and `backends-clickhouse/src-delta33/main/scala/org/apache/gluten/parser/GlutenClickhouseSqlParser.scala` as WHOLE FILES: 95% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (22 lines × 2) · ×7
  • Duplicated block (22 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltListenerApi.scala:137 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltListenerApi.scala:137-158 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxListenerApi.scala:147-168 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltListenerApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxListenerApi.scala` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 112 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 `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxListenerApi.scala:147` 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, `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxListenerApi.scala:145` calls `GlutenExecutorEndpoint` and `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltListenerApi.scala:136` 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 (22 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:420 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:420-441 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:434-455 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala` as WHOLE FILES: this scan already matched 35 separate duplicated blocks between them, totalling at least 485 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:420` 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 (22 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/expression/ExpressionTransformer.scala:89 — backends-bolt/src/main/scala/org/apache/gluten/expression/ExpressionTransformer.scala:89-110 | backends-velox/src/main/scala/org/apache/gluten/expression/ExpressionTransformer.scala:89-110 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/expression/ExpressionTransformer.scala` and `backends-velox/src/main/scala/org/apache/gluten/expression/ExpressionTransformer.scala` as WHOLE FILES: 96% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (22 lines × 2) backends-clickhouse/src-celeborn/main/scala/org/apache/spark/shuffle/CHCelebornColumnarBatchSerializer.scala:106 — backends-clickhouse/src-celeborn/main/scala/org/apache/spark/shuffle/CHCelebornColumnarBatchSerializer.scala:106-127 | backends-velox/src-celeborn/main/scala/org/apache/spark/shuffle/VeloxCelebornColumnarBatchSerializer.scala:163-184 — 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 `backends-clickhouse/src-celeborn/main/scala/org/apache/spark/shuffle/CHCelebornColumnarBatchSerializer.scala:106` 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) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenParquetFileFormat.scala:60 — backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenParquetFileFormat.scala:60-81 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenParquetFileFormat.scala:60-81 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenParquetFileFormat.scala` and `backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenParquetFileFormat.scala` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (22 lines × 2) backends-bolt/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java:174 — backends-bolt/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java:174-195 | backends-velox/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java:174-195 — before extracting anything, compare `backends-bolt/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java` and `backends-velox/src/main/java/org/apache/gluten/fs/OnHeapFileSystem.java` as WHOLE FILES: this scan already matched 12 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. 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 (22 lines × 2) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala:314 — backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala:314-335 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala:314-335 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala` and `backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 238 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 `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala:314` 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 (18 lines × 2) · ×7
  • Duplicated block (18 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltIteratorApi.scala:365 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltIteratorApi.scala:365-382 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxIteratorApi.scala:363-380 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltIteratorApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxIteratorApi.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 110 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltIteratorApi.scala:365` 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) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltListenerApi.scala:165 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltListenerApi.scala:165-182 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxListenerApi.scala:175-192 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltListenerApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxListenerApi.scala` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 112 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 (18 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:531 — backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:531-548 | backends-velox/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:539-556 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 337 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 (18 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala:281 — backends-bolt/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala:281-298 | backends-velox/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala:293-310 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala` and `backends-velox/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 295 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 `backends-bolt/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala:281` 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 lines × 2) backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:374 — backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:374-391 | backends-velox/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:487-504 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala` and `backends-velox/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 286 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 `backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:374` 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 lines × 2) backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHWindowGroupLimitExecTransformer.scala:123 — backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHWindowGroupLimitExecTransformer.scala:123-140 | gluten-substrait/src/main/scala/org/apache/gluten/execution/WindowGroupLimitExecTransformer.scala:121-138 — before extracting anything, compare `backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHWindowGroupLimitExecTransformer.scala` and `gluten-substrait/src/main/scala/org/apache/gluten/execution/WindowGroupLimitExecTransformer.scala` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 119 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 `backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHWindowGroupLimitExecTransformer.scala:123` 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 lines × 2) shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:691 — shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:691-708 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:691-708 — before extracting anything, compare `shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 1133 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 `shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:691` 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.
D29 · Static Analysis (SAST) · REDACTED · ×6
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D3 · God Classes · MethodTooLong · ×6
  • MethodTooLong: StreamExecJoin.translateToPlanInternal gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecJoin.java:175 — MethodTooLong — translateToPlanInternal runs 170 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 70 over it, 1.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.
  • MethodTooLong: StreamExecWindowAggregate.translateToPlanInternal gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWindowAggregate.java:173 — MethodTooLong — translateToPlanInternal runs 126 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 26 over it, 1.26× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: StreamExecGlobalWindowAggregate.translateToPlanInternal gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGlobalWindowAggregate.java:172 — MethodTooLong — translateToPlanInternal runs 119 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 19 over it, 1.19× 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: LocalFilesNode.toProtobuf gluten-substrait/src/main/java/org/apache/gluten/substrait/rel/LocalFilesNode.java:191 — MethodTooLong — toProtobuf runs 115 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 15 over it, 1.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.
  • MethodTooLong: BaseMixin.runActions tools/gluten-it/common/src/main/java/org/apache/gluten/integration/BaseMixin.java:191 — MethodTooLong — runActions runs 112 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 12 over it, 1.12× 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: StreamExecWindowJoin.translateToPlanInternal gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWindowJoin.java:155 — MethodTooLong — translateToPlanInternal runs 101 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1 over it, 1.01× 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.
D4 · Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) · ×6
  • Members sharing a duplicated core (4 members, 50+ identical tokens) backends-bolt/src-celeborn/main/scala/org/apache/spark/shuffle/BoltCelebornColumnarBatchSerializer.scala:239 — backends-bolt/src-celeborn/main/scala/org/apache/spark/shuffle/BoltCelebornColumnarBatchSerializer.scala:239-271 | backends-bolt/src/main/scala/org/apache/gluten/vectorized/ColumnarBatchSerializer.scala:214-245 | backends-velox/src-celeborn/main/scala/org/apache/spark/shuffle/VeloxCelebornColumnarBatchSerializer.scala:198-227 | backends-velox/src/main/scala/org/apache/gluten/vectorized/ColumnarBatchSerializer.scala:190-218 — 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) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:77 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:77-91 | backends-bolt/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala:209-223 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:100-114 | backends-velox/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala:363-377 — 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) backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/ClickhouseOptimisticTransaction.scala:97 — backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/ClickhouseOptimisticTransaction.scala:97-200 | backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/ClickhouseOptimisticTransaction.scala:240-373 | backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala:50-241 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala:64-266 — 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) shims/spark34/src/main/scala/org/apache/gluten/sql/shims/spark34/Spark34Shims.scala:188 — shims/spark34/src/main/scala/org/apache/gluten/sql/shims/spark34/Spark34Shims.scala:188-293 | shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala:231-336 | shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala:248-370 | shims/spark41/src/main/scala/org/apache/gluten/sql/shims/spark41/Spark41Shims.scala:247-369 — 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) shims/spark35/src/main/scala/org/apache/gluten/execution/PartitionedFileUtilShim.scala:120 — shims/spark35/src/main/scala/org/apache/gluten/execution/PartitionedFileUtilShim.scala:120-150 | shims/spark40/src/main/scala/org/apache/gluten/execution/PartitionedFileUtilShim.scala:139-168 | shims/spark41/src/main/scala/org/apache/gluten/execution/PartitionedFileUtilShim.scala:139-168 | shims/spark42/src/main/scala/org/apache/gluten/execution/PartitionedFileUtilShim.scala:139-168 — 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) shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala:177 — shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala:177-191 | shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala:193-207 | shims/spark41/src/main/scala/org/apache/gluten/sql/shims/spark41/Spark41Shims.scala:192-206 | shims/spark42/src/main/scala/org/apache/gluten/sql/shims/spark42/Spark42Shims.scala:200-214 — 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 · Duplicated block (29 lines × 2) · ×6
  • Duplicated block (29 lines × 2) backends-bolt/src-celeborn/main/scala/org/apache/spark/shuffle/BoltCelebornColumnarBatchSerializer.scala:243 — backends-bolt/src-celeborn/main/scala/org/apache/spark/shuffle/BoltCelebornColumnarBatchSerializer.scala:243-271 | backends-bolt/src/main/scala/org/apache/gluten/vectorized/ColumnarBatchSerializer.scala:217-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 `backends-bolt/src-celeborn/main/scala/org/apache/spark/shuffle/BoltCelebornColumnarBatchSerializer.scala:243` 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, `backends-bolt/src-celeborn/main/scala/org/apache/spark/shuffle/BoltCelebornColumnarBatchSerializer.scala:241` calls `initStream` and `backends-bolt/src/main/scala/org/apache/gluten/vectorized/ColumnarBatchSerializer.scala:215` 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 (29 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltIteratorApi.scala:175 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltIteratorApi.scala:175-203 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxIteratorApi.scala:190-218 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltIteratorApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxIteratorApi.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 110 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 (29 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:143 — backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:143-171 | backends-velox/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:152-180 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 337 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 `backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:143` 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 (29 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/metrics/FileSourceScanMetricsUpdater.scala:62 — backends-bolt/src/main/scala/org/apache/gluten/metrics/FileSourceScanMetricsUpdater.scala:62-90 | backends-bolt/src/main/scala/org/apache/gluten/metrics/HiveTableScanMetricsUpdater.scala:57-85 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/metrics/FileSourceScanMetricsUpdater.scala` and `backends-bolt/src/main/scala/org/apache/gluten/metrics/HiveTableScanMetricsUpdater.scala` as WHOLE FILES: 98% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (29 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/execution/datasources/bolt/BoltFormatWriterInjects.scala:65 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/datasources/bolt/BoltFormatWriterInjects.scala:65-93 | backends-velox/src/main/scala/org/apache/spark/sql/execution/datasources/velox/VeloxFormatWriterInjects.scala:65-93 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/datasources/bolt/BoltFormatWriterInjects.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/datasources/velox/VeloxFormatWriterInjects.scala` as WHOLE FILES: 84% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 `backends-bolt/src/main/scala/org/apache/spark/sql/execution/datasources/bolt/BoltFormatWriterInjects.scala:65` 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 (29 lines × 2) tools/gluten-it/common/src/main/java/org/apache/gluten/integration/BaseMixin.java:211 — tools/gluten-it/common/src/main/java/org/apache/gluten/integration/BaseMixin.java:211-239 | tools/gluten-it/common/src/main/java/org/apache/gluten/integration/BaseMixin.java:241-269 — both copies are in the same file, so extract the 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 `tools/gluten-it/common/src/main/java/org/apache/gluten/integration/BaseMixin.java:211` 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.
D4 · Code Duplication · Duplicated block (23 lines × 2) · ×6
  • Duplicated block (23 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/extension/PartialProjectRule.scala:28 — backends-bolt/src/main/scala/org/apache/gluten/extension/PartialProjectRule.scala:28-50 | backends-velox/src/main/scala/org/apache/gluten/extension/PartialProjectRule.scala:28-50 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/extension/PartialProjectRule.scala` and `backends-velox/src/main/scala/org/apache/gluten/extension/PartialProjectRule.scala` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (23 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/execution/BroadcastModeUtils.scala:88 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/BroadcastModeUtils.scala:88-110 | backends-velox/src/main/scala/org/apache/spark/sql/execution/BroadcastModeUtils.scala:88-110 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/BroadcastModeUtils.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/BroadcastModeUtils.scala` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 71 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 (23 lines × 2) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/stats/GlutenDeltaJobStatsTracker.scala:229 — backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/stats/GlutenDeltaJobStatsTracker.scala:229-251 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/stats/GlutenDeltaJobStatsTracker.scala:233-255 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/stats/GlutenDeltaJobStatsTracker.scala` and `backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/stats/GlutenDeltaJobStatsTracker.scala` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 119 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 `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/stats/GlutenDeltaJobStatsTracker.scala:229` 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 (23 lines × 2) gluten-delta/src-delta33/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala:195 — gluten-delta/src-delta33/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala:195-217 | gluten-delta/src-delta4/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala:196-218 — before extracting anything, compare `gluten-delta/src-delta33/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala` and `gluten-delta/src-delta4/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 188 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 (23 lines × 2) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala:165 — backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala:165-187 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala:165-187 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala` and `backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 238 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 (23 lines × 2) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala:367 — backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala:367-389 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala:367-389 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala` and `backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 238 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 `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala:367` 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 (15 lines × 4) · ×6
  • Duplicated block (15 lines × 4) backends-bolt/src/main/scala/org/apache/gluten/metrics/FilterMetricsUpdater.scala:31 — backends-bolt/src/main/scala/org/apache/gluten/metrics/FilterMetricsUpdater.scala:31-45 | backends-bolt/src/main/scala/org/apache/gluten/metrics/ProjectMetricsUpdater.scala:31-45 | backends-velox/src/main/scala/org/apache/gluten/metrics/FilterMetricsUpdater.scala:31-45 | backends-velox/src/main/scala/org/apache/gluten/metrics/ProjectMetricsUpdater.scala:31-45 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/metrics/FilterMetricsUpdater.scala` and `backends-bolt/src/main/scala/org/apache/gluten/metrics/ProjectMetricsUpdater.scala` as WHOLE FILES: 97% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 `backends-bolt/src/main/scala/org/apache/gluten/metrics/FilterMetricsUpdater.scala:31` 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 × 4) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:77 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:77-91 | backends-bolt/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala:209-223 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:100-114 | backends-velox/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala:363-377 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala` and `backends-bolt/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 100 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (15 lines × 4) backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:186 — backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:186-200 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:281-295 | backends-velox/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala:145-159 | backends-velox/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala:241-255 — before extracting anything, compare `backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 179 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 `backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:186` 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 (15 lines × 4) shims/spark35/src/main/scala/org/apache/gluten/execution/PartitionedFileUtilShim.scala:136 — shims/spark35/src/main/scala/org/apache/gluten/execution/PartitionedFileUtilShim.scala:136-150 | shims/spark40/src/main/scala/org/apache/gluten/execution/PartitionedFileUtilShim.scala:154-168 | shims/spark41/src/main/scala/org/apache/gluten/execution/PartitionedFileUtilShim.scala:154-168 | shims/spark42/src/main/scala/org/apache/gluten/execution/PartitionedFileUtilShim.scala:154-168 — before extracting anything, compare `shims/spark35/src/main/scala/org/apache/gluten/execution/PartitionedFileUtilShim.scala` and `shims/spark40/src/main/scala/org/apache/gluten/execution/PartitionedFileUtilShim.scala` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 `shims/spark35/src/main/scala/org/apache/gluten/execution/PartitionedFileUtilShim.scala:136` 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 × 4) shims/spark35/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:285 — shims/spark35/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:285-299 | shims/spark40/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:285-299 | shims/spark41/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:285-299 | shims/spark42/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:285-299 — before extracting anything, compare `shims/spark35/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala` and `shims/spark40/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 169 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 `shims/spark35/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:285` 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 × 4) shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala:114 — shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala:114-128 | shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala:129-143 | shims/spark41/src/main/scala/org/apache/gluten/sql/shims/spark41/Spark41Shims.scala:128-142 | shims/spark42/src/main/scala/org/apache/gluten/sql/shims/spark42/Spark42Shims.scala:136-150 — before extracting anything, compare `shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala` and `shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 140 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (8 lines × 3) · ×6
  • Duplicated block (8 lines × 3) backends-bolt/src/main/scala/org/apache/spark/sql/execution/datasources/bolt/BoltParquetWriterInjects.scala:34 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/datasources/bolt/BoltParquetWriterInjects.scala:34-41 | backends-clickhouse/src/main/scala/org/apache/spark/sql/execution/datasources/v1/CHParquetWriterInjects.scala:35-43 | backends-velox/src/main/scala/org/apache/spark/sql/execution/datasources/velox/VeloxParquetWriterInjects.scala:37-44 — 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. 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, `backends-velox/src/main/scala/org/apache/spark/sql/execution/datasources/velox/VeloxParquetWriterInjects.scala:34` calls `put` and `backends-bolt/src/main/scala/org/apache/spark/sql/execution/datasources/bolt/BoltParquetWriterInjects.scala:33` 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 (8 lines × 3) backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHAggregateGroupLimitExecTransformer.scala:164 — backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHAggregateGroupLimitExecTransformer.scala:164-171 | backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHWindowGroupLimitExecTransformer.scala:177-184 | gluten-substrait/src/main/scala/org/apache/gluten/execution/WindowGroupLimitExecTransformer.scala:167-174 — before extracting anything, compare `backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHAggregateGroupLimitExecTransformer.scala` and `backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHWindowGroupLimitExecTransformer.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 114 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 × 3) backends-clickhouse/src/main/scala/org/apache/gluten/metrics/BatchScanMetricsUpdater.scala:41 — backends-clickhouse/src/main/scala/org/apache/gluten/metrics/BatchScanMetricsUpdater.scala:41-48 | backends-clickhouse/src/main/scala/org/apache/gluten/metrics/FileSourceScanMetricsUpdater.scala:57-64 | backends-clickhouse/src/main/scala/org/apache/gluten/metrics/HiveTableScanMetricsUpdater.scala:38-45 — before extracting anything, compare `backends-clickhouse/src/main/scala/org/apache/gluten/metrics/BatchScanMetricsUpdater.scala` and `backends-clickhouse/src/main/scala/org/apache/gluten/metrics/FileSourceScanMetricsUpdater.scala` as WHOLE FILES: 85% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 `backends-clickhouse/src/main/scala/org/apache/gluten/metrics/BatchScanMetricsUpdater.scala:41` 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) tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:348 — tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:348-355 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:413-420 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:422-429 — 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) tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/metrics/PlanMetric.scala:85 — tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/metrics/PlanMetric.scala:85-92 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/metrics/PlanMetric.scala:138-145 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/metrics/PlanMetric.scala:176-184 — 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 `tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/metrics/PlanMetric.scala:85` 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 before the matched lines, `tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/metrics/PlanMetric.scala:83` calls `filter`, `containsTags`, `sortBy` and `tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/metrics/PlanMetric.scala:175` 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 (8 lines × 3) shims/spark35/src/main/scala/org/apache/spark/sql/execution/datasources/v2/AbstractBatchScanExec.scala:44 — shims/spark35/src/main/scala/org/apache/spark/sql/execution/datasources/v2/AbstractBatchScanExec.scala:44-51 | shims/spark40/src/main/scala/org/apache/spark/sql/execution/datasources/v2/AbstractBatchScanExec.scala:47-54 | shims/spark41/src/main/scala/org/apache/spark/sql/execution/datasources/v2/AbstractBatchScanExec.scala:48-55 — before extracting anything, compare `shims/spark40/src/main/scala/org/apache/spark/sql/execution/datasources/v2/AbstractBatchScanExec.scala` and `shims/spark41/src/main/scala/org/apache/spark/sql/execution/datasources/v2/AbstractBatchScanExec.scala` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 3 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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.
D6 · Cohesion (LCOM4) · Low cohesion · ×6
  • Low cohesion: AbstractHiveTableScanExec (LCOM4 5) shims/spark34/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:58 — AbstractHiveTableScanExec'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: AbstractHiveTableScanExec (LCOM4 5) shims/spark35/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:58 — AbstractHiveTableScanExec'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: AbstractHiveTableScanExec (LCOM4 5) shims/spark40/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:58 — AbstractHiveTableScanExec'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: AbstractHiveTableScanExec (LCOM4 5) shims/spark41/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:58 — AbstractHiveTableScanExec'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: AbstractHiveTableScanExec (LCOM4 5) shims/spark42/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:58 — AbstractHiveTableScanExec'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: FilterExecTransformerBase (LCOM4 4) gluten-substrait/src/main/scala/org/apache/gluten/execution/BasicPhysicalOperatorTransformer.scala:40 — FilterExecTransformerBase'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.
D1 · Cyclomatic Complexity · GlutenShuffleBlockFetcherIterator.next (cyclomatic 39) · ×5
  • GlutenShuffleBlockFetcherIterator.next (cyclomatic 39) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:879 — GlutenShuffleBlockFetcherIterator.next has cyclomatic complexity 39 (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.
  • GlutenShuffleBlockFetcherIterator.next (cyclomatic 39) shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:879 — GlutenShuffleBlockFetcherIterator.next has cyclomatic complexity 39 (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.
  • GlutenShuffleBlockFetcherIterator.next (cyclomatic 39) shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:888 — GlutenShuffleBlockFetcherIterator.next has cyclomatic complexity 39 (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.
  • GlutenShuffleBlockFetcherIterator.next (cyclomatic 39) shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:895 — GlutenShuffleBlockFetcherIterator.next has cyclomatic complexity 39 (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.
  • GlutenShuffleBlockFetcherIterator.next (cyclomatic 39) shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:895 — GlutenShuffleBlockFetcherIterator.next has cyclomatic complexity 39 (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 · GlutenShuffleBlockFetcherIterator.next (cognitive 100) · ×5
  • GlutenShuffleBlockFetcherIterator.next (cognitive 100) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:879 — GlutenShuffleBlockFetcherIterator.next has cognitive complexity 100 (threshold 15). Drivers by points: if/else 28 (77 pts), error handling 3 (11 pts), match/switch 2 (7 pts), boolean chains 4, loops 1 (nesting depth added 62). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • GlutenShuffleBlockFetcherIterator.next (cognitive 100) shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:879 — GlutenShuffleBlockFetcherIterator.next has cognitive complexity 100 (threshold 15). Drivers by points: if/else 28 (77 pts), error handling 3 (11 pts), match/switch 2 (7 pts), boolean chains 4, loops 1 (nesting depth added 62). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • GlutenShuffleBlockFetcherIterator.next (cognitive 100) shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:888 — GlutenShuffleBlockFetcherIterator.next has cognitive complexity 100 (threshold 15). Drivers by points: if/else 28 (77 pts), error handling 3 (11 pts), match/switch 2 (7 pts), boolean chains 4, loops 1 (nesting depth added 62). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • GlutenShuffleBlockFetcherIterator.next (cognitive 100) shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:895 — GlutenShuffleBlockFetcherIterator.next has cognitive complexity 100 (threshold 15). Drivers by points: if/else 28 (77 pts), error handling 3 (11 pts), match/switch 2 (7 pts), boolean chains 4, loops 1 (nesting depth added 62). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • GlutenShuffleBlockFetcherIterator.next (cognitive 100) shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:895 — GlutenShuffleBlockFetcherIterator.next has cognitive complexity 100 (threshold 15). Drivers by points: if/else 28 (77 pts), error handling 3 (11 pts), match/switch 2 (7 pts), boolean chains 4, loops 1 (nesting depth added 62). To reduce it, split the body into named stages: move each independent 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 · GlutenShuffleBlockFetcherIterator.fetchUpToMaxBytes (cognitive 24) · ×5
  • GlutenShuffleBlockFetcherIterator.fetchUpToMaxBytes (cognitive 24) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1297 — GlutenShuffleBlockFetcherIterator.fetchUpToMaxBytes has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 3 (6 pts), boolean chains 4 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • GlutenShuffleBlockFetcherIterator.fetchUpToMaxBytes (cognitive 24) shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1299 — GlutenShuffleBlockFetcherIterator.fetchUpToMaxBytes has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 3 (6 pts), boolean chains 4 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • GlutenShuffleBlockFetcherIterator.fetchUpToMaxBytes (cognitive 24) shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1315 — GlutenShuffleBlockFetcherIterator.fetchUpToMaxBytes has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 3 (6 pts), boolean chains 4 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • GlutenShuffleBlockFetcherIterator.fetchUpToMaxBytes (cognitive 24) shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1319 — GlutenShuffleBlockFetcherIterator.fetchUpToMaxBytes has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 3 (6 pts), boolean chains 4 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • GlutenShuffleBlockFetcherIterator.fetchUpToMaxBytes (cognitive 24) shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1319 — GlutenShuffleBlockFetcherIterator.fetchUpToMaxBytes has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 3 (6 pts), boolean chains 4 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GlutenShuffleBlockFetcherIterator.collectFetchRequests (cognitive 20) · ×5
  • GlutenShuffleBlockFetcherIterator.collectFetchRequests (cognitive 20) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:545 — GlutenShuffleBlockFetcherIterator.collectFetchRequests has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 2 (4 pts), boolean chains 3, 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.
  • GlutenShuffleBlockFetcherIterator.collectFetchRequests (cognitive 20) shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:545 — GlutenShuffleBlockFetcherIterator.collectFetchRequests has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 2 (4 pts), boolean chains 3, 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.
  • GlutenShuffleBlockFetcherIterator.collectFetchRequests (cognitive 20) shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:552 — GlutenShuffleBlockFetcherIterator.collectFetchRequests has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 2 (4 pts), boolean chains 3, 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.
  • GlutenShuffleBlockFetcherIterator.collectFetchRequests (cognitive 20) shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:559 — GlutenShuffleBlockFetcherIterator.collectFetchRequests has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 2 (4 pts), boolean chains 3, 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.
  • GlutenShuffleBlockFetcherIterator.collectFetchRequests (cognitive 20) shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:559 — GlutenShuffleBlockFetcherIterator.collectFetchRequests has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 2 (4 pts), boolean chains 3, 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 · GlutenShuffleBlockFetcherIterator.sendRequest (cognitive 19) · ×5
  • GlutenShuffleBlockFetcherIterator.sendRequest (cognitive 19) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:269 — GlutenShuffleBlockFetcherIterator.sendRequest has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (16 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.
  • GlutenShuffleBlockFetcherIterator.sendRequest (cognitive 19) shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:269 — GlutenShuffleBlockFetcherIterator.sendRequest has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (16 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.
  • GlutenShuffleBlockFetcherIterator.sendRequest (cognitive 19) shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:270 — GlutenShuffleBlockFetcherIterator.sendRequest has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (16 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.
  • GlutenShuffleBlockFetcherIterator.sendRequest (cognitive 19) shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:277 — GlutenShuffleBlockFetcherIterator.sendRequest has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (16 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.
  • GlutenShuffleBlockFetcherIterator.sendRequest (cognitive 19) shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:277 — GlutenShuffleBlockFetcherIterator.sendRequest has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (16 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 · GlutenShuffleBlockFetcherIterator.cleanup (cognitive 17) · ×5
  • GlutenShuffleBlockFetcherIterator.cleanup (cognitive 17) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:227 — GlutenShuffleBlockFetcherIterator.cleanup has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2, match/switch 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.
  • GlutenShuffleBlockFetcherIterator.cleanup (cognitive 17) shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:227 — GlutenShuffleBlockFetcherIterator.cleanup has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2, match/switch 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.
  • GlutenShuffleBlockFetcherIterator.cleanup (cognitive 17) shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:228 — GlutenShuffleBlockFetcherIterator.cleanup has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2, match/switch 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.
  • GlutenShuffleBlockFetcherIterator.cleanup (cognitive 17) shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:235 — GlutenShuffleBlockFetcherIterator.cleanup has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2, match/switch 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.
  • GlutenShuffleBlockFetcherIterator.cleanup (cognitive 17) shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:235 — GlutenShuffleBlockFetcherIterator.cleanup has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2, match/switch 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.
D29 · Static Analysis (SAST) · REDACTED · ×5
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (26 lines × 2) · ×5
  • Duplicated block (26 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala:376 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala:376-401 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxBackend.scala:335-360 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxBackend.scala` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 271 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 (26 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala:129 — backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala:129-154 | backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala:137-162 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 151 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 `backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala:129` 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 (26 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala:55 — backends-bolt/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala:55-80 | backends-velox/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala:55-80 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala` and `backends-velox/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 295 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 (26 lines × 2) backends-clickhouse/src/main/scala/org/apache/spark/rpc/GlutenDriverEndpoint.scala:66 — backends-clickhouse/src/main/scala/org/apache/spark/rpc/GlutenDriverEndpoint.scala:66-91 | backends-velox/src/main/scala/org/apache/spark/rpc/GlutenDriverEndpoint.scala:64-89 — before extracting anything, compare `backends-clickhouse/src/main/scala/org/apache/spark/rpc/GlutenDriverEndpoint.scala` and `backends-velox/src/main/scala/org/apache/spark/rpc/GlutenDriverEndpoint.scala` 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. 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 `backends-clickhouse/src/main/scala/org/apache/spark/rpc/GlutenDriverEndpoint.scala:66` 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 (26 lines × 2) gluten-delta/src-delta33/main/scala/org/apache/gluten/execution/DeltaFilterExecTransformer.scala:51 — gluten-delta/src-delta33/main/scala/org/apache/gluten/execution/DeltaFilterExecTransformer.scala:51-76 | gluten-delta/src-delta4/main/scala/org/apache/gluten/execution/DeltaFilterExecTransformer.scala:51-76 — before extracting anything, compare `gluten-delta/src-delta33/main/scala/org/apache/gluten/execution/DeltaFilterExecTransformer.scala` and `gluten-delta/src-delta4/main/scala/org/apache/gluten/execution/DeltaFilterExecTransformer.scala` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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.
D4 · Code Duplication · Duplicated block (14 lines × 3) · ×5
  • Duplicated block (14 lines × 3) backends-bolt/src-celeborn/main/scala/org/apache/spark/shuffle/BoltCelebornColumnarShuffleWriter.scala:237 — backends-bolt/src-celeborn/main/scala/org/apache/spark/shuffle/BoltCelebornColumnarShuffleWriter.scala:237-250 | backends-bolt/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleWriter.scala:295-308 | backends-velox/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleWriter.scala:192-205 — 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 `backends-bolt/src-celeborn/main/scala/org/apache/spark/shuffle/BoltCelebornColumnarShuffleWriter.scala: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 (14 lines × 3) backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHAggregateGroupLimitExecTransformer.scala:120 — backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHAggregateGroupLimitExecTransformer.scala:120-133 | backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHWindowGroupLimitExecTransformer.scala:129-142 | gluten-substrait/src/main/scala/org/apache/gluten/execution/WindowGroupLimitExecTransformer.scala:127-140 — before extracting anything, compare `backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHAggregateGroupLimitExecTransformer.scala` and `backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHWindowGroupLimitExecTransformer.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 114 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 `backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHAggregateGroupLimitExecTransformer.scala:120` 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) shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala:70 — shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala:70-83 | shims/spark41/src/main/scala/org/apache/gluten/sql/shims/spark41/Spark41Shims.scala:69-82 | shims/spark42/src/main/scala/org/apache/gluten/sql/shims/spark42/Spark42Shims.scala:69-82 — before extracting anything, compare `shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala` and `shims/spark41/src/main/scala/org/apache/gluten/sql/shims/spark41/Spark41Shims.scala` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 299 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 `shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala:70` 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 × 3) shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala:442 — shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala:442-455 | shims/spark41/src/main/scala/org/apache/gluten/sql/shims/spark41/Spark41Shims.scala:469-482 | shims/spark42/src/main/scala/org/apache/gluten/sql/shims/spark42/Spark42Shims.scala:415-428 — before extracting anything, compare `shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala` and `shims/spark41/src/main/scala/org/apache/gluten/sql/shims/spark41/Spark41Shims.scala` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 299 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 (14 lines × 3) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1542 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1542-1555 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1544-1557 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1561-1574 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 1116 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.
D36 · Supply-chain Provenance & Signing · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D36 · Supply-chain Provenance & Signing REDACTED · ×4
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (33 lines × 2) · ×4
  • Duplicated block (33 lines × 2) backends-clickhouse/src/main/scala/org/apache/gluten/parser/GlutenCacheFileSqlParserBase.scala:51 — backends-clickhouse/src/main/scala/org/apache/gluten/parser/GlutenCacheFileSqlParserBase.scala:51-83 | backends-clickhouse/src/main/scala/org/apache/gluten/parser/GlutenClickhouseSqlParserBase.scala:53-85 — before extracting anything, compare `backends-clickhouse/src/main/scala/org/apache/gluten/parser/GlutenCacheFileSqlParserBase.scala` and `backends-clickhouse/src/main/scala/org/apache/gluten/parser/GlutenClickhouseSqlParserBase.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 98 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 `backends-clickhouse/src/main/scala/org/apache/gluten/parser/GlutenCacheFileSqlParserBase.scala:51` 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 (33 lines × 2) shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:380 — shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:380-412 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:380-412 — before extracting anything, compare `shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 1133 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 `shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:380` 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 (33 lines × 2) shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:803 — shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:803-835 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:803-835 — before extracting anything, compare `shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 1133 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 `shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:803` 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 (33 lines × 2) tools/scripts/gen-function-support-docs.py:1125 — tools/scripts/gen-function-support-docs.py:1125-1157 | tools/scripts/gen-function-support-docs.py:1226-1258 — both copies are in the same file, so extract the 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 (28 lines × 2) · ×4
  • Duplicated block (28 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:568 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:568-595 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:582-609 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala` as WHOLE FILES: this scan already matched 35 separate duplicated blocks between them, totalling at least 485 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:568` 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 (28 lines × 2) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:374 — backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:374-401 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:380-407 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala` and `backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 536 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 (28 lines × 2) gluten-delta/src-delta33/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala:132 — gluten-delta/src-delta33/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala:132-159 | gluten-delta/src-delta4/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala:133-160 — before extracting anything, compare `gluten-delta/src-delta33/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala` and `gluten-delta/src-delta4/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 188 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 (28 lines × 2) gluten-delta/src-delta33/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala:251 — gluten-delta/src-delta33/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala:251-278 | gluten-delta/src-delta4/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala:252-279 — before extracting anything, compare `gluten-delta/src-delta33/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala` and `gluten-delta/src-delta4/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 188 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.
D4 · Code Duplication · Duplicated block (22–23 lines × 2) · ×4
  • Duplicated block (22–23 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala:233 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala:233-255 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxBackend.scala:242-263 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxBackend.scala` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 271 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala:233` 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–23 lines × 2) backends-clickhouse/src/main/scala/org/apache/gluten/extension/LazyAggregateExpandRule.scala:78 — backends-clickhouse/src/main/scala/org/apache/gluten/extension/LazyAggregateExpandRule.scala:78-100 | backends-clickhouse/src/main/scala/org/apache/gluten/extension/LazyAggregateExpandRule.scala:126-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. Read the line range as the matched WINDOW rather than a finished unit: at `backends-clickhouse/src/main/scala/org/apache/gluten/extension/LazyAggregateExpandRule.scala:78` 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 (22–23 lines × 2) backends-clickhouse/src/main/scala/org/apache/spark/sql/execution/datasources/clickhouse/utils/MergeTreePartsPartitionsUtil.scala:329 — backends-clickhouse/src/main/scala/org/apache/spark/sql/execution/datasources/clickhouse/utils/MergeTreePartsPartitionsUtil.scala:329-351 | backends-clickhouse/src/main/scala/org/apache/spark/sql/execution/datasources/clickhouse/utils/MergeTreePartsPartitionsUtil.scala:390-411 — both copies are in the same file, so extract the block into 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–23 lines × 2) gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecJoin.java:274 — gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecJoin.java:274-296 | gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWindowJoin.java:192-213 — before extracting anything, compare `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecJoin.java` and `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWindowJoin.java` 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. Read the line range as the matched WINDOW rather than a finished unit: at `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecJoin.java:274` 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 × 3) · ×4
  • Duplicated block (10 lines × 3) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:47 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:47-56 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:48-57 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:47-56 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala` and `backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 127 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:47` 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 × 3) backends-bolt/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala:164 — backends-bolt/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala:164-173 | backends-velox/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala:88-97 | backends-velox/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala:119-128 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala` and `backends-velox/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 75 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 3) tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:308 — tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:308-317 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:466-475 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:542-551 — 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 (10 lines × 3) backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/perf/DeltaOptimizedWriterTransformer.scala:195 — backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/perf/DeltaOptimizedWriterTransformer.scala:195-205 | backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala:168-177 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala:168-177 — before extracting anything, compare `backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/perf/DeltaOptimizedWriterTransformer.scala` and `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 97 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 `backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/perf/DeltaOptimizedWriterTransformer.scala:195` 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 lines × 5) · ×4
  • Duplicated block (7 lines × 5) shims/spark34/src/main/scala/org/apache/gluten/sql/shims/spark34/Spark34Shims.scala:58 — shims/spark34/src/main/scala/org/apache/gluten/sql/shims/spark34/Spark34Shims.scala:58-64 | shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala:62-68 | shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala:68-74 | shims/spark41/src/main/scala/org/apache/gluten/sql/shims/spark41/Spark41Shims.scala:67-73 | shims/spark42/src/main/scala/org/apache/gluten/sql/shims/spark42/Spark42Shims.scala:67-73 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/gluten/sql/shims/spark34/Spark34Shims.scala` and `shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 168 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 `shims/spark34/src/main/scala/org/apache/gluten/sql/shims/spark34/Spark34Shims.scala:58` 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 before the matched lines, `shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala:64` calls `getLocalTableScanStream` and `shims/spark34/src/main/scala/org/apache/gluten/sql/shims/spark34/Spark34Shims.scala:55` 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 × 5) shims/spark34/src/main/scala/org/apache/spark/sql/execution/ExpandOutputPartitioningShim.scala:43 — shims/spark34/src/main/scala/org/apache/spark/sql/execution/ExpandOutputPartitioningShim.scala:43-49 | shims/spark35/src/main/scala/org/apache/spark/sql/execution/ExpandOutputPartitioningShim.scala:43-49 | shims/spark40/src/main/scala/org/apache/spark/sql/execution/ExpandOutputPartitioningShim.scala:43-49 | shims/spark41/src/main/scala/org/apache/spark/sql/execution/ExpandOutputPartitioningShim.scala:43-49 | shims/spark42/src/main/scala/org/apache/spark/sql/execution/ExpandOutputPartitioningShim.scala:43-49 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/sql/execution/ExpandOutputPartitioningShim.scala` and `shims/spark35/src/main/scala/org/apache/spark/sql/execution/ExpandOutputPartitioningShim.scala` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 5) shims/spark34/src/main/scala/org/apache/spark/sql/execution/ExpandOutputPartitioningShim.scala:53 — shims/spark34/src/main/scala/org/apache/spark/sql/execution/ExpandOutputPartitioningShim.scala:53-59 | shims/spark35/src/main/scala/org/apache/spark/sql/execution/ExpandOutputPartitioningShim.scala:53-59 | shims/spark40/src/main/scala/org/apache/spark/sql/execution/ExpandOutputPartitioningShim.scala:53-59 | shims/spark41/src/main/scala/org/apache/spark/sql/execution/ExpandOutputPartitioningShim.scala:53-59 | shims/spark42/src/main/scala/org/apache/spark/sql/execution/ExpandOutputPartitioningShim.scala:53-59 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/sql/execution/ExpandOutputPartitioningShim.scala` and `shims/spark35/src/main/scala/org/apache/spark/sql/execution/ExpandOutputPartitioningShim.scala` 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 `shims/spark34/src/main/scala/org/apache/spark/sql/execution/ExpandOutputPartitioningShim.scala:53` 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 × 5) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:617 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:617-623 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:617-623 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:624-630 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:631-637 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:631-637 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 1116 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 (9 lines × 4) · ×4
  • Duplicated block (9 lines × 4) shims/spark35/src/main/scala/org/apache/gluten/utils/InternalRowUtil.scala:24 — shims/spark35/src/main/scala/org/apache/gluten/utils/InternalRowUtil.scala:24-32 | shims/spark40/src/main/scala/org/apache/gluten/utils/InternalRowUtil.scala:24-32 | shims/spark41/src/main/scala/org/apache/gluten/utils/InternalRowUtil.scala:24-32 | shims/spark42/src/main/scala/org/apache/gluten/utils/InternalRowUtil.scala:24-32 — before extracting anything, compare `shims/spark35/src/main/scala/org/apache/gluten/utils/InternalRowUtil.scala` and `shims/spark40/src/main/scala/org/apache/gluten/utils/InternalRowUtil.scala` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 4) shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala:75 — shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala:75-83 | shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala:85-93 | shims/spark41/src/main/scala/org/apache/gluten/sql/shims/spark41/Spark41Shims.scala:84-92 | shims/spark42/src/main/scala/org/apache/gluten/sql/shims/spark42/Spark42Shims.scala:84-92 — before extracting anything, compare `shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala` and `shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 140 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 4) shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala:85 — shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala:85-93 | shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala:95-103 | shims/spark41/src/main/scala/org/apache/gluten/sql/shims/spark41/Spark41Shims.scala:94-102 | shims/spark42/src/main/scala/org/apache/gluten/sql/shims/spark42/Spark42Shims.scala:94-102 — before extracting anything, compare `shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala` and `shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 140 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 4) shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala:354 — shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala:354-362 | shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala:388-396 | shims/spark41/src/main/scala/org/apache/gluten/sql/shims/spark41/Spark41Shims.scala:387-395 | shims/spark42/src/main/scala/org/apache/gluten/sql/shims/spark42/Spark42Shims.scala:333-341 — before extracting anything, compare `shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala` and `shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 140 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.
X18 · Disposal-pattern correctness · Disposable created and abandoned in the function that made it · ×4
  • Disposable created and abandoned in the function that made it tools/workload/tpcds-delta/run_tpcds/tpcds_delta.scala:92 — `Source.fromFile(…)` opens something that has to be given back — a file descriptor, a socket, a directory handle — and its only use reads `.getLines` through it and drops it, so this expression both creates the value and is the last place that can release it, and does not. Every call leaks one more open handle until the collector happens to reach it: `Too many open files` under load, and on Windows a file that cannot be replaced or deleted while it is held. Open it with `scala.util.Using.resource(Source.fromFile(…)) { r => … }`, which releases it on every path including a throw, or hold it and call `.close()` in a `finally`.
  • Disposable created and abandoned in the function that made it tools/workload/tpcds/run_tpcds/tpcds_parquet.scala:118 — `Source.fromFile(…)` opens something that has to be given back — a file descriptor, a socket, a directory handle — and its only use reads `.getLines` through it and drops it, so this expression both creates the value and is the last place that can release it, and does not. Every call leaks one more open handle until the collector happens to reach it: `Too many open files` under load, and on Windows a file that cannot be replaced or deleted while it is held. Open it with `scala.util.Using.resource(Source.fromFile(…)) { r => … }`, which releases it on every path including a throw, or hold it and call `.close()` in a `finally`.
  • Disposable created and abandoned in the function that made it backends-velox/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:231 — `Files.walk(…)` opens something that has to be given back — a file descriptor, a socket, a directory handle — and its only use reads `.iterator` through it and drops it, so this expression both creates the value and is the last place that can release it, and does not. Every call leaks one more open handle until the collector happens to reach it: `Too many open files` under load, and on Windows a file that cannot be replaced or deleted while it is held. Open it with `scala.util.Using.resource(Files.walk(…)) { r => … }`, which releases it on every path including a throw, or hold it and call `.close()` in a `finally`.
  • Disposable created and abandoned in the function that made it backends-bolt/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:227 — `Files.walk(…)` opens something that has to be given back — a file descriptor, a socket, a directory handle — and its only use reads `.iterator` through it and drops it, so this expression both creates the value and is the last place that can release it, and does not. Every call leaks one more open handle until the collector happens to reach it: `Too many open files` under load, and on Windows a file that cannot be replaced or deleted while it is held. Open it with `scala.util.Using.resource(Files.walk(…)) { r => … }`, which releases it on every path including a throw, or hold it and call `.close()` in a `finally`.
X3 · Exception handling · Swallowed exception (empty catch) · ×4
  • Swallowed exception (empty catch) tools/scripts/gen-function-support-docs.py:943 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:589 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:619 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) backends-velox/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:198 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
D17 · Explicit Debt · HackComment · ×3
  • HackComment backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala:173 — // hack to materialize the shuffle files in a fault tolerant way — 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 backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala:173 — // hack to materialize the shuffle files in a fault tolerant way — 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 backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/perf/DeltaOptimizedWriterTransformer.scala:200 — // hack to materialize the shuffle files in a fault tolerant way — 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.
D35 · Change Coupling · Change-coupling hub · ×3
  • Change-coupling hub: BatchScanMetricsUpdater.scala → FileSourceScanMetricsUpdater.scala, HiveTableScanMetricsUpdater.scala, MetricsUtil.scala backends-velox/src/main/scala/org/apache/gluten/metrics/BatchScanMetricsUpdater.scala — `backends-velox/src/main/scala/org/apache/gluten/metrics/BatchScanMetricsUpdater.scala` changes together with 3 other files — `backends-velox/src/main/scala/org/apache/gluten/metrics/FileSourceScanMetricsUpdater.scala`, `backends-velox/src/main/scala/org/apache/gluten/metrics/HiveTableScanMetricsUpdater.scala`, `backends-velox/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala` — 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: Metrics.java → OperatorMetrics.java, VeloxMetricsApi.scala, BatchScanMetricsUpdater.scala, FileSourceScanMetricsUpdater.scala, HiveTableScanMetricsUpdater.scala backends-velox/src/main/java/org/apache/gluten/metrics/Metrics.java — `backends-velox/src/main/java/org/apache/gluten/metrics/Metrics.java` changes together with 5 other files — `backends-velox/src/main/java/org/apache/gluten/metrics/OperatorMetrics.java`, `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala`, `backends-velox/src/main/scala/org/apache/gluten/metrics/BatchScanMetricsUpdater.scala`, `backends-velox/src/main/scala/org/apache/gluten/metrics/FileSourceScanMetricsUpdater.scala`, `backends-velox/src/main/scala/org/apache/gluten/metrics/HiveTableScanMetricsUpdater.scala` — none of which declares a dependency on it: one file is the hub of 5 separate couplings, not 5 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 5.
  • Change-coupling hub: Spark35Shims.scala → Spark34Shims.scala, Spark40Shims.scala, Spark41Shims.scala shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala — `shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala` changes together with 3 other files — `shims/spark34/src/main/scala/org/apache/gluten/sql/shims/spark34/Spark34Shims.scala`, `shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala`, `shims/spark41/src/main/scala/org/apache/gluten/sql/shims/spark41/Spark41Shims.scala` — 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.
D36 · Supply-chain Provenance & Signing REDACTED · ×3
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (41 lines × 2) · ×3
  • Duplicated block (41 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala:198 — backends-bolt/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala:198-238 | backends-velox/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala:195-235 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 225 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 `backends-bolt/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala:198` 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 (41 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/execution/BoltColumnarWriteFilesExec.scala:198 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/BoltColumnarWriteFilesExec.scala:198-238 | backends-velox/src/main/scala/org/apache/spark/sql/execution/VeloxColumnarWriteFilesExec.scala:203-243 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/BoltColumnarWriteFilesExec.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/VeloxColumnarWriteFilesExec.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 148 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 `backends-bolt/src/main/scala/org/apache/spark/sql/execution/BoltColumnarWriteFilesExec.scala:198` 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 (41 lines × 2) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/stats/GlutenDeltaJobStatsTracker.scala:302 — backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/stats/GlutenDeltaJobStatsTracker.scala:302-342 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/stats/GlutenDeltaJobStatsTracker.scala:306-346 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/stats/GlutenDeltaJobStatsTracker.scala` and `backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/stats/GlutenDeltaJobStatsTracker.scala` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 119 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.
D4 · Code Duplication · Duplicated block (30 lines × 2) · ×3
  • Duplicated block (30 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:103 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:103-132 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:137-166 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 142 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 `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:103` 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 (30 lines × 2) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:616 — backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:616-645 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:614-643 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala` and `backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 536 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 (30 lines × 2) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/stats/GlutenDeltaJobStatsFallbackTracker.scala:33 — backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/stats/GlutenDeltaJobStatsFallbackTracker.scala:33-62 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/stats/GlutenDeltaJobStatsFallbackTracker.scala:33-62 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/stats/GlutenDeltaJobStatsFallbackTracker.scala` and `backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/stats/GlutenDeltaJobStatsFallbackTracker.scala` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/stats/GlutenDeltaJobStatsFallbackTracker.scala:33` 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 (23 lines × 5) · ×3
  • Duplicated block (23 lines × 5) shims/spark34/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:117 — shims/spark34/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:117-139 | shims/spark35/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:115-137 | shims/spark40/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:115-137 | shims/spark41/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:115-137 | shims/spark42/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:115-137 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala` and `shims/spark35/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 151 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 (23 lines × 5) shims/spark34/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:225 — shims/spark34/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:225-247 | shims/spark35/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:225-247 | shims/spark40/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:225-247 | shims/spark41/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:225-247 | shims/spark42/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:225-247 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala` and `shims/spark35/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 80 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 (23 lines × 5) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:312 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:312-334 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:312-334 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:312-334 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:312-334 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:312-334 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala` and `shims/spark35/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 197 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.
D4 · Code Duplication · Duplicated block (22 lines × 5) · ×3
  • Duplicated block (22 lines × 5) shims/spark34/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:142 — shims/spark34/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:142-163 | shims/spark35/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:140-161 | shims/spark40/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:140-161 | shims/spark41/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:140-161 | shims/spark42/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:140-161 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala` and `shims/spark35/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 151 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 (22 lines × 5) shims/spark34/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:128 — shims/spark34/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:128-149 | shims/spark35/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:128-149 | shims/spark40/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:128-149 | shims/spark41/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:128-149 | shims/spark42/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:128-149 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala` and `shims/spark35/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 80 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 (22 lines × 5) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:901 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:901-922 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:901-922 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:910-931 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:914-935 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:914-935 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 1116 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 `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:901` 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 (22 lines × 3) · ×3
  • Duplicated block (22 lines × 3) backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarCollectTailExec.scala:49 — backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarCollectTailExec.scala:49-70 | backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHColumnarCollectTailExec.scala:48-69 | backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarCollectTailExec.scala:49-70 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarCollectTailExec.scala` and `backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHColumnarCollectTailExec.scala` as WHOLE FILES: 90% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 `backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarCollectTailExec.scala:49` 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 (22 lines × 3) backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:129 — backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:129-150 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:187-208 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:245-266 — 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 `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:129` 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, `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:184` calls `createMetric` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:126` 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 (22 lines × 3) shims/spark40/src/main/scala/org/apache/gluten/execution/PartitionedFileUtilShim.scala:141 — shims/spark40/src/main/scala/org/apache/gluten/execution/PartitionedFileUtilShim.scala:141-162 | shims/spark41/src/main/scala/org/apache/gluten/execution/PartitionedFileUtilShim.scala:141-162 | shims/spark42/src/main/scala/org/apache/gluten/execution/PartitionedFileUtilShim.scala:141-162 — before extracting anything, compare `shims/spark40/src/main/scala/org/apache/gluten/execution/PartitionedFileUtilShim.scala` and `shims/spark41/src/main/scala/org/apache/gluten/execution/PartitionedFileUtilShim.scala` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 72 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 `shims/spark40/src/main/scala/org/apache/gluten/execution/PartitionedFileUtilShim.scala:141` 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 (21 lines × 3) · ×3
  • Duplicated block (21 lines × 3) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:109 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:109-129 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:159-179 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:209-229 — 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:109` 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, `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:157` calls `createMetric` and `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:107` 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 (21 lines × 3) backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHAggregateGroupLimitExecTransformer.scala:89 — backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHAggregateGroupLimitExecTransformer.scala:89-109 | backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHWindowGroupLimitExecTransformer.scala:99-119 | gluten-substrait/src/main/scala/org/apache/gluten/execution/WindowGroupLimitExecTransformer.scala:97-117 — before extracting anything, compare `backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHAggregateGroupLimitExecTransformer.scala` and `backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHWindowGroupLimitExecTransformer.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 114 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 `backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHAggregateGroupLimitExecTransformer.scala:89` 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 (21 lines × 3) shims/spark40/src/main/scala/org/apache/gluten/execution/PartitionedFileUtilShim.scala:80 — shims/spark40/src/main/scala/org/apache/gluten/execution/PartitionedFileUtilShim.scala:80-100 | shims/spark41/src/main/scala/org/apache/gluten/execution/PartitionedFileUtilShim.scala:80-100 | shims/spark42/src/main/scala/org/apache/gluten/execution/PartitionedFileUtilShim.scala:80-100 — before extracting anything, compare `shims/spark40/src/main/scala/org/apache/gluten/execution/PartitionedFileUtilShim.scala` and `shims/spark41/src/main/scala/org/apache/gluten/execution/PartitionedFileUtilShim.scala` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 72 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.
D4 · Code Duplication · Duplicated block (20 lines × 3) · ×3
  • Duplicated block (20 lines × 3) backends-velox/src/main/scala/org/apache/gluten/metrics/BatchScanMetricsUpdater.scala:80 — backends-velox/src/main/scala/org/apache/gluten/metrics/BatchScanMetricsUpdater.scala:80-99 | backends-velox/src/main/scala/org/apache/gluten/metrics/FileSourceScanMetricsUpdater.scala:75-94 | backends-velox/src/main/scala/org/apache/gluten/metrics/HiveTableScanMetricsUpdater.scala:71-90 — before extracting anything, compare `backends-velox/src/main/scala/org/apache/gluten/metrics/BatchScanMetricsUpdater.scala` and `backends-velox/src/main/scala/org/apache/gluten/metrics/FileSourceScanMetricsUpdater.scala` as WHOLE FILES: 84% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 `backends-velox/src/main/scala/org/apache/gluten/metrics/BatchScanMetricsUpdater.scala:80` 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 lines × 3) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:738 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:738-757 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:738-757 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:746-765 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 1116 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 `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:738` 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 lines × 3) shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1437 — shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1437-1456 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1441-1460 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1441-1460 — before extracting anything, compare `shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 30 separate duplicated blocks between them, totalling at least 983 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 `shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1437` 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–15 lines × 2) · ×3
  • Duplicated block (14–15 lines × 2) backends-bolt/src-celeborn/main/scala/org/apache/spark/shuffle/BoltCelebornColumnarShuffleWriter.scala:200 — backends-bolt/src-celeborn/main/scala/org/apache/spark/shuffle/BoltCelebornColumnarShuffleWriter.scala:200-214 | backends-velox/src-celeborn/main/scala/org/apache/spark/shuffle/VeloxCelebornColumnarShuffleWriter.scala:90-103 — 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 `backends-bolt/src-celeborn/main/scala/org/apache/spark/shuffle/BoltCelebornColumnarShuffleWriter.scala:200` 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 (14–15 lines × 2) backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:394 — backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:394-407 | backends-velox/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:507-521 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala` and `backends-velox/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 286 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 (14–15 lines × 2) gluten-arrow/src/main/java/org/apache/spark/sql/execution/unsafe/UnsafeByteArray.java:76 — gluten-arrow/src/main/java/org/apache/spark/sql/execution/unsafe/UnsafeByteArray.java:76-90 | gluten-arrow/src/main/java/org/apache/spark/sql/execution/unsafe/UnsafeByteArray.java:123-136 — both copies are in the same file, so extract the 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.
D4 · Code Duplication · Duplicated block (14 lines × 4) · ×3
  • Duplicated block (14 lines × 4) shims/spark35/src/main/scala/org/apache/gluten/execution/PartitionedFileUtilShim.scala:121 — shims/spark35/src/main/scala/org/apache/gluten/execution/PartitionedFileUtilShim.scala:121-134 | shims/spark40/src/main/scala/org/apache/gluten/execution/PartitionedFileUtilShim.scala:140-153 | shims/spark41/src/main/scala/org/apache/gluten/execution/PartitionedFileUtilShim.scala:140-153 | shims/spark42/src/main/scala/org/apache/gluten/execution/PartitionedFileUtilShim.scala:140-153 — before extracting anything, compare `shims/spark35/src/main/scala/org/apache/gluten/execution/PartitionedFileUtilShim.scala` and `shims/spark40/src/main/scala/org/apache/gluten/execution/PartitionedFileUtilShim.scala` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 `shims/spark35/src/main/scala/org/apache/gluten/execution/PartitionedFileUtilShim.scala:121` 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 × 4) shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala:178 — shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala:178-191 | shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala:194-207 | shims/spark41/src/main/scala/org/apache/gluten/sql/shims/spark41/Spark41Shims.scala:193-206 | shims/spark42/src/main/scala/org/apache/gluten/sql/shims/spark42/Spark42Shims.scala:201-214 — before extracting anything, compare `shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala` and `shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 140 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 (14 lines × 4) shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala:131 — shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala:131-144 | shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala:146-159 | shims/spark41/src/main/scala/org/apache/gluten/sql/shims/spark41/Spark41Shims.scala:145-158 | shims/spark42/src/main/scala/org/apache/gluten/sql/shims/spark42/Spark42Shims.scala:153-166 — before extracting anything, compare `shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala` and `shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 140 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 `shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala:131` 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–13 lines × 2) · ×3
  • Duplicated block (12–13 lines × 2) backends-clickhouse/src/main/scala/org/apache/gluten/metrics/BatchScanMetricsUpdater.scala:44 — backends-clickhouse/src/main/scala/org/apache/gluten/metrics/BatchScanMetricsUpdater.scala:44-56 | backends-clickhouse/src/main/scala/org/apache/gluten/metrics/HiveTableScanMetricsUpdater.scala:41-52 — before extracting anything, compare `backends-clickhouse/src/main/scala/org/apache/gluten/metrics/BatchScanMetricsUpdater.scala` and `backends-clickhouse/src/main/scala/org/apache/gluten/metrics/HiveTableScanMetricsUpdater.scala` as WHOLE FILES: 86% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 `backends-clickhouse/src/main/scala/org/apache/gluten/metrics/BatchScanMetricsUpdater.scala:44` 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–13 lines × 2) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:107 — backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:107-119 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:103-114 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala` and `backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 385 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 (12–13 lines × 2) gluten-substrait/src/main/scala/org/apache/spark/sql/execution/python/EvalPythonExecTransformer.scala:57 — gluten-substrait/src/main/scala/org/apache/spark/sql/execution/python/EvalPythonExecTransformer.scala:57-68 | gluten-substrait/src/main/scala/org/apache/spark/sql/execution/python/EvalPythonExecTransformer.scala:77-89 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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–12 lines × 2) · ×3
  • Duplicated block (11–12 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltIteratorApi.scala:272 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltIteratorApi.scala:272-282 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxIteratorApi.scala:267-278 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltIteratorApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxIteratorApi.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 110 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 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, `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltIteratorApi.scala:271` calls `WholeStageIteratorWrapper` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxIteratorApi.scala:265` 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 (11–12 lines × 2) backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:112 — backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:112-123 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:140-150 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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–12 lines × 2) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:130 — backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:130-141 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:125-135 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala` and `backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 385 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.
D4 · Code Duplication · Duplicated block (9 lines × 3) · ×3
  • Duplicated block (9 lines × 3) backends-bolt/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala:55 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala:55-63 | backends-bolt/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala:70-80 | backends-velox/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala:63-73 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 123 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 `backends-bolt/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala:70` 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 lines × 3) shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala:99 — shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala:99-107 | shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala:109-117 | shims/spark41/src/main/scala/org/apache/gluten/sql/shims/spark41/Spark41Shims.scala:108-116 — before extracting anything, compare `shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala` and `shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 140 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 (9 lines × 3) shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala:431 — shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala:431-439 | shims/spark41/src/main/scala/org/apache/gluten/sql/shims/spark41/Spark41Shims.scala:447-455 | shims/spark42/src/main/scala/org/apache/gluten/sql/shims/spark42/Spark42Shims.scala:393-401 — before extracting anything, compare `shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala` and `shims/spark41/src/main/scala/org/apache/gluten/sql/shims/spark41/Spark41Shims.scala` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 299 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.
D4 · Code Duplication · Duplicated block (8 lines × 5) · ×3
  • Duplicated block (8 lines × 5) shims/spark34/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:86 — shims/spark34/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:86-93 | shims/spark35/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:83-90 | shims/spark40/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:94-101 | shims/spark41/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:93-100 | shims/spark42/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:93-100 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala` and `shims/spark35/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala` as WHOLE FILES: 93% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 `shims/spark34/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:86` 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 × 5) tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:310 — tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:310-317 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:468-475 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:544-551 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:582-589 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:632-639 — 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.
  • Duplicated block (8 lines × 5) shims/spark34/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:83 — shims/spark34/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:83-90 | shims/spark35/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:83-90 | shims/spark40/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:83-90 | shims/spark41/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:83-90 | shims/spark42/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:83-90 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala` and `shims/spark35/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 80 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D1 · Cyclomatic Complexity · CachedColumnarBatchKryoSerializer.serializeStats (cyclomatic 25) · ×2
  • CachedColumnarBatchKryoSerializer.serializeStats (cyclomatic 25) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:190 — CachedColumnarBatchKryoSerializer.serializeStats 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.
  • CachedColumnarBatchKryoSerializer.serializeStats (cyclomatic 25) backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:333 — CachedColumnarBatchKryoSerializer.serializeStats 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 · CachedColumnarBatchKryoSerializer.deserializeStats (cyclomatic 20) · ×2
  • CachedColumnarBatchKryoSerializer.deserializeStats (cyclomatic 20) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:289 — CachedColumnarBatchKryoSerializer.deserializeStats has cyclomatic complexity 20 (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.
  • CachedColumnarBatchKryoSerializer.deserializeStats (cyclomatic 20) backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:440 — CachedColumnarBatchKryoSerializer.deserializeStats has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · GlutenDeltaParquetFileFormat.iteratorWithAdditionalMetadataColumns (cyclomatic 16) · ×2
  • GlutenDeltaParquetFileFormat.iteratorWithAdditionalMetadataColumns (cyclomatic 16) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:338 — GlutenDeltaParquetFileFormat.iteratorWithAdditionalMetadataColumns 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. This is NOT this file's highest cyclomatic complexity: GlutenDeltaParquetFileFormat.translateFilterForColumnMapping (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
  • GlutenDeltaParquetFileFormat.iteratorWithAdditionalMetadataColumns (cyclomatic 16) backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:331 — GlutenDeltaParquetFileFormat.iteratorWithAdditionalMetadataColumns 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. This is NOT this file's highest cyclomatic complexity: GlutenDeltaParquetFileFormat.translateFilterForColumnMapping (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D17 · Explicit Debt · FixmeComment repeated across 11 files · ×2
  • FixmeComment repeated across 11 files gluten-ut/spark42/src/test/scala/org/apache/gluten/utils/velox/VeloxTestSettings.scala:226 — The identical FixmeComment appears in 11 files (11 occurrences) — almost certainly one boilerplate line from a single migration or decision, not 11 independent debts. Fix the systemic cause once rather than file-by-file. Text: "// FIXME(yma11): ObjectType is not covered in RowEncoder/Serializer in vanilla spark". Source code is not a task system: track the cleanup where tasks live. (Every occurrence still counts toward the score and metrics.)
  • FixmeComment repeated across 11 files gluten-ut/spark42/src/test/scala/org/apache/gluten/utils/velox/VeloxTestSettings.scala:1210 — The identical FixmeComment appears in 11 files (11 occurrences) — almost certainly one boilerplate line from a single migration or decision, not 11 independent debts. Fix the systemic cause once rather than file-by-file. Text: "// FIXME: yan". 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 · CachedColumnarBatchKryoSerializer.serializeStats (cognitive 40) · ×2
  • CachedColumnarBatchKryoSerializer.serializeStats (cognitive 40) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:190 — CachedColumnarBatchKryoSerializer.serializeStats has cognitive complexity 40 (threshold 15). Drivers by points: if/else 18 (32 pts), boolean chains 4, match/switch 1 (3 pts), loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CachedColumnarBatchKryoSerializer.serializeStats (cognitive 40) backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:333 — CachedColumnarBatchKryoSerializer.serializeStats has cognitive complexity 40 (threshold 15). Drivers by points: if/else 18 (32 pts), boolean chains 4, match/switch 1 (3 pts), loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PullOutGenerateProjectHelper.pullOutPreProject (cognitive 31) · ×2
  • PullOutGenerateProjectHelper.pullOutPreProject (cognitive 31) backends-bolt/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala:175 — PullOutGenerateProjectHelper.pullOutPreProject has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 3 (9 pts), loops 2 (7 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.
  • PullOutGenerateProjectHelper.pullOutPreProject (cognitive 31) backends-velox/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala:171 — PullOutGenerateProjectHelper.pullOutPreProject has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 3 (9 pts), loops 2 (7 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 · ColumnarBuildSideRelation.transform (cognitive 25) · ×2
  • ColumnarBuildSideRelation.transform (cognitive 25) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:143 — ColumnarBuildSideRelation.transform has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 3 (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.
  • ColumnarBuildSideRelation.transform (cognitive 25) backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:373 — ColumnarBuildSideRelation.transform has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 3 (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 · UnsafeColumnarBuildSideRelation.transform (cognitive 25) · ×2
  • UnsafeColumnarBuildSideRelation.transform (cognitive 25) backends-bolt/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala:271 — UnsafeColumnarBuildSideRelation.transform has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 3 (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.
  • UnsafeColumnarBuildSideRelation.transform (cognitive 25) backends-velox/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala:436 — UnsafeColumnarBuildSideRelation.transform has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 3 (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 · GlutenDeltaParquetFileFormat.iteratorWithAdditionalMetadataColumns (cognitive 24) · ×2
  • GlutenDeltaParquetFileFormat.iteratorWithAdditionalMetadataColumns (cognitive 24) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:338 — GlutenDeltaParquetFileFormat.iteratorWithAdditionalMetadataColumns has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 3, match/switch 2 (3 pts), loops 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.
  • GlutenDeltaParquetFileFormat.iteratorWithAdditionalMetadataColumns (cognitive 24) backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:331 — GlutenDeltaParquetFileFormat.iteratorWithAdditionalMetadataColumns has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 3, match/switch 2 (3 pts), loops 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.
D2 · Cognitive Complexity · GenerateExecTransformer.getExtensionNode (cognitive 17) · ×2
  • GenerateExecTransformer.getExtensionNode (cognitive 17) backends-bolt/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala:103 — GenerateExecTransformer.getExtensionNode has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (17 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.
  • GenerateExecTransformer.getExtensionNode (cognitive 17) backends-velox/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala:103 — GenerateExecTransformer.getExtensionNode has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (17 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 · CachedColumnarBatchKryoSerializer.deserializeStats (cognitive 17) · ×2
  • CachedColumnarBatchKryoSerializer.deserializeStats (cognitive 17) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:289 — CachedColumnarBatchKryoSerializer.deserializeStats has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 5, match/switch 1 (3 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.
  • CachedColumnarBatchKryoSerializer.deserializeStats (cognitive 17) backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:440 — CachedColumnarBatchKryoSerializer.deserializeStats has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 5, match/switch 1 (3 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.
D2 · Cognitive Complexity · UDFResolver.getAllLibraries (cognitive 17) · ×2
  • UDFResolver.getAllLibraries (cognitive 17) backends-bolt/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:284 — UDFResolver.getAllLibraries has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 5 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • UDFResolver.getAllLibraries (cognitive 17) backends-velox/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:288 — UDFResolver.getAllLibraries has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 5 (nesting depth added 3). To reduce it, split the body into named stages: move each independent 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 · GlutenDeltaFileFormatWriter.executeWrite (cognitive 16) · ×2
  • GlutenDeltaFileFormatWriter.executeWrite (cognitive 16) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:236 — GlutenDeltaFileFormatWriter.executeWrite has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (13 pts), match/switch 1 (3 pts) (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.
  • GlutenDeltaFileFormatWriter.executeWrite (cognitive 16) backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:247 — GlutenDeltaFileFormatWriter.executeWrite has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (13 pts), match/switch 1 (3 pts) (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.
D4 · Code Duplication · Near-duplicate member pair (77 shared lines) · ×2
  • Near-duplicate member pair (77 shared lines) backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:274 — backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:274-377 | backends-velox/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:283-385 — These two members are variants of one another: 77 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.
  • Near-duplicate member pair (77 shared lines) backends-bolt/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala:175 — backends-bolt/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala:175-271 | backends-velox/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala:171-269 — These two members are variants of one another: 77 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Edited copy of a member (14 corresponding lines) · ×2
  • Edited copy of a member (14 corresponding lines) backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:83 — backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:83-96 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:442-460 — 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) backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:103 — backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:103-124 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:224-238 — 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.
D4 · Code Duplication · Members sharing a duplicated core (8 members, 50+ identical tokens) · ×2
  • Members sharing a duplicated core (8 members, 50+ identical tokens) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:93 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:93-132 | backends-bolt/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala:225-267 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:123-166 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:176-265 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:274-360 | backends-velox/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala:135-225 | backends-velox/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala:234-321 | backends-velox/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala:386-432 — These 8 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 8 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 8 times.
  • Members sharing a duplicated core (8 members, 50+ identical tokens) backends-clickhouse/src/main/scala/org/apache/gluten/metrics/CHRangeMetricsUpdater.scala:22 — backends-clickhouse/src/main/scala/org/apache/gluten/metrics/CHRangeMetricsUpdater.scala:22-44 | backends-clickhouse/src/main/scala/org/apache/gluten/metrics/ExpandMetricsUpdater.scala:23-45 | backends-clickhouse/src/main/scala/org/apache/gluten/metrics/FilterMetricsUpdater.scala:30-72 | backends-clickhouse/src/main/scala/org/apache/gluten/metrics/GenerateMetricsUpdater.scala:23-45 | backends-clickhouse/src/main/scala/org/apache/gluten/metrics/LimitMetricsUpdater.scala:23-34 | backends-clickhouse/src/main/scala/org/apache/gluten/metrics/ProjectMetricsUpdater.scala:29-72 | backends-clickhouse/src/main/scala/org/apache/gluten/metrics/SortMetricsUpdater.scala:23-45 | backends-clickhouse/src/main/scala/org/apache/gluten/metrics/WindowMetricsUpdater.scala:23-45 — These 8 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 8 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 8 times.
D4 · Code Duplication · Members sharing a duplicated core (7 members, 50+ identical tokens) · ×2
  • Members sharing a duplicated core (7 members, 50+ identical tokens) backends-bolt/src/main/scala/org/apache/gluten/execution/TopNTransformer.scala:99 — backends-bolt/src/main/scala/org/apache/gluten/execution/TopNTransformer.scala:99-122 | backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHAggregateGroupLimitExecTransformer.scala:87-151 | backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHWindowGroupLimitExecTransformer.scala:97-160 | backends-velox/src/main/scala/org/apache/gluten/execution/TopNTransformer.scala:99-122 | gluten-substrait/src/main/scala/org/apache/gluten/execution/SortExecTransformer.scala:69-93 | gluten-substrait/src/main/scala/org/apache/gluten/execution/WindowExecTransformer.scala:82-130 | gluten-substrait/src/main/scala/org/apache/gluten/execution/WindowGroupLimitExecTransformer.scala:95-150 — 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) tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:290 — tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:290-325 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:366-383 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:453-479 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:481-504 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:526-559 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:577-595 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:617-647 — 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 · Duplicated block (69 lines × 5) · ×2
  • Duplicated block (69 lines × 5) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:425 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:425-493 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:425-493 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:428-496 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:435-503 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:435-503 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 1116 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 `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:425` 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 (69 lines × 5) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1298 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1298-1366 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1300-1368 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1316-1384 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1320-1388 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1320-1388 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 1116 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.
D4 · Code Duplication · Duplicated block (56 lines × 2) · ×2
  • Duplicated block (56 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala:428 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala:428-483 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxBackend.scala:414-469 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxBackend.scala` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 271 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala:428` 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 (56 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:471 — backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:471-526 | backends-velox/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:479-534 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 337 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.
D4 · Code Duplication · Duplicated block (55 lines × 2) · ×2
  • Duplicated block (55 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltListenerApi.scala:78 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltListenerApi.scala:78-132 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxListenerApi.scala:86-140 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltListenerApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxListenerApi.scala` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 112 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltListenerApi.scala: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, `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxListenerApi.scala:145` calls `GlutenExecutorEndpoint` and `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltListenerApi.scala:137` 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 (55 lines × 2) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:503 — backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:503-557 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:480-534 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala` and `backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 385 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.
D4 · Code Duplication · Duplicated block (53 lines × 2) · ×2
  • Duplicated block (53 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala:104 — backends-bolt/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala:104-156 | backends-velox/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala:104-156 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 225 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 (53 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/utils/SharedLibraryLoaderUtils.scala:47 — backends-bolt/src/main/scala/org/apache/gluten/utils/SharedLibraryLoaderUtils.scala:47-99 | backends-velox/src/main/scala/org/apache/gluten/utils/SharedLibraryLoaderUtils.scala:47-99 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/utils/SharedLibraryLoaderUtils.scala` and `backends-velox/src/main/scala/org/apache/gluten/utils/SharedLibraryLoaderUtils.scala` as WHOLE FILES: 97% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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.
D4 · Code Duplication · Duplicated block (43 lines × 2) · ×2
  • Duplicated block (43 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala:118 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala:118-160 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxBackend.scala:121-163 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxBackend.scala` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 271 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala:118` 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 (43 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/metrics/JoinMetricsUpdater.scala:128 — backends-bolt/src/main/scala/org/apache/gluten/metrics/JoinMetricsUpdater.scala:128-170 | backends-velox/src/main/scala/org/apache/gluten/metrics/JoinMetricsUpdater.scala:143-185 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/metrics/JoinMetricsUpdater.scala` and `backends-velox/src/main/scala/org/apache/gluten/metrics/JoinMetricsUpdater.scala` 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. 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 (42 lines × 2) · ×2
  • Duplicated block (42 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:1194 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:1194-1235 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala:1631-1672 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 498 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:1194` 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 (42 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/execution/BroadcastUtils.scala:49 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/BroadcastUtils.scala:49-90 | backends-velox/src/main/scala/org/apache/spark/sql/execution/BroadcastUtils.scala:49-90 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/BroadcastUtils.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/BroadcastUtils.scala` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 109 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.
D4 · Code Duplication · Duplicated block (36 lines × 2) · ×2
  • Duplicated block (36 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarRangeExec.scala:64 — backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarRangeExec.scala:64-99 | backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarRangeExec.scala:66-101 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarRangeExec.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarRangeExec.scala` as WHOLE FILES: 89% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 `backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarRangeExec.scala:64` 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 (36 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala:243 — backends-bolt/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala:243-278 | backends-velox/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala:251-286 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala` and `backends-velox/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 295 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 `backends-bolt/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala: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.
D4 · Code Duplication · Duplicated block (32 lines × 2) · ×2
  • Duplicated block (32 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/utils/ParquetMetadataUtils.scala:39 — backends-bolt/src/main/scala/org/apache/gluten/utils/ParquetMetadataUtils.scala:39-70 | backends-velox/src/main/scala/org/apache/gluten/utils/ParquetMetadataUtils.scala:52-83 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/utils/ParquetMetadataUtils.scala` and `backends-velox/src/main/scala/org/apache/gluten/utils/ParquetMetadataUtils.scala` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 117 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 (32 lines × 2) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/stats/GlutenDeltaJobStatsRowCountingTracker.scala:33 — backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/stats/GlutenDeltaJobStatsRowCountingTracker.scala:33-64 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/stats/GlutenDeltaJobStatsRowCountingTracker.scala:33-64 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/stats/GlutenDeltaJobStatsRowCountingTracker.scala` and `backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/stats/GlutenDeltaJobStatsRowCountingTracker.scala` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/stats/GlutenDeltaJobStatsRowCountingTracker.scala:33` 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 (31 lines × 2) · ×2
  • Duplicated block (31 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala:328 — backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala:328-358 | backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala:324-354 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 151 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 (31 lines × 2) backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHAggregateGroupLimitExecTransformer.scala:121 — backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHAggregateGroupLimitExecTransformer.scala:121-151 | backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHWindowGroupLimitExecTransformer.scala:130-160 — before extracting anything, compare `backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHAggregateGroupLimitExecTransformer.scala` and `backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHWindowGroupLimitExecTransformer.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 114 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 `backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHAggregateGroupLimitExecTransformer.scala:121` 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 (21 lines × 5) · ×2
  • Duplicated block (21 lines × 5) shims/spark34/src/main/scala/org/apache/gluten/sql/shims/spark34/Spark34Shims.scala:365 — shims/spark34/src/main/scala/org/apache/gluten/sql/shims/spark34/Spark34Shims.scala:365-385 | shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala:422-442 | shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala:496-516 | shims/spark41/src/main/scala/org/apache/gluten/sql/shims/spark41/Spark41Shims.scala:523-543 | shims/spark42/src/main/scala/org/apache/gluten/sql/shims/spark42/Spark42Shims.scala:469-489 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/gluten/sql/shims/spark34/Spark34Shims.scala` and `shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 168 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 (21 lines × 5) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1188 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1188-1208 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1188-1208 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1202-1222 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1206-1226 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1206-1226 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 1116 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 `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1188` 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 (20 lines × 5) · ×2
  • Duplicated block (20 lines × 5) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:524 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:524-543 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:524-543 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:531-550 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:538-557 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:538-557 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 1116 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 (20 lines × 5) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:783 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:783-802 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:783-802 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:791-810 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:798-817 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:798-817 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 1116 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 (19–20 lines × 2) · ×2
  • Duplicated block (19–20 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:101 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:101-119 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:137-156 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 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 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, `backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:156` calls `readBytes`, `readBoolean` and `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:119` 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 (19–20 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:116 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:116-135 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:178-196 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 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 `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:116` 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 (18–19 lines × 2) · ×2
  • Duplicated block (18–19 lines × 2) backends-bolt/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleWriter.scala:249 — backends-bolt/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleWriter.scala:249-266 | backends-bolt/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleWriter.scala:357-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. Read the line range as the matched WINDOW rather than a finished unit: at `backends-bolt/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleWriter.scala:249` 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–19 lines × 2) backends-clickhouse/src/main/java/org/apache/gluten/vectorized/LowCopyFileSegmentShuffleInputStream.java:60 — backends-clickhouse/src/main/java/org/apache/gluten/vectorized/LowCopyFileSegmentShuffleInputStream.java:60-78 | gluten-arrow/src/main/java/org/apache/gluten/vectorized/LowCopyFileSegmentJniByteInputStream.java:95-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. 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 (18 lines × 3) · ×2
  • Duplicated block (18 lines × 3) shims/spark34/src/main/scala/org/apache/gluten/execution/GenerateTreeStringShim.scala:46 — shims/spark34/src/main/scala/org/apache/gluten/execution/GenerateTreeStringShim.scala:46-63 | shims/spark35/src/main/scala/org/apache/gluten/execution/GenerateTreeStringShim.scala:46-63 | shims/spark40/src/main/scala/org/apache/gluten/execution/GenerateTreeStringShim.scala:46-63 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/gluten/execution/GenerateTreeStringShim.scala` and `shims/spark35/src/main/scala/org/apache/gluten/execution/GenerateTreeStringShim.scala` as WHOLE FILES: 97% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (18 lines × 3) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:676 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:676-693 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:676-693 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:684-701 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 1116 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 `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:676` 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 lines × 5) · ×2
  • Duplicated block (17 lines × 5) shims/spark34/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:160 — shims/spark34/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:160-176 | shims/spark35/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:160-176 | shims/spark40/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:160-176 | shims/spark41/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:160-176 | shims/spark42/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:160-176 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala` and `shims/spark35/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 80 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 (17 lines × 5) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:368 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:368-384 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:368-384 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:371-387 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:378-394 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:378-394 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 1116 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 `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:368` 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 lines × 4) · ×2
  • Duplicated block (17 lines × 4) backends-bolt/src-celeborn/main/scala/org/apache/spark/shuffle/BoltCelebornColumnarBatchSerializer.scala:242 — backends-bolt/src-celeborn/main/scala/org/apache/spark/shuffle/BoltCelebornColumnarBatchSerializer.scala:242-258 | backends-bolt/src/main/scala/org/apache/gluten/vectorized/ColumnarBatchSerializer.scala:216-232 | backends-velox/src-celeborn/main/scala/org/apache/spark/shuffle/VeloxCelebornColumnarBatchSerializer.scala:200-216 | backends-velox/src/main/scala/org/apache/gluten/vectorized/ColumnarBatchSerializer.scala:191-207 — before extracting anything, compare `backends-bolt/src-celeborn/main/scala/org/apache/spark/shuffle/BoltCelebornColumnarBatchSerializer.scala` and `backends-velox/src-celeborn/main/scala/org/apache/spark/shuffle/VeloxCelebornColumnarBatchSerializer.scala` as WHOLE FILES: this scan already matched 4 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 `backends-bolt/src-celeborn/main/scala/org/apache/spark/shuffle/BoltCelebornColumnarBatchSerializer.scala:242` 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 before the matched lines, `backends-bolt/src-celeborn/main/scala/org/apache/spark/shuffle/BoltCelebornColumnarBatchSerializer.scala:241` calls `initStream` and `backends-bolt/src/main/scala/org/apache/gluten/vectorized/ColumnarBatchSerializer.scala:215` 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 (17 lines × 4) shims/spark34/src/main/scala/org/apache/spark/sql/execution/datasources/v2/BatchScanExecShim.scala:62 — shims/spark34/src/main/scala/org/apache/spark/sql/execution/datasources/v2/BatchScanExecShim.scala:62-78 | shims/spark35/src/main/scala/org/apache/spark/sql/execution/datasources/v2/BatchScanExecShim.scala:64-80 | shims/spark40/src/main/scala/org/apache/spark/sql/execution/datasources/v2/BatchScanExecShim.scala:70-86 | shims/spark41/src/main/scala/org/apache/spark/sql/execution/datasources/v2/BatchScanExecShim.scala:71-87 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/sql/execution/datasources/v2/BatchScanExecShim.scala` and `shims/spark35/src/main/scala/org/apache/spark/sql/execution/datasources/v2/BatchScanExecShim.scala` as WHOLE FILES: 91% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (16–17 lines × 2) · ×2
  • Duplicated block (16–17 lines × 2) backends-bolt/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala:195 — backends-bolt/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala:195-210 | backends-velox/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala:140-156 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala` and `backends-velox/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 75 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 `backends-bolt/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala:195` 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.
  • Duplicated block (16–17 lines × 2) backends-clickhouse/src/main/scala/org/apache/spark/sql/execution/datasources/clickhouse/utils/MergeTreePartsPartitionsUtil.scala:176 — backends-clickhouse/src/main/scala/org/apache/spark/sql/execution/datasources/clickhouse/utils/MergeTreePartsPartitionsUtil.scala:176-192 | backends-clickhouse/src/main/scala/org/apache/spark/sql/execution/datasources/clickhouse/utils/MergeTreePartsPartitionsUtil.scala:469-484 — both copies are in the same file, so extract the 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 `backends-clickhouse/src/main/scala/org/apache/spark/sql/execution/datasources/clickhouse/utils/MergeTreePartsPartitionsUtil.scala:176` 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, `backends-clickhouse/src/main/scala/org/apache/spark/sql/execution/datasources/clickhouse/utils/MergeTreePartsPartitionsUtil.scala:193` calls `filter`, `shouldProcess` and `backends-clickhouse/src/main/scala/org/apache/spark/sql/execution/datasources/clickhouse/utils/MergeTreePartsPartitionsUtil.scala:485` 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 (15–17 lines × 2) · ×2
  • Duplicated block (15–17 lines × 2) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala:79 — backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala:79-93 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala:100-116 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala` and `backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 96 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 `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala:79` 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 (15–17 lines × 2) tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:581 — tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:581-595 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:631-647 — both copies are in the same file, so extract the 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 `tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:581` 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 (16 lines × 5) · ×2
  • Duplicated block (16 lines × 5) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:674 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:674-689 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:674-689 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:682-697 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:689-704 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:689-704 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 1116 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 `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:674` 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 × 5) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:951 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:951-966 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:951-966 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:962-977 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:966-981 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:966-981 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 1116 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 `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:951` 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 (16 lines × 4) · ×2
  • Duplicated block (16 lines × 4) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:99 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:99-114 | backends-bolt/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala:233-248 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:133-148 | backends-velox/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala:396-411 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala` and `backends-bolt/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 100 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 `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:99` 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 (16 lines × 4) shims/spark34/src/main/scala/org/apache/gluten/sql/shims/spark34/Spark34Shims.scala:224 — shims/spark34/src/main/scala/org/apache/gluten/sql/shims/spark34/Spark34Shims.scala:224-239 | shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala:267-282 | shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala:316-331 | shims/spark41/src/main/scala/org/apache/gluten/sql/shims/spark41/Spark41Shims.scala:315-330 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/gluten/sql/shims/spark34/Spark34Shims.scala` and `shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 168 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (15 lines × 5) · ×2
  • Duplicated block (15 lines × 5) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:853 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:853-867 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:853-867 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:862-876 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:869-883 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:869-883 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 1116 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 (15 lines × 5) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1503 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1503-1517 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1505-1519 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1522-1536 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1526-1540 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1526-1540 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 1116 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 (12 lines × 5) · ×2
  • Duplicated block (12 lines × 5) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:839 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:839-850 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:839-850 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:848-859 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:855-866 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:855-866 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 1116 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 (12 lines × 5) shims/spark34/src/main/scala/org/apache/gluten/sql/shims/spark34/Spark34Shims.scala:298 — shims/spark34/src/main/scala/org/apache/gluten/sql/shims/spark34/Spark34Shims.scala:298-309 | shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala:341-352 | shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala:375-386 | shims/spark41/src/main/scala/org/apache/gluten/sql/shims/spark41/Spark41Shims.scala:374-385 | shims/spark42/src/main/scala/org/apache/gluten/sql/shims/spark42/Spark42Shims.scala:320-331 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/gluten/sql/shims/spark34/Spark34Shims.scala` and `shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 168 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 `shims/spark34/src/main/scala/org/apache/gluten/sql/shims/spark34/Spark34Shims.scala:298` 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) · ×2
  • Duplicated block (12 lines × 3) backends-bolt/src/main/scala/org/apache/gluten/execution/TopNTransformer.scala:100 — backends-bolt/src/main/scala/org/apache/gluten/execution/TopNTransformer.scala:100-111 | backends-velox/src/main/scala/org/apache/gluten/execution/TopNTransformer.scala:100-111 | gluten-substrait/src/main/scala/org/apache/gluten/execution/SortExecTransformer.scala:70-81 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/TopNTransformer.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/TopNTransformer.scala` 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. 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 `backends-bolt/src/main/scala/org/apache/gluten/execution/TopNTransformer.scala:100` 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) backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/execution/datasources/v1/clickhouse/MergeTreeFileFormatWriter.scala:318 — backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/execution/datasources/v1/clickhouse/MergeTreeFileFormatWriter.scala:318-329 | backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:441-452 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:447-458 — before extracting anything, compare `backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/execution/datasources/v1/clickhouse/MergeTreeFileFormatWriter.scala` and `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 55 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 `backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/execution/datasources/v1/clickhouse/MergeTreeFileFormatWriter.scala: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.
D4 · Code Duplication · Duplicated block (9–12 lines × 2) · ×2
  • Duplicated block (9–12 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:47 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:47-55 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:59-70 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 142 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 `backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:59` 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) backends-bolt/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala:55 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala:55-63 | backends-velox/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala:63-74 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 123 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 `backends-velox/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala:63` 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 (11 lines × 5) · ×2
  • Duplicated block (11 lines × 5) gluten-substrait/src/main/scala/org/apache/gluten/utils/PartitionsUtil.scala:54 — gluten-substrait/src/main/scala/org/apache/gluten/utils/PartitionsUtil.scala:54-64 | shims/spark35/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:247-257 | shims/spark40/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:245-255 | shims/spark41/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:245-255 | shims/spark42/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:245-255 — before extracting anything, compare `shims/spark35/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala` and `shims/spark40/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 169 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 `gluten-substrait/src/main/scala/org/apache/gluten/utils/PartitionsUtil.scala:54` 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 × 5) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1417 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1417-1427 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1419-1429 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1435-1445 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1439-1449 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1439-1449 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 1116 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 (10–11 lines × 2) · ×2
  • Duplicated block (10–11 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/utils/ParquetMetadataUtils.scala:73 — backends-bolt/src/main/scala/org/apache/gluten/utils/ParquetMetadataUtils.scala:73-82 | backends-velox/src/main/scala/org/apache/gluten/utils/ParquetMetadataUtils.scala:100-110 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/utils/ParquetMetadataUtils.scala` and `backends-velox/src/main/scala/org/apache/gluten/utils/ParquetMetadataUtils.scala` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 117 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 (10–11 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:612 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:612-621 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:862-872 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 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 `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:612` 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 × 6) · ×2
  • Duplicated block (10 lines × 6) tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:83 — tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:83-92 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:123-132 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:166-175 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:195-204 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:221-230 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:261-270 — all 6 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 `tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:83` 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 × 6) tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:98 — tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:98-107 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:137-146 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:173-182 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:202-211 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:236-245 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:272-281 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (10 lines × 5) · ×2
  • Duplicated block (10 lines × 5) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:137 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:137-146 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:137-146 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:137-146 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:137-146 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:137-146 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala` and `shims/spark35/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 197 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 (10 lines × 5) shims/spark34/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:261 — shims/spark34/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:261-270 | shims/spark35/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:261-270 | shims/spark40/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:261-270 | shims/spark41/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:261-270 | shims/spark42/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala:261-270 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala` and `shims/spark35/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 80 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 `shims/spark34/src/main/scala/org/apache/spark/sql/hive/execution/AbstractHiveTableScanExec.scala: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.
D4 · Code Duplication · Duplicated block (10 lines × 4) · ×2
  • Duplicated block (10 lines × 4) backends-bolt/src/main/scala/org/apache/gluten/metrics/SortMetricsUpdater.scala:30 — backends-bolt/src/main/scala/org/apache/gluten/metrics/SortMetricsUpdater.scala:30-39 | backends-bolt/src/main/scala/org/apache/gluten/metrics/WindowMetricsUpdater.scala:28-37 | backends-velox/src/main/scala/org/apache/gluten/metrics/SortMetricsUpdater.scala:30-39 | backends-velox/src/main/scala/org/apache/gluten/metrics/WindowMetricsUpdater.scala:28-37 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/metrics/SortMetricsUpdater.scala` and `backends-bolt/src/main/scala/org/apache/gluten/metrics/WindowMetricsUpdater.scala` as WHOLE FILES: 97% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 4) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala:327 — backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala:327-336 | backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala:355-364 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala:327-336 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala:355-364 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala` and `backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 238 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 (9–10 lines × 2) · ×2
  • Duplicated block (9–10 lines × 2) backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:416 — backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:416-424 | backends-velox/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:530-539 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala` and `backends-velox/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 286 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 (9–10 lines × 2) gluten-flink/planner/src/main/java/org/apache/gluten/velox/KafkaSourceSinkFactory.java:132 — gluten-flink/planner/src/main/java/org/apache/gluten/velox/KafkaSourceSinkFactory.java:132-140 | gluten-flink/planner/src/main/java/org/apache/gluten/velox/PulsarSourceSinkFactory.java:90-99 — 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 (8–9 lines × 3) · ×2
  • Duplicated block (8–9 lines × 3) backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/ClickhouseOptimisticTransaction.scala:146 — backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/ClickhouseOptimisticTransaction.scala:146-153 | backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/ClickhouseOptimisticTransaction.scala:297-304 | backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala:158-166 — before extracting anything, compare `backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/ClickhouseOptimisticTransaction.scala` and `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 90 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 `backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/ClickhouseOptimisticTransaction.scala:146` 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–9 lines × 3) gluten-substrait/src/main/java/org/apache/gluten/substrait/rel/SortRelNode.java:59 — gluten-substrait/src/main/java/org/apache/gluten/substrait/rel/SortRelNode.java:59-67 | gluten-substrait/src/main/java/org/apache/gluten/substrait/rel/TopNNode.java:73-81 | gluten-substrait/src/main/java/org/apache/gluten/substrait/rel/WindowRelNode.java:84-91 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `gluten-substrait/src/main/java/org/apache/gluten/substrait/rel/TopNNode.java:70` calls `setCount`, `makeLongLiteral`, `toProtobuf` and `gluten-substrait/src/main/java/org/apache/gluten/substrait/rel/SortRelNode.java:57` 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–9 lines × 2) · ×2
  • Duplicated block (8–9 lines × 2) tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:421 — tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:421-428 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:565-573 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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, `tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:428` calls `StructField` and `tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:573` 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 (8–9 lines × 2) tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/table/AutoTableCreator.scala:31 — tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/table/AutoTableCreator.scala:31-39 | REDACTED:32-39 — 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 (8 lines × 6) · ×2
  • Duplicated block (8 lines × 6) tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:311 — tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:311-318 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:369-376 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:490-497 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:545-552 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:583-590 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:633-640 — all 6 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:489` calls `StructField`, `DecimalType` and `tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:310` 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 (8 lines × 6) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:210 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:210-217 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:232-239 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:246-253 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala:222-229 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala:244-251 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala:258-265 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 498 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:210` 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 (7 lines × 3) · ×2
  • Duplicated block (7 lines × 3) backends-clickhouse/src/main/scala/org/apache/gluten/metrics/BroadcastNestedLoopJoinMetricsUpdater.scala:27 — backends-clickhouse/src/main/scala/org/apache/gluten/metrics/BroadcastNestedLoopJoinMetricsUpdater.scala:27-33 | backends-clickhouse/src/main/scala/org/apache/gluten/metrics/HashJoinMetricsUpdater.scala:26-32 | backends-clickhouse/src/main/scala/org/apache/gluten/metrics/SortMergeJoinMetricsUpdater.scala:27-33 — before extracting anything, compare `backends-clickhouse/src/main/scala/org/apache/gluten/metrics/BroadcastNestedLoopJoinMetricsUpdater.scala` and `backends-clickhouse/src/main/scala/org/apache/gluten/metrics/HashJoinMetricsUpdater.scala` as WHOLE FILES: this scan already matched 3 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 `backends-clickhouse/src/main/scala/org/apache/gluten/metrics/BroadcastNestedLoopJoinMetricsUpdater.scala:27` 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) backends-bolt/src/main/scala/org/apache/gluten/execution/TopNTransformer.scala:57 — backends-bolt/src/main/scala/org/apache/gluten/execution/TopNTransformer.scala:57-63 | backends-velox/src/main/scala/org/apache/gluten/execution/TopNTransformer.scala:57-63 | gluten-substrait/src/main/scala/org/apache/gluten/execution/TakeOrderedAndProjectExecTransformer.scala:61-67 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/TopNTransformer.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/TopNTransformer.scala` 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. 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 lines × 7) · ×2
  • Duplicated block (6 lines × 7) backends-bolt/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala:169 — backends-bolt/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala:169-174 | backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala:332-337 | backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala:360-365 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala:332-337 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala:360-365 | backends-velox/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala:93-98 | backends-velox/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala:124-129 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala` and `backends-velox/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 75 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 (6 lines × 7) backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:91 — backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:91-96 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:192-197 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:210-215 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:250-255 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:299-304 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:329-334 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:345-350 — all 7 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 `backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:91` 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, `backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:89` calls `createMetric` and `backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:190` 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 (6 lines × 6) · ×2
  • Duplicated block (6 lines × 6) backends-clickhouse/src/main/scala/org/apache/gluten/metrics/CHRangeMetricsUpdater.scala:23 — backends-clickhouse/src/main/scala/org/apache/gluten/metrics/CHRangeMetricsUpdater.scala:23-28 | backends-clickhouse/src/main/scala/org/apache/gluten/metrics/ExpandMetricsUpdater.scala:24-29 | backends-clickhouse/src/main/scala/org/apache/gluten/metrics/GenerateMetricsUpdater.scala:24-29 | backends-clickhouse/src/main/scala/org/apache/gluten/metrics/LimitMetricsUpdater.scala:24-29 | backends-clickhouse/src/main/scala/org/apache/gluten/metrics/SortMetricsUpdater.scala:24-29 | backends-clickhouse/src/main/scala/org/apache/gluten/metrics/WindowMetricsUpdater.scala:24-29 — before extracting anything, compare `backends-clickhouse/src/main/scala/org/apache/gluten/metrics/CHRangeMetricsUpdater.scala` and `backends-clickhouse/src/main/scala/org/apache/gluten/metrics/ExpandMetricsUpdater.scala` as WHOLE FILES: 85% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 `backends-clickhouse/src/main/scala/org/apache/gluten/metrics/CHRangeMetricsUpdater.scala: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 (6 lines × 6) tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:115 — tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:115-120 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:148-153 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:187-192 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:213-218 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:253-258 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:283-288 — all 6 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 `tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:115` 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 (6 lines × 3) · ×2
  • Duplicated block (6 lines × 3) backends-bolt/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala:176 — backends-bolt/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala:176-181 | backends-velox/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala:100-105 | backends-velox/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala:131-136 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala` and `backends-velox/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 75 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 (6 lines × 3) backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:88 — backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:88-93 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:108-113 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:136-141 — 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 (5 lines × 15) · ×2
  • Duplicated block (5 lines × 15) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:90 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:90-94 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:84-88 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:104-108 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:132-136 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:188-192 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:206-210 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:225-229 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:246-250 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:295-299 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:325-329 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:341-345 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:370-374 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:415-419 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:443-447 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:109-113 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala` and `backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 127 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:230` calls `createTimingMetric` and `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:95` 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 × 15) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:92 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:92-96 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:284-292 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:450-456 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:530-536 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:635-649 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:669-683 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:86-90 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:106-110 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:134-138 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:111-115 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:321-329 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:464-470 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:544-550 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:659-673 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:693-707 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala` and `backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 127 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 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, `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:281` calls `createSizeMetric`, `createMetric`, `createNanoTimingMetric` and `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:91` 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 (5 lines × 3) · ×2
  • Duplicated block (5 lines × 3) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:611 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:611-615 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:407-411 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:635-639 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala` and `backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 127 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) shims/spark40/src/main/scala/org/apache/spark/sql/execution/datasources/v2/utils/CatalogUtil.scala:24 — shims/spark40/src/main/scala/org/apache/spark/sql/execution/datasources/v2/utils/CatalogUtil.scala:24-28 | shims/spark41/src/main/scala/org/apache/spark/sql/execution/datasources/v2/utils/CatalogUtil.scala:24-28 | shims/spark42/src/main/scala/org/apache/spark/sql/execution/datasources/v2/utils/CatalogUtil.scala:24-28 — before extracting anything, compare `shims/spark40/src/main/scala/org/apache/spark/sql/execution/datasources/v2/utils/CatalogUtil.scala` and `shims/spark41/src/main/scala/org/apache/spark/sql/execution/datasources/v2/utils/CatalogUtil.scala` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (5 lines × 4) · ×2
  • Duplicated block (5 lines × 4) backends-bolt/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala:41 — backends-bolt/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala:41-45 | backends-bolt/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala:48-52 | backends-velox/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala:41-45 | backends-velox/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala:48-52 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala` and `backends-velox/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 295 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 × 4) shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala:368 — shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala:368-372 | shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala:402-406 | shims/spark41/src/main/scala/org/apache/gluten/sql/shims/spark41/Spark41Shims.scala:401-405 | shims/spark42/src/main/scala/org/apache/gluten/sql/shims/spark42/Spark42Shims.scala:347-351 — before extracting anything, compare `shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala` and `shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 140 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.
D5 · Coupling · Off the main sequence · ×2
  • Off the main sequence: gluten-flink-runtime — gluten-flink-runtime: abstractness 0.20, instability 0.00, distance 0.80 — zone of pain — concrete and depended on by 2 project(s), so it's rigid to change.
  • Off the main sequence: gluten-core — gluten-core: abstractness 0.21, instability 0.00, distance 0.79 — zone of pain — concrete and depended on by 2 project(s), so it's rigid to change.
X15 · Unvalidated length from an untrusted reader · Length read from the parsed input is spent without ever being bounded · ×2
  • Length read from the parsed input is spent without ever being bounded backends-velox/src/main/scala/org/apache/gluten/expression/VeloxBloomFilterMightContain.scala:143 — `length` is read from the bytes being parsed at line 142 (`readInt`), then used to size a `new Array[Byte]` at line 143 — and nowhere in its scope is `length` bounded from above — compared to a limit, clamped, or checked against the input that remains (a zero or sign test, or the loop that counts up to it, bounds nothing). Whoever wrote those bytes therefore chooses the allocation directly: a 32-bit length asks for up to 2 GiB before a single byte of the payload is known to exist, which either exhausts the heap with an `OutOfMemoryError` or, negative, throws `NegativeArraySizeException` out of a parser whose failure path was written for malformed input, not for hostile input. Bound `length` against the bytes actually remaining and a maximum the format allows before allocating.
  • Length read from the parsed input is spent without ever being bounded backends-bolt/src/main/scala/org/apache/gluten/expression/BoltBloomFilterMightContain.scala:143 — `length` is read from the bytes being parsed at line 142 (`readInt`), then used to size a `new Array[Byte]` at line 143 — and nowhere in its scope is `length` bounded from above — compared to a limit, clamped, or checked against the input that remains (a zero or sign test, or the loop that counts up to it, bounds nothing). Whoever wrote those bytes therefore chooses the allocation directly: a 32-bit length asks for up to 2 GiB before a single byte of the payload is known to exist, which either exhausts the heap with an `OutOfMemoryError` or, negative, throws `NegativeArraySizeException` out of a parser whose failure path was written for malformed input, not for hostile input. Bound `length` against the bytes actually remaining and a maximum the format allows before allocating.
D1 · Cyclomatic Complexity · ExpressionConverter.transformExpression (cyclomatic 101) · ×1
  • ExpressionConverter.transformExpression (cyclomatic 101) gluten-substrait/src/main/scala/org/apache/gluten/expression/ExpressionConverter.scala:301 — ExpressionConverter.transformExpression has cyclomatic complexity 101 (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 · gen-function-support-docs.parse_logs (cyclomatic 77) · ×1
  • gen-function-support-docs.parse_logs (cyclomatic 77) tools/scripts/gen-function-support-docs.py:965 — gen-function-support-docs.parse_logs 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.
D1 · Cyclomatic Complexity · VeloxSparkPlanExecApi.createBroadcastRelation (cyclomatic 49) · ×1
  • VeloxSparkPlanExecApi.createBroadcastRelation (cyclomatic 49) backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala:743 — VeloxSparkPlanExecApi.createBroadcastRelation has cyclomatic complexity 49 (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 · ReplaceSingleNode.doReplace (cyclomatic 33) · ×1
  • ReplaceSingleNode.doReplace (cyclomatic 33) gluten-substrait/src/main/scala/org/apache/gluten/extension/columnar/offload/OffloadSingleNodeRules.scala:203 — ReplaceSingleNode.doReplace has cyclomatic complexity 33 (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 · FallbackByTimestampNTZ.validate (cyclomatic 33) · ×1
  • FallbackByTimestampNTZ.validate (cyclomatic 33) gluten-substrait/src/main/scala/org/apache/gluten/extension/columnar/validator/Validators.scala:252 — FallbackByTimestampNTZ.validate has cyclomatic complexity 33 (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: FallbackByUserOptions.validate (cyclomatic 38) 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 method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · BoltBackendSettings.validateScanExec (cyclomatic 26) · ×1
  • BoltBackendSettings.validateScanExec (cyclomatic 26) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala:104 — BoltBackendSettings.validateScanExec 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 · VeloxBackendSettings.validateScanExec (cyclomatic 25) · ×1
  • VeloxBackendSettings.validateScanExec (cyclomatic 25) backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxBackend.scala:107 — VeloxBackendSettings.validateScanExec 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 · analyze-ansi.format_summary (cyclomatic 25) · ×1
  • analyze-ansi.format_summary (cyclomatic 25) REDACTED:286 — analyze-ansi.format_summary 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 · IcebergScanTransformer.doValidateInternal (cyclomatic 24) · ×1
  • IcebergScanTransformer.doValidateInternal (cyclomatic 24) gluten-iceberg/src/main/scala/org/apache/gluten/execution/IcebergScanTransformer.scala:89 — IcebergScanTransformer.doValidateInternal 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 · MergeTreeFileFormatWriter.write (cyclomatic 23) · ×1
  • MergeTreeFileFormatWriter.write (cyclomatic 23) backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/execution/datasources/v1/clickhouse/MergeTreeFileFormatWriter.scala:53 — MergeTreeFileFormatWriter.write 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 · CHSparkPlanExecApi.createBroadcastRelation (cyclomatic 23) · ×1
  • CHSparkPlanExecApi.createBroadcastRelation (cyclomatic 23) backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHSparkPlanExecApi.scala:495 — CHSparkPlanExecApi.createBroadcastRelation 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 · NodeSupportVisitor.isSupported (cyclomatic 23) · ×1
  • NodeSupportVisitor.isSupported (cyclomatic 23) tools/qualification-tool/src/main/java/org/apache/gluten/qt/support/NodeSupportVisitor.java:166 — NodeSupportVisitor.isSupported 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 · SparkArrowUtil.fromArrowType (cyclomatic 22) · ×1
  • SparkArrowUtil.fromArrowType (cyclomatic 22) gluten-arrow/src/main/scala/org/apache/spark/sql/utils/SparkArrowUtil.scala:63 — SparkArrowUtil.fromArrowType 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 · LocalFilesNode.toProtobuf (cyclomatic 22) · ×1
  • LocalFilesNode.toProtobuf (cyclomatic 22) gluten-substrait/src/main/java/org/apache/gluten/substrait/rel/LocalFilesNode.java:191 — LocalFilesNode.toProtobuf 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 · PartitionDataJson.getValue (cyclomatic 21) · ×1
  • PartitionDataJson.getValue (cyclomatic 21) gluten-iceberg/src/main/java/org/apache/gluten/connector/write/PartitionDataJson.java:103 — PartitionDataJson.getValue 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 · ArrowColumnVector.initAccessor (cyclomatic 21) · ×1
  • ArrowColumnVector.initAccessor (cyclomatic 21) gluten-arrow/src/main/java/org/apache/gluten/vectorized/ArrowColumnVector.java:150 — ArrowColumnVector.initAccessor 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 · CHTransformerApi.postProcessNativeConfig (cyclomatic 19) · ×1
  • CHTransformerApi.postProcessNativeConfig (cyclomatic 19) backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHTransformerApi.scala:95 — CHTransformerApi.postProcessNativeConfig 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 · GlutenOptimisticTransaction.writeFiles (cyclomatic 19) · ×1
  • GlutenOptimisticTransaction.writeFiles (cyclomatic 19) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala:46 — GlutenOptimisticTransaction.writeFiles 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 · EliminateDeduplicateAggregateWithAnyJoin.apply (cyclomatic 18) · ×1
  • EliminateDeduplicateAggregateWithAnyJoin.apply (cyclomatic 18) backends-clickhouse/src/main/scala/org/apache/gluten/extension/EliminateDeduplicateAggregateWithAnyJoin.scala:33 — EliminateDeduplicateAggregateWithAnyJoin.apply 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 · GlutenJoinKeysCapture.chooseBuildRight (cyclomatic 18) · ×1
  • GlutenJoinKeysCapture.chooseBuildRight (cyclomatic 18) gluten-core/src/main/scala/org/apache/gluten/extension/GlutenJoinKeysCapture.scala:117 — GlutenJoinKeysCapture.chooseBuildRight has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · PushAggregateThroughJoin.pushPartialAggToJoinSide (cyclomatic 18) · ×1
  • PushAggregateThroughJoin.pushPartialAggToJoinSide (cyclomatic 18) gluten-substrait/src/main/scala/org/apache/gluten/extension/joinagg/PushAggregateThroughJoin.scala:228 — PushAggregateThroughJoin.pushPartialAggToJoinSide 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 · StructLiteralNode.getFieldLiteral (cyclomatic 18) · ×1
  • StructLiteralNode.getFieldLiteral (cyclomatic 18) gluten-substrait/src/main/java/org/apache/gluten/substrait/expression/StructLiteralNode.java:30 — StructLiteralNode.getFieldLiteral 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 · CHCelebornColumnarBatchSerializerInstance.deserializeStream (cyclomatic 17) · ×1
  • CHCelebornColumnarBatchSerializerInstance.deserializeStream (cyclomatic 17) backends-clickhouse/src-celeborn/main/scala/org/apache/spark/shuffle/CHCelebornColumnarBatchSerializer.scala:68 — CHCelebornColumnarBatchSerializerInstance.deserializeStream 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 · ReorderJoinSubqueries.visitJoin (cyclomatic 17) · ×1
  • ReorderJoinSubqueries.visitJoin (cyclomatic 17) backends-clickhouse/src/main/scala/org/apache/gluten/extension/JoinAggregateToAggregateUnion.scala:563 — ReorderJoinSubqueries.visitJoin 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 · GlutenOptimisticTransaction.writeFiles (cyclomatic 17) · ×1
  • GlutenOptimisticTransaction.writeFiles (cyclomatic 17) backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala:60 — GlutenOptimisticTransaction.writeFiles 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 · PullOutPreProject.needsPreProject (cyclomatic 17) · ×1
  • PullOutPreProject.needsPreProject (cyclomatic 17) gluten-substrait/src/main/scala/org/apache/gluten/extension/columnar/rewrite/PullOutPreProject.scala:54 — PullOutPreProject.needsPreProject 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 · ExpressionBuilder.makeLiteral (cyclomatic 17) · ×1
  • ExpressionBuilder.makeLiteral (cyclomatic 17) gluten-substrait/src/main/java/org/apache/gluten/substrait/expression/ExpressionBuilder.java:149 — ExpressionBuilder.makeLiteral 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 · VacuumCommand.gc (cyclomatic 16) · ×1
  • VacuumCommand.gc (cyclomatic 16) backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/commands/VacuumCommand.scala:233 — VacuumCommand.gc 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 · GlutenCHCacheDataCommand.run (cyclomatic 16) · ×1
  • GlutenCHCacheDataCommand.run (cyclomatic 16) backends-clickhouse/src/main/scala/org/apache/spark/sql/execution/commands/GlutenCHCacheDataCommand.scala:60 — GlutenCHCacheDataCommand.run 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 · VeloxBackendSettings.supportWriteFilesExec (cyclomatic 16) · ×1
  • VeloxBackendSettings.supportWriteFilesExec (cyclomatic 16) backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxBackend.scala:296 — VeloxBackendSettings.supportWriteFilesExec 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.
D1 · Cyclomatic Complexity · VeloxBackendSettings.supportWindowExec (cyclomatic 16) · ×1
  • VeloxBackendSettings.supportWindowExec (cyclomatic 16) backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxBackend.scala:413 — VeloxBackendSettings.supportWindowExec 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 · ScanMapKeyPruning.pathsToDeclare (cyclomatic 16) · ×1
  • ScanMapKeyPruning.pathsToDeclare (cyclomatic 16) backends-velox/src/main/scala/org/apache/gluten/extension/ScanMapKeyPruning.scala:197 — ScanMapKeyPruning.pathsToDeclare 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 · GlutenAutoAdjustStageResourceProfile.apply (cyclomatic 16) · ×1
  • GlutenAutoAdjustStageResourceProfile.apply (cyclomatic 16) gluten-substrait/src/main/scala/org/apache/spark/sql/execution/GlutenAutoAdjustStageResourceProfile.scala:64 — GlutenAutoAdjustStageResourceProfile.apply 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.
D17 · Explicit Debt · TodoComment repeated across 12 files · ×1
  • TodoComment repeated across 12 files gluten-ut/spark42/src/test/scala/org/apache/spark/sql/GlutenColumnExpressionSuite.scala:28 — The identical TodoComment appears in 12 files (24 occurrences) — almost certainly one boilerplate line from a single migration or decision, not 24 independent debts. Fix the systemic cause once rather than file-by-file. Text: "// TODO: fix in Spark-4.0". 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 · gen-function-support-docs.parse_logs (cognitive 213) · ×1
  • gen-function-support-docs.parse_logs (cognitive 213) tools/scripts/gen-function-support-docs.py:965 — gen-function-support-docs.parse_logs has cognitive complexity 213 (threshold 15). Drivers by points: if/else 74 (188 pts), loops 12 (20 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 123). 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 · VeloxSparkPlanExecApi.createBroadcastRelation (cognitive 84) · ×1
  • VeloxSparkPlanExecApi.createBroadcastRelation (cognitive 84) backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala:743 — VeloxSparkPlanExecApi.createBroadcastRelation has cognitive complexity 84 (threshold 15). Drivers by points: if/else 33 (49 pts), match/switch 11 (27 pts), boolean chains 5, error handling 1 (3 pts) (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 · analyze-ansi.format_summary (cognitive 53) · ×1
  • analyze-ansi.format_summary (cognitive 53) REDACTED:286 — analyze-ansi.format_summary has cognitive complexity 53 (threshold 15). Drivers by points: loops 10 (24 pts), if/else 12 (22 pts), ternaries 2 (6 pts), boolean chains 1 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IcebergScanTransformer.doValidateInternal (cognitive 47) · ×1
  • IcebergScanTransformer.doValidateInternal (cognitive 47) gluten-iceberg/src/main/scala/org/apache/gluten/execution/IcebergScanTransformer.scala:89 — IcebergScanTransformer.doValidateInternal has cognitive complexity 47 (threshold 15). Drivers by points: if/else 21 (29 pts), match/switch 7 (15 pts), boolean chains 3 (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 · MergeTreeFileFormatWriter.write (cognitive 42) · ×1
  • MergeTreeFileFormatWriter.write (cognitive 42) backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/execution/datasources/v1/clickhouse/MergeTreeFileFormatWriter.scala:53 — MergeTreeFileFormatWriter.write has cognitive complexity 42 (threshold 15). Drivers by points: if/else 24 (33 pts), boolean chains 7, error handling 1, 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.
D2 · Cognitive Complexity · NodeSupportVisitor.isSupported (cognitive 36) · ×1
  • NodeSupportVisitor.isSupported (cognitive 36) tools/qualification-tool/src/main/java/org/apache/gluten/qt/support/NodeSupportVisitor.java:166 — NodeSupportVisitor.isSupported has cognitive complexity 36 (threshold 15). Drivers by points: if/else 17 (23 pts), ternaries 4 (9 pts), boolean chains 4 (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 · BoltBackendSettings.validateScanExec (cognitive 33) · ×1
  • BoltBackendSettings.validateScanExec (cognitive 33) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala:104 — BoltBackendSettings.validateScanExec has cognitive complexity 33 (threshold 15). Drivers by points: if/else 17 (20 pts), match/switch 3 (7 pts), boolean chains 4, error handling 1, loops 1 (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.
D2 · Cognitive Complexity · HashJoinMetricsUpdater.updateNativeMetrics (cognitive 32) · ×1
  • HashJoinMetricsUpdater.updateNativeMetrics (cognitive 32) backends-clickhouse/src/main/scala/org/apache/gluten/metrics/HashJoinMetricsUpdater.scala:25 — HashJoinMetricsUpdater.updateNativeMetrics has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (30 pts), boolean chains 1, error handling 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.
D2 · Cognitive Complexity · SortMergeJoinMetricsUpdater.updateNativeMetrics (cognitive 32) · ×1
  • SortMergeJoinMetricsUpdater.updateNativeMetrics (cognitive 32) backends-clickhouse/src/main/scala/org/apache/gluten/metrics/SortMergeJoinMetricsUpdater.scala:26 — SortMergeJoinMetricsUpdater.updateNativeMetrics has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (30 pts), boolean chains 1, error handling 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.
D2 · Cognitive Complexity · VeloxBackendSettings.validateScanExec (cognitive 32) · ×1
  • VeloxBackendSettings.validateScanExec (cognitive 32) backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxBackend.scala:107 — VeloxBackendSettings.validateScanExec has cognitive complexity 32 (threshold 15). Drivers by points: if/else 17 (20 pts), match/switch 3 (7 pts), boolean chains 3, error handling 1, loops 1 (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.
D2 · Cognitive Complexity · LocalFilesNode.toProtobuf (cognitive 32) · ×1
  • LocalFilesNode.toProtobuf (cognitive 32) gluten-substrait/src/main/java/org/apache/gluten/substrait/rel/LocalFilesNode.java:191 — LocalFilesNode.toProtobuf has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (26 pts), boolean chains 3, match/switch 1 (2 pts), loops 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 · AbstractStreamTaskNetworkInput.emitNext (cognitive 32) · ×1
  • AbstractStreamTaskNetworkInput.emitNext (cognitive 32) gluten-flink/runtime/src/main/java/org/apache/flink/streaming/runtime/io/AbstractStreamTaskNetworkInput.java:95 — AbstractStreamTaskNetworkInput.emitNext has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (26 pts), error handling 1 (3 pts), boolean chains 2, 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 · ReorderJoinSubqueries.visitJoin (cognitive 31) · ×1
  • ReorderJoinSubqueries.visitJoin (cognitive 31) backends-clickhouse/src/main/scala/org/apache/gluten/extension/JoinAggregateToAggregateUnion.scala:563 — ReorderJoinSubqueries.visitJoin has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (24 pts), boolean chains 4, match/switch 2 (3 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 · EliminateDeduplicateAggregateWithAnyJoin.apply (cognitive 30) · ×1
  • EliminateDeduplicateAggregateWithAnyJoin.apply (cognitive 30) backends-clickhouse/src/main/scala/org/apache/gluten/extension/EliminateDeduplicateAggregateWithAnyJoin.scala:33 — EliminateDeduplicateAggregateWithAnyJoin.apply has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 6, match/switch 3 (5 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ExtendedGeneratorNestedColumnAliasing.unapply (cognitive 30) · ×1
  • ExtendedGeneratorNestedColumnAliasing.unapply (cognitive 30) backends-clickhouse/src/main/scala/org/apache/gluten/extension/ExtendedColumnPruning.scala:33 — ExtendedGeneratorNestedColumnAliasing.unapply has cognitive complexity 30 (threshold 15). Drivers by points: match/switch 7 (18 pts), if/else 7 (10 pts), boolean chains 2 (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.
D2 · Cognitive Complexity · CHTransformerApi.postProcessNativeConfig (cognitive 28) · ×1
  • CHTransformerApi.postProcessNativeConfig (cognitive 28) backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHTransformerApi.scala:95 — CHTransformerApi.postProcessNativeConfig has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (23 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GlutenOptimisticTransaction.writeFiles (cognitive 28) · ×1
  • GlutenOptimisticTransaction.writeFiles (cognitive 28) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala:46 — GlutenOptimisticTransaction.writeFiles has cognitive complexity 28 (threshold 15). Drivers by points: if/else 16 (18 pts), match/switch 4, boolean chains 3, error handling 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, 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 · CHRDDScanTransformer.doExecuteColumnar (cognitive 27) · ×1
  • CHRDDScanTransformer.doExecuteColumnar (cognitive 27) backends-clickhouse/src/main/scala/org/apache/spark/sql/execution/CHRDDScanTransformer.scala:45 — CHRDDScanTransformer.doExecuteColumnar has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 4 (11 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HashAggregateExecTransformer.applyRowConstruct (cognitive 27) · ×1
  • HashAggregateExecTransformer.applyRowConstruct (cognitive 27) backends-velox/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:278 — HashAggregateExecTransformer.applyRowConstruct has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (20 pts), match/switch 2 (5 pts), boolean chains 1, 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 · ColumnarShuffleWriter.internalWrite (cognitive 27) · ×1
  • ColumnarShuffleWriter.internalWrite (cognitive 27) backends-velox/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleWriter.scala:133 — ColumnarShuffleWriter.internalWrite has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (19 pts), match/switch 1 (4 pts), boolean chains 3, 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 · VacuumCommand.gc (cognitive 26) · ×1
  • VacuumCommand.gc (cognitive 26) backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/commands/VacuumCommand.scala:233 — VacuumCommand.gc has cognitive complexity 26 (threshold 15). Drivers by points: if/else 17 (19 pts), error handling 2 (3 pts), boolean chains 2, match/switch 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · FallbackBroadcastHashJoinPrepQueryStage.apply (cognitive 26) · ×1
  • FallbackBroadcastHashJoinPrepQueryStage.apply (cognitive 26) backends-clickhouse/src/main/scala/org/apache/gluten/extension/FallbackBroadcastHashJoinRules.scala:40 — FallbackBroadcastHashJoinPrepQueryStage.apply has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (18 pts), match/switch 4 (7 pts), boolean chains 1 (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · BroadcastNestedLoopJoinMetricsUpdater.updateNativeMetrics (cognitive 26) · ×1
  • BroadcastNestedLoopJoinMetricsUpdater.updateNativeMetrics (cognitive 26) backends-clickhouse/src/main/scala/org/apache/gluten/metrics/BroadcastNestedLoopJoinMetricsUpdater.scala:26 — BroadcastNestedLoopJoinMetricsUpdater.updateNativeMetrics has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (24 pts), boolean chains 1, error handling 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 · GlutenCHCacheDataCommand.run (cognitive 25) · ×1
  • GlutenCHCacheDataCommand.run (cognitive 25) backends-clickhouse/src/main/scala/org/apache/spark/sql/execution/commands/GlutenCHCacheDataCommand.scala:60 — GlutenCHCacheDataCommand.run has cognitive complexity 25 (threshold 15). Drivers by points: if/else 20 (22 pts), match/switch 1 (2 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 · ExpressionConverter.transformExpression (cognitive 25) · ×1
  • ExpressionConverter.transformExpression (cognitive 25) gluten-substrait/src/main/scala/org/apache/gluten/expression/ExpressionConverter.scala:301 — ExpressionConverter.transformExpression has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (17 pts), match/switch 3 (5 pts), error handling 1 (2 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.
D2 · Cognitive Complexity · FallbackByTimestampNTZ.validate (cognitive 25) · ×1
  • FallbackByTimestampNTZ.validate (cognitive 25) gluten-substrait/src/main/scala/org/apache/gluten/extension/columnar/validator/Validators.scala:252 — FallbackByTimestampNTZ.validate has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (9 pts), match/switch 5 (9 pts), boolean chains 7 (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 · TypeUtils.promoteTypes (cognitive 25) · ×1
  • TypeUtils.promoteTypes (cognitive 25) gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/TypeUtils.java:60 — TypeUtils.promoteTypes has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (14 pts), ternaries 3 (8 pts), loops 2, 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 · BoltBackendSettings.supportWriteFilesExec (cognitive 24) · ×1
  • BoltBackendSettings.supportWriteFilesExec (cognitive 24) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala:288 — BoltBackendSettings.supportWriteFilesExec has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14, match/switch 6 (8 pts), boolean chains 2 (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 · BoltIteratorApi.unescapePathName (cognitive 24) · ×1
  • BoltIteratorApi.unescapePathName (cognitive 24) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltIteratorApi.scala:347 — BoltIteratorApi.unescapePathName has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 5, 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 · CHSparkPlanExecApi.createBroadcastRelation (cognitive 24) · ×1
  • CHSparkPlanExecApi.createBroadcastRelation (cognitive 24) backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHSparkPlanExecApi.scala:495 — CHSparkPlanExecApi.createBroadcastRelation has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (12 pts), match/switch 4 (7 pts), boolean chains 5 (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.
D2 · Cognitive Complexity · VeloxIteratorApi.unescapePathName (cognitive 24) · ×1
  • VeloxIteratorApi.unescapePathName (cognitive 24) backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxIteratorApi.scala:345 — VeloxIteratorApi.unescapePathName has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 5, 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 · Spark40Shims.orderPartitions (cognitive 24) · ×1
  • Spark40Shims.orderPartitions (cognitive 24) shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala:239 — Spark40Shims.orderPartitions has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 4 (9 pts), boolean chains 2 (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.
D2 · Cognitive Complexity · Spark41Shims.orderPartitions (cognitive 24) · ×1
  • Spark41Shims.orderPartitions (cognitive 24) shims/spark41/src/main/scala/org/apache/gluten/sql/shims/spark41/Spark41Shims.scala:238 — Spark41Shims.orderPartitions has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 4 (9 pts), boolean chains 2 (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.
D2 · Cognitive Complexity · RowToBoltColumnarExec.toColumnarBatchIterator (cognitive 23) · ×1
  • RowToBoltColumnarExec.toColumnarBatchIterator (cognitive 23) backends-bolt/src/main/scala/org/apache/gluten/execution/RowToBoltColumnarExec.scala:117 — RowToBoltColumnarExec.toColumnarBatchIterator has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 2, loops 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.
D2 · Cognitive Complexity · RowToVeloxColumnarExec.toColumnarBatchIterator (cognitive 23) · ×1
  • RowToVeloxColumnarExec.toColumnarBatchIterator (cognitive 23) backends-velox/src/main/scala/org/apache/gluten/execution/RowToVeloxColumnarExec.scala:118 — RowToVeloxColumnarExec.toColumnarBatchIterator has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 2, loops 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.
D2 · Cognitive Complexity · Impl.build (cognitive 23) · ×1
  • Impl.build (cognitive 23) gluten-core/src/main/scala/org/apache/gluten/extension/columnar/transition/FloydWarshallGraph.scala:108 — Impl.build has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (16 pts), loops 3 (6 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 · ExecUtil.genShuffleDependency (cognitive 22) · ×1
  • ExecUtil.genShuffleDependency (cognitive 22) backends-bolt/src/main/scala/org/apache/spark/sql/execution/utils/ExecUtil.scala:88 — ExecUtil.genShuffleDependency has cognitive complexity 22 (threshold 15). Drivers by points: match/switch 6 (11 pts), if/else 7 (8 pts), boolean chains 3 (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 · DynamicPartitionDataConcurrentWriter.write (cognitive 22) · ×1
  • DynamicPartitionDataConcurrentWriter.write (cognitive 22) backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/execution/datasources/v1/clickhouse/MergeTreeFileFormatDataWriter.scala:391 — DynamicPartitionDataConcurrentWriter.write has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FallbackBroadcastHashJoin.preTagBroadcastExchangeFallback (cognitive 22) · ×1
  • FallbackBroadcastHashJoin.preTagBroadcastExchangeFallback (cognitive 22) backends-clickhouse/src/main/scala/org/apache/gluten/extension/FallbackBroadcastHashJoinRules.scala:230 — FallbackBroadcastHashJoin.preTagBroadcastExchangeFallback has cognitive complexity 22 (threshold 15). Drivers by points: match/switch 6 (13 pts), if/else 6 (9 pts) (nesting depth added 10). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own 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 · VeloxBackendSettings.supportWindowExec (cognitive 22) · ×1
  • VeloxBackendSettings.supportWindowExec (cognitive 22) backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxBackend.scala:413 — VeloxBackendSettings.supportWindowExec has cognitive complexity 22 (threshold 15). Drivers by points: match/switch 8 (12 pts), if/else 9 (10 pts) (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.
D2 · Cognitive Complexity · Spark34Shims.orderPartitions (cognitive 22) · ×1
  • Spark34Shims.orderPartitions (cognitive 22) shims/spark34/src/main/scala/org/apache/gluten/sql/shims/spark34/Spark34Shims.scala:179 — Spark34Shims.orderPartitions has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (17 pts), match/switch 2 (3 pts), boolean chains 2 (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.
D2 · Cognitive Complexity · Spark35Shims.orderPartitions (cognitive 22) · ×1
  • Spark35Shims.orderPartitions (cognitive 22) shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala:222 — Spark35Shims.orderPartitions has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (17 pts), match/switch 2 (3 pts), boolean chains 2 (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.
D2 · Cognitive Complexity · ArrowColumnVector.initAccessor (cognitive 22) · ×1
  • ArrowColumnVector.initAccessor (cognitive 22) gluten-arrow/src/main/java/org/apache/gluten/vectorized/ArrowColumnVector.java:150 — ArrowColumnVector.initAccessor has cognitive complexity 22 (threshold 15). Drivers by points: if/else 20, loops 1 (2 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · RuleExpressionHelper.extractJoinKeys (cognitive 21) · ×1
  • RuleExpressionHelper.extractJoinKeys (cognitive 21) backends-clickhouse/src/main/scala/org/apache/gluten/extension/JoinAggregateToAggregateUnion.scala:94 — RuleExpressionHelper.extractJoinKeys has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 2, error handling 1 (2 pts), match/switch 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.
D2 · Cognitive Complexity · PullOutPreProject.needsPreProject (cognitive 21) · ×1
  • PullOutPreProject.needsPreProject (cognitive 21) gluten-substrait/src/main/scala/org/apache/gluten/extension/columnar/rewrite/PullOutPreProject.scala:54 — PullOutPreProject.needsPreProject has cognitive complexity 21 (threshold 15). Drivers by points: match/switch 4 (9 pts), if/else 6 (7 pts), boolean chains 5 (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.
D2 · Cognitive Complexity · BoltBackendSettings.supportWindowExec (cognitive 20) · ×1
  • BoltBackendSettings.supportWindowExec (cognitive 20) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala:427 — BoltBackendSettings.supportWindowExec has cognitive complexity 20 (threshold 15). Drivers by points: match/switch 7 (10 pts), if/else 8 (9 pts), boolean chains 1 (nesting depth added 4). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own 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 · HashAggregateExecTransformer.applyRowConstruct (cognitive 20) · ×1
  • HashAggregateExecTransformer.applyRowConstruct (cognitive 20) backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:269 — HashAggregateExecTransformer.applyRowConstruct has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 2 (5 pts), boolean chains 1, 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 · CHHashAggregateExecTransformer.doTransform (cognitive 20) · ×1
  • CHHashAggregateExecTransformer.doTransform (cognitive 20) backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHHashAggregateExecTransformer.scala:147 — CHHashAggregateExecTransformer.doTransform has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (9 pts), loops 3 (9 pts), boolean chains 2 (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.
D2 · Cognitive Complexity · GlutenOptimisticTransaction.writeFiles (cognitive 20) · ×1
  • GlutenOptimisticTransaction.writeFiles (cognitive 20) backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala:60 — GlutenOptimisticTransaction.writeFiles has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11, boolean chains 4, match/switch 3, error handling 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 · VeloxBackendSettings.supportWriteFilesExec (cognitive 20) · ×1
  • VeloxBackendSettings.supportWriteFilesExec (cognitive 20) backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxBackend.scala:296 — VeloxBackendSettings.supportWriteFilesExec has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12, match/switch 4 (5 pts), boolean chains 3 (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 · VeloxSparkPlanExecApi.genColumnarShuffleExchange (cognitive 20) · ×1
  • VeloxSparkPlanExecApi.genColumnarShuffleExchange (cognitive 20) backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala:414 — VeloxSparkPlanExecApi.genColumnarShuffleExchange has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 1, match/switch 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · TakeOrderedAndProjectExecTransformer.doExecuteColumnar (cognitive 20) · ×1
  • TakeOrderedAndProjectExecTransformer.doExecuteColumnar (cognitive 20) gluten-substrait/src/main/scala/org/apache/gluten/execution/TakeOrderedAndProjectExecTransformer.scala:109 — TakeOrderedAndProjectExecTransformer.doExecuteColumnar has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (18 pts), match/switch 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 · CHCelebornColumnarBatchSerializerInstance.deserializeStream (cognitive 19) · ×1
  • CHCelebornColumnarBatchSerializerInstance.deserializeStream (cognitive 19) backends-clickhouse/src-celeborn/main/scala/org/apache/spark/shuffle/CHCelebornColumnarBatchSerializer.scala:68 — CHCelebornColumnarBatchSerializerInstance.deserializeStream has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 3, error handling 1, 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 · ClickhouseOptimisticTransaction.pipelineWriteFiles (cognitive 19) · ×1
  • ClickhouseOptimisticTransaction.pipelineWriteFiles (cognitive 19) backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/ClickhouseOptimisticTransaction.scala:236 — ClickhouseOptimisticTransaction.pipelineWriteFiles has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 3, match/switch 2, error handling 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 · CHAQEPropagateEmptyRelation.apply (cognitive 19) · ×1
  • CHAQEPropagateEmptyRelation.apply (cognitive 19) backends-clickhouse/src/main/scala/org/apache/gluten/extension/CHAQEPropagateEmptyRelation.scala:30 — CHAQEPropagateEmptyRelation.apply has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 4 (13 pts), if/else 5, 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.
D2 · Cognitive Complexity · FlattenNestedExpressions.optimize (cognitive 19) · ×1
  • FlattenNestedExpressions.optimize (cognitive 19) backends-clickhouse/src/main/scala/org/apache/gluten/extension/FlattenNestedExpressions.scala:107 — FlattenNestedExpressions.optimize has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (9 pts), match/switch 5 (8 pts), boolean chains 2 (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.
D2 · Cognitive Complexity · gen-function-support-docs.generate_function_list (cognitive 19) · ×1
  • gen-function-support-docs.generate_function_list (cognitive 19) tools/scripts/gen-function-support-docs.py:903 — gen-function-support-docs.generate_function_list has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), error handling 1 (3 pts), loops 2, ternaries 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 · gen-function-support-docs.generate_function_doc (cognitive 19) · ×1
  • gen-function-support-docs.generate_function_doc (cognitive 19) tools/scripts/gen-function-support-docs.py:1469 — gen-function-support-docs.generate_function_doc has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (10 pts), ternaries 2 (5 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.
D2 · Cognitive Complexity · PushdownProjectExecBeforeGeneratorRule.apply (cognitive 18) · ×1
  • PushdownProjectExecBeforeGeneratorRule.apply (cognitive 18) backends-bolt/src/main/scala/org/apache/gluten/extension/PushdownProjectExecBeforeGeneratorRule.scala:28 — PushdownProjectExecBeforeGeneratorRule.apply has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (17 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.
D2 · Cognitive Complexity · ColumnarShuffleWriter.internalWrite (cognitive 18) · ×1
  • ColumnarShuffleWriter.internalWrite (cognitive 18) backends-bolt/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleWriter.scala:267 — ColumnarShuffleWriter.internalWrite has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), match/switch 2 (5 pts), boolean chains 2, 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.
D2 · Cognitive Complexity · FallbackBroadcastHashJoinPrepQueryStage.applyBNLJPrepQueryStage (cognitive 18) · ×1
  • FallbackBroadcastHashJoinPrepQueryStage.applyBNLJPrepQueryStage (cognitive 18) backends-clickhouse/src/main/scala/org/apache/gluten/extension/FallbackBroadcastHashJoinRules.scala:97 — FallbackBroadcastHashJoinPrepQueryStage.applyBNLJPrepQueryStage has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), match/switch 3, boolean chains 1 (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.
D2 · Cognitive Complexity · PushdownAggregatePreProjectionAheadExpand.tryPushdownAggregatePreProject (cognitive 18) · ×1
  • PushdownAggregatePreProjectionAheadExpand.tryPushdownAggregatePreProject (cognitive 18) backends-clickhouse/src/main/scala/org/apache/gluten/extension/PushdownAggregatePreProjectionAheadExpand.scala:66 — PushdownAggregatePreProjectionAheadExpand.tryPushdownAggregatePreProject has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), match/switch 3 (5 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ColumnarArrowPythonRunner.createNewWriter (cognitive 18) · ×1
  • ColumnarArrowPythonRunner.createNewWriter (cognitive 18) backends-velox/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:150 — ColumnarArrowPythonRunner.createNewWriter has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (12 pts), loops 2 (3 pts), boolean chains 2, error handling 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 · IcebergScanTransformer.typesMatch (cognitive 18) · ×1
  • IcebergScanTransformer.typesMatch (cognitive 18) gluten-iceberg/src/main/scala/org/apache/gluten/execution/IcebergScanTransformer.scala:306 — IcebergScanTransformer.typesMatch has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 3, match/switch 2 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PushAggregateThroughJoin.pushPartialAggToJoinSide (cognitive 18) · ×1
  • PushAggregateThroughJoin.pushPartialAggToJoinSide (cognitive 18) gluten-substrait/src/main/scala/org/apache/gluten/extension/joinagg/PushAggregateThroughJoin.scala:228 — PushAggregateThroughJoin.pushPartialAggToJoinSide has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 8 (10 pts), boolean chains 4, if/else 4 (nesting depth added 2). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own 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 · CelebornShuffleManager.getWriter (cognitive 18) · ×1
  • CelebornShuffleManager.getWriter (cognitive 18) gluten-celeborn/src/main/java/org/apache/spark/shuffle/gluten/celeborn/CelebornShuffleManager.java:290 — CelebornShuffleManager.getWriter has cognitive complexity 18 (threshold 15). Drivers by points: error handling 5 (9 pts), if/else 6 (9 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 · BoltSparkPlanExecApi.genColumnarShuffleExchange (cognitive 17) · ×1
  • BoltSparkPlanExecApi.genColumnarShuffleExchange (cognitive 17) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:389 — BoltSparkPlanExecApi.genColumnarShuffleExchange has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 1, match/switch 1 (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.
D2 · Cognitive Complexity · CHIteratorApi.genSplitInfo (cognitive 17) · ×1
  • CHIteratorApi.genSplitInfo (cognitive 17) backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHIteratorApi.scala:127 — CHIteratorApi.genSplitInfo has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), match/switch 2 (5 pts), loops 1 (2 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.
D2 · Cognitive Complexity · LazyAggregateExpandRule.findGroupingIdIndex (cognitive 17) · ×1
  • LazyAggregateExpandRule.findGroupingIdIndex (cognitive 17) backends-clickhouse/src/main/scala/org/apache/gluten/extension/LazyAggregateExpandRule.scala:214 — LazyAggregateExpandRule.findGroupingIdIndex has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 1, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CudfNodeValidationRule.setTagForWholeStageTransformer (cognitive 17) · ×1
  • CudfNodeValidationRule.setTagForWholeStageTransformer (cognitive 17) backends-velox/src/main/scala/org/apache/gluten/extension/CudfNodeValidationRule.scala:47 — CudfNodeValidationRule.setTagForWholeStageTransformer has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), match/switch 2 (6 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.
D2 · Cognitive Complexity · CollapseGetJsonObjectExpressionRule.optimizeNestedFunctions (cognitive 17) · ×1
  • CollapseGetJsonObjectExpressionRule.optimizeNestedFunctions (cognitive 17) gluten-substrait/src/main/scala/org/apache/gluten/extension/columnar/CollapseGetJsonObjectExpressionRule.scala:67 — CollapseGetJsonObjectExpressionRule.optimizeNestedFunctions has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (14 pts), match/switch 2, boolean chains 1 (nesting depth added 5). 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 · GlutenAutoAdjustStageResourceProfile.apply (cognitive 17) · ×1
  • GlutenAutoAdjustStageResourceProfile.apply (cognitive 17) gluten-substrait/src/main/scala/org/apache/spark/sql/execution/GlutenAutoAdjustStageResourceProfile.scala:64 — GlutenAutoAdjustStageResourceProfile.apply has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 3, match/switch 2 (3 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 · StructLiteralNode.getFieldLiteral (cognitive 17) · ×1
  • StructLiteralNode.getFieldLiteral (cognitive 17) gluten-substrait/src/main/java/org/apache/gluten/substrait/expression/StructLiteralNode.java:30 — StructLiteralNode.getFieldLiteral has cognitive complexity 17 (threshold 15). Drivers by points: if/else 17. 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 · SearchRexCallConverter.toTypedExpr (cognitive 17) · ×1
  • SearchRexCallConverter.toTypedExpr (cognitive 17) gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/functions/SearchRexCallConverter.java:49 — SearchRexCallConverter.toTypedExpr has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (17 pts) (nesting depth added 10). 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 · WindowUtils.extractWindowParameters (cognitive 17) · ×1
  • WindowUtils.extractWindowParameters (cognitive 17) gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/WindowUtils.java:42 — WindowUtils.extractWindowParameters has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (17 pts) (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 · StreamExecJoin.translateToPlanInternal (cognitive 17) · ×1
  • StreamExecJoin.translateToPlanInternal (cognitive 17) gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecJoin.java:175 — StreamExecJoin.translateToPlanInternal has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 1 (4 pts), boolean chains 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 · CelebornUtils.unregisterShuffle (cognitive 17) · ×1
  • CelebornUtils.unregisterShuffle (cognitive 17) gluten-celeborn/src/main/java/org/apache/spark/shuffle/gluten/celeborn/CelebornUtils.java:58 — CelebornUtils.unregisterShuffle has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), error handling 4 (5 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 · check.format_command (cognitive 17) · ×1
  • check.format_command (cognitive 17) dev/check.py:121 — check.format_command has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 1, 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 · PullOutDuplicateProject.apply (cognitive 16) · ×1
  • PullOutDuplicateProject.apply (cognitive 16) backends-bolt/src/main/scala/org/apache/gluten/extension/PullOutDuplicateProject.scala:33 — PullOutDuplicateProject.apply has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), match/switch 2 (4 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.
D2 · Cognitive Complexity · JoinTypeTransform.toSubstraitJoinType (cognitive 16) · ×1
  • JoinTypeTransform.toSubstraitJoinType (cognitive 16) backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHHashJoinExecTransformer.scala:42 — JoinTypeTransform.toSubstraitJoinType has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (15 pts), match/switch 1 (nesting depth added 5). 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 · JoinAggregateToAggregateUnion.visitPlan (cognitive 16) · ×1
  • JoinAggregateToAggregateUnion.visitPlan (cognitive 16) backends-clickhouse/src/main/scala/org/apache/gluten/extension/JoinAggregateToAggregateUnion.scala:680 — JoinAggregateToAggregateUnion.visitPlan has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 1, match/switch 1 (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.
D2 · Cognitive Complexity · JoinAggregateToAggregateUnion.collectSameKeysJoinedAggregates (cognitive 16) · ×1
  • JoinAggregateToAggregateUnion.collectSameKeysJoinedAggregates (cognitive 16) backends-clickhouse/src/main/scala/org/apache/gluten/extension/JoinAggregateToAggregateUnion.scala:997 — JoinAggregateToAggregateUnion.collectSameKeysJoinedAggregates has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 2, match/switch 1 (nesting depth added 5). 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 · RangePartitionerBoundsGenerator.getRangeBounds (cognitive 16) · ×1
  • RangePartitionerBoundsGenerator.getRangeBounds (cognitive 16) backends-clickhouse/src/main/scala/org/apache/spark/shuffle/utils/RangePartitionerBoundsGenerator.scala:59 — RangePartitionerBoundsGenerator.getRangeBounds has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 1 (4 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 · MergeTreePartsPartitionsUtil.genPartitionSeq (cognitive 16) · ×1
  • MergeTreePartsPartitionsUtil.genPartitionSeq (cognitive 16) backends-clickhouse/src/main/scala/org/apache/spark/sql/execution/datasources/clickhouse/utils/MergeTreePartsPartitionsUtil.scala:140 — MergeTreePartsPartitionsUtil.genPartitionSeq has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 1, match/switch 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · VeloxSparkPlanExecApi.getShuffleWriterType (cognitive 16) · ×1
  • VeloxSparkPlanExecApi.getShuffleWriterType (cognitive 16) backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala:627 — VeloxSparkPlanExecApi.getShuffleWriterType has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HashAggregateExecTransformer.applyExtractStruct (cognitive 16) · ×1
  • HashAggregateExecTransformer.applyExtractStruct (cognitive 16) backends-velox/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:117 — HashAggregateExecTransformer.applyExtractStruct has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2, 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.
D2 · Cognitive Complexity · ExpressionBuilder.makeLiteral (cognitive 16) · ×1
  • ExpressionBuilder.makeLiteral (cognitive 16) gluten-substrait/src/main/java/org/apache/gluten/substrait/expression/ExpressionBuilder.java:149 — ExpressionBuilder.makeLiteral has cognitive complexity 16 (threshold 15). Drivers by points: if/else 16. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · WindowFunctionNode.setBound (cognitive 16) · ×1
  • WindowFunctionNode.setBound (cognitive 16) gluten-substrait/src/main/java/org/apache/gluten/substrait/expression/WindowFunctionNode.java:93 — WindowFunctionNode.setBound has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (15 pts), match/switch 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · PartitionDataJson.getValue (cognitive 16) · ×1
  • PartitionDataJson.getValue (cognitive 16) gluten-iceberg/src/main/java/org/apache/gluten/connector/write/PartitionDataJson.java:103 — PartitionDataJson.getValue has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), error handling 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 · ThrowOnOomMemoryTarget.borrow (cognitive 16) · ×1
  • ThrowOnOomMemoryTarget.borrow (cognitive 16) gluten-core/src/main/java/org/apache/gluten/memory/memtarget/ThrowOnOomMemoryTarget.java:57 — ThrowOnOomMemoryTarget.borrow has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 3, error handling 1 (2 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.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D4 · Code Duplication · Near-duplicate member family (15 members, 8 shared lines) · ×1
  • Near-duplicate member family (15 members, 8 shared lines) backends-bolt/src/main/scala/org/apache/gluten/spi/SharedLibraryLoaderCentos7.scala:33 — backends-bolt/src/main/scala/org/apache/gluten/spi/SharedLibraryLoaderCentos7.scala:33-50 | backends-bolt/src/main/scala/org/apache/gluten/spi/SharedLibraryLoaderCentos8.scala:34-54 | backends-bolt/src/main/scala/org/apache/gluten/spi/SharedLibraryLoaderCentos9.scala:28-48 | backends-bolt/src/main/scala/org/apache/gluten/spi/SharedLibraryLoaderDebian11.scala:27-52 | backends-bolt/src/main/scala/org/apache/gluten/spi/SharedLibraryLoaderDebian12.scala:27-58 | backends-bolt/src/main/scala/org/apache/gluten/spi/SharedLibraryLoaderOpenEuler2403.scala:26-48 | backends-bolt/src/main/scala/org/apache/gluten/spi/SharedLibraryLoaderUbuntu2004.scala:27-68 | backends-bolt/src/main/scala/org/apache/gluten/spi/SharedLibraryLoaderUbuntu2204.scala:26-52 | backends-velox/src/main/scala/org/apache/gluten/spi/SharedLibraryLoaderCentos8.scala:34-53 | backends-velox/src/main/scala/org/apache/gluten/spi/SharedLibraryLoaderCentos9.scala:28-47 | backends-velox/src/main/scala/org/apache/gluten/spi/SharedLibraryLoaderDebian11.scala:27-51 | backends-velox/src/main/scala/org/apache/gluten/spi/SharedLibraryLoaderDebian12.scala:27-57 | backends-velox/src/main/scala/org/apache/gluten/spi/SharedLibraryLoaderOpenEuler2403.scala:26-47 | backends-velox/src/main/scala/org/apache/gluten/spi/SharedLibraryLoaderUbuntu2004.scala:27-67 | backends-velox/src/main/scala/org/apache/gluten/spi/SharedLibraryLoaderUbuntu2204.scala:26-51 — These 15 members are variants of one another: a block of 8 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 15 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 15 times.
D4 · Code Duplication · Near-duplicate member family (6 members, 23 shared lines) · ×1
  • Near-duplicate member family (6 members, 23 shared lines) tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:82 — tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:82-120 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:122-153 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:165-192 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:194-218 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:220-258 | tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala:260-288 — These 6 members are variants of one another: a block of 23 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 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 · Near-duplicate member family (6 members, 8 shared lines) · ×1
  • Near-duplicate member family (6 members, 8 shared lines) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:444 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:444-461 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:524-541 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:564-595 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:458-475 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:538-555 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:578-609 — These 6 members are variants of one another: a block of 8 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 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 · Near-duplicate member family (5 members, 264 shared lines) · ×1
  • Near-duplicate member family (5 members, 264 shared lines) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:879 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:879-1208 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:879-1208 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:888-1222 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:895-1226 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:895-1226 — These 5 members are variants of one another: a block of 264 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 (5 members, 99 shared lines) · ×1
  • Near-duplicate member family (5 members, 99 shared lines) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:269 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:269-412 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:269-412 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:270-415 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:277-422 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:277-422 — These 5 members are variants of one another: a block of 99 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, 59 shared lines) · ×1
  • Near-duplicate member family (4 members, 59 shared lines) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:143 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:143-238 | backends-bolt/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala:271-368 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:373-468 | backends-velox/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala:436-536 — These 4 members are variants of one another: a block of 59 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 family (4 members, 38 shared lines) · ×1
  • Near-duplicate member family (4 members, 38 shared lines) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:136 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:136-179 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:186-229 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:163-208 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:221-266 — These 4 members are variants of one another: a block of 38 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 family (4 members, 31 shared lines) · ×1
  • Near-duplicate member family (4 members, 31 shared lines) shims/spark35/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:246 — shims/spark35/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:246-299 | shims/spark40/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:244-299 | shims/spark41/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:244-299 | shims/spark42/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:244-299 — These 4 members are variants of one another: a block of 31 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 family (4 members, 11 shared lines) · ×1
  • Near-duplicate member family (4 members, 11 shared lines) backends-bolt/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala:162 — backends-bolt/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala:162-226 | backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala:313-389 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala:313-389 | backends-velox/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala:75-161 — These 4 members are variants of one another: a block of 11 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 family (3 members, 69 shared lines) · ×1
  • Near-duplicate member family (3 members, 69 shared lines) shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:427 — shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:427-512 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:434-519 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:434-519 — These 3 members are variants of one another: a block of 69 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 3 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 3 times.
D4 · Code Duplication · Near-duplicate member family (3 members, 58 shared lines) · ×1
  • Near-duplicate member family (3 members, 58 shared lines) backends-clickhouse/src/main/scala/org/apache/gluten/metrics/BroadcastNestedLoopJoinMetricsUpdater.scala:26 — backends-clickhouse/src/main/scala/org/apache/gluten/metrics/BroadcastNestedLoopJoinMetricsUpdater.scala:26-101 | backends-clickhouse/src/main/scala/org/apache/gluten/metrics/HashJoinMetricsUpdater.scala:25-111 | backends-clickhouse/src/main/scala/org/apache/gluten/metrics/SortMergeJoinMetricsUpdater.scala:26-112 — These 3 members are variants of one another: a block of 58 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 3 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 3 times.
D4 · Code Duplication · Near-duplicate member pair (129 shared lines) · ×1
  • Near-duplicate member pair (129 shared lines) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala:111 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala:111-255 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxBackend.scala:114-263 — These two members are variants of one another: 129 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 (91 shared lines) · ×1
  • Near-duplicate member pair (91 shared lines) backends-bolt/src/main/scala/org/apache/spark/sql/execution/utils/ExecUtil.scala:96 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/utils/ExecUtil.scala:96-255 | backends-velox/src/main/scala/org/apache/spark/sql/execution/utils/ExecUtil.scala:96-226 — These two members are variants of one another: 91 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 (90 shared lines) · ×1
  • Near-duplicate member pair (90 shared lines) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:192 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:192-287 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:335-437 — These two members are variants of one another: 90 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 (88 shared lines) · ×1
  • Near-duplicate member pair (88 shared lines) backends-bolt/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala:206 — backends-bolt/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala:206-346 | backends-velox/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala:210-363 — These two members are variants of one another: 88 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (80 shared lines) · ×1
  • Near-duplicate member pair (80 shared lines) backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:286 — backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:286-391 | backends-velox/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:389-504 — These two members are variants of one another: 80 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (53 shared lines) · ×1
  • Near-duplicate member pair (53 shared lines) gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecJoin.java:176 — gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecJoin.java:176-363 | gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWindowJoin.java:156-267 — These two members are variants of one another: 53 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (36 shared lines) · ×1
  • Near-duplicate member pair (36 shared lines) gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGroupAggregate.java:169 — gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGroupAggregate.java:169-239 | gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGroupWindowAggregate.java:172-272 — 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 · Edited copy of a member (82 corresponding lines) · ×1
  • Edited copy of a member (82 corresponding lines) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:424 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:424-505 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:424-505 — 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 (41 corresponding lines) · ×1
  • Edited copy of a member (41 corresponding lines) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:89 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:89-129 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:108-150 — 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 copy of a member (46 corresponding lines) · ×1
  • Edited copy of a member (46 corresponding lines) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:724 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:724-785 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:315-363 — 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 · Members sharing a duplicated core (16 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (16 members, 50+ identical tokens) backends-bolt/src/main/scala/org/apache/gluten/metrics/ExpandMetricsUpdater.scala:23 — backends-bolt/src/main/scala/org/apache/gluten/metrics/ExpandMetricsUpdater.scala:23-35 | backends-bolt/src/main/scala/org/apache/gluten/metrics/FilterMetricsUpdater.scala:26-45 | backends-bolt/src/main/scala/org/apache/gluten/metrics/LimitMetricsUpdater.scala:23-35 | backends-bolt/src/main/scala/org/apache/gluten/metrics/ProjectMetricsUpdater.scala:26-45 | backends-bolt/src/main/scala/org/apache/gluten/metrics/SampleMetricsUpdater.scala:23-35 | backends-bolt/src/main/scala/org/apache/gluten/metrics/SortMetricsUpdater.scala:25-49 | backends-bolt/src/main/scala/org/apache/gluten/metrics/TopNMetricsUpdater.scala:25-36 | backends-bolt/src/main/scala/org/apache/gluten/metrics/WindowMetricsUpdater.scala:23-39 | backends-velox/src/main/scala/org/apache/gluten/metrics/ExpandMetricsUpdater.scala:23-35 | backends-velox/src/main/scala/org/apache/gluten/metrics/FilterMetricsUpdater.scala:26-45 | backends-velox/src/main/scala/org/apache/gluten/metrics/LimitMetricsUpdater.scala:23-35 | backends-velox/src/main/scala/org/apache/gluten/metrics/ProjectMetricsUpdater.scala:26-45 | backends-velox/src/main/scala/org/apache/gluten/metrics/SampleMetricsUpdater.scala:23-35 | backends-velox/src/main/scala/org/apache/gluten/metrics/SortMetricsUpdater.scala:25-49 | backends-velox/src/main/scala/org/apache/gluten/metrics/TopNMetricsUpdater.scala:25-36 | backends-velox/src/main/scala/org/apache/gluten/metrics/WindowMetricsUpdater.scala:23-39 — These 16 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 16 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 16 times.
D4 · Code Duplication · Members sharing a duplicated core (10 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (10 members, 50+ identical tokens) backends-clickhouse/src/main/scala/org/apache/gluten/utils/CHPartitionsUtil.scala:114 — backends-clickhouse/src/main/scala/org/apache/gluten/utils/CHPartitionsUtil.scala:114-149 | gluten-substrait/src/main/scala/org/apache/gluten/utils/PartitionsUtil.scala:109-144 | shims/spark34/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:187-239 | shims/spark35/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:182-233 | shims/spark40/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:182-231 | shims/spark40/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:157-197 | shims/spark41/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:182-231 | shims/spark41/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:156-196 | shims/spark42/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:182-231 | shims/spark42/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:156-196 — These 10 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 10 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 10 times.
D4 · Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (6 members, 50+ identical tokens) gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecDeduplicate.java:164 — gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecDeduplicate.java:164-244 | gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGlobalWindowAggregate.java:173-300 | gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGroupWindowAggregate.java:172-272 | gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecLocalWindowAggregate.java:159-247 | gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWindowAggregate.java:174-315 | gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWindowJoin.java:156-267 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
D4 · Code Duplication · Duplicated block (132 lines × 2) · ×1
  • Duplicated block (132 lines × 2) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:102 — backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:102-233 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:113-244 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala` and `backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 536 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.
D4 · Code Duplication · Duplicated block (115–124 lines × 2) · ×1
  • Duplicated block (115–124 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/RowToBoltColumnarExec.scala:125 — backends-bolt/src/main/scala/org/apache/gluten/execution/RowToBoltColumnarExec.scala:125-239 | backends-velox/src/main/scala/org/apache/gluten/execution/RowToVeloxColumnarExec.scala:126-249 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/RowToBoltColumnarExec.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/RowToVeloxColumnarExec.scala` as WHOLE FILES: 92% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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.
D4 · Code Duplication · Duplicated block (122 lines × 2) · ×1
  • Duplicated block (122 lines × 2) shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala:249 — shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala:249-370 | shims/spark41/src/main/scala/org/apache/gluten/sql/shims/spark41/Spark41Shims.scala:248-369 — before extracting anything, compare `shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala` and `shims/spark41/src/main/scala/org/apache/gluten/sql/shims/spark41/Spark41Shims.scala` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 299 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.
D4 · Code Duplication · Duplicated block (105 lines × 2) · ×1
  • Duplicated block (105 lines × 2) shims/spark34/src/main/scala/org/apache/gluten/sql/shims/spark34/Spark34Shims.scala:189 — shims/spark34/src/main/scala/org/apache/gluten/sql/shims/spark34/Spark34Shims.scala:189-293 | shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala:232-336 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/gluten/sql/shims/spark34/Spark34Shims.scala` and `shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 168 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.
D4 · Code Duplication · Duplicated block (86–102 lines × 2) · ×1
  • Duplicated block (86–102 lines × 2) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:346 — backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:346-447 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:339-424 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala` and `backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 385 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 `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala: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. 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 (82–87 lines × 2) · ×1
  • Duplicated block (82–87 lines × 2) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:248 — backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:248-334 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:259-340 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala` and `backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 536 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.
D4 · Code Duplication · Duplicated block (81–82 lines × 2) · ×1
  • Duplicated block (81–82 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala:362 — backends-bolt/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala:362-442 | backends-velox/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala:379-460 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala` and `backends-velox/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 295 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.
D4 · Code Duplication · Duplicated block (77–79 lines × 2) · ×1
  • Duplicated block (77–79 lines × 2) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:175 — backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:175-253 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:169-245 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala` and `backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 385 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.
D4 · Code Duplication · Duplicated block (75 lines × 3) · ×1
  • Duplicated block (75 lines × 3) shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:920 — shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:920-994 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:924-998 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:924-998 — before extracting anything, compare `shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 30 separate duplicated blocks between them, totalling at least 983 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 `shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:920` 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 (69–75 lines × 2) · ×1
  • Duplicated block (69–75 lines × 2) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:440 — backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:440-514 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:446-514 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala` and `backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 536 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.
D4 · Code Duplication · Duplicated block (74 lines × 2) · ×1
  • Duplicated block (74 lines × 2) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:911 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:911-984 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:911-984 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 1116 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 `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:911` 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 (72 lines × 5) · ×1
  • Duplicated block (72 lines × 5) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1067 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1067-1138 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1067-1138 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1081-1152 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1085-1156 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1085-1156 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 1116 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 `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala: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.
D4 · Code Duplication · Duplicated block (69–71 lines × 5) · ×1
  • Duplicated block (69–71 lines × 5) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:970 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:970-1038 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:970-1038 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:980-1050 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:984-1054 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:984-1054 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 1116 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 `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:970` 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 (70 lines × 2) · ×1
  • Duplicated block (70 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:1238 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:1238-1307 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala:1675-1744 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 498 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:1238` 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 (63–69 lines × 2) · ×1
  • Duplicated block (63–69 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala:162 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala:162-224 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxBackend.scala:165-233 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxBackend.scala` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 271 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala:162` 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 (67 lines × 5) · ×1
  • Duplicated block (67 lines × 5) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:549 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:549-615 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:549-615 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:556-622 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:563-629 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:563-629 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 1116 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.
D4 · Code Duplication · Duplicated block (64–67 lines × 2) · ×1
  • Duplicated block (64–67 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:351 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:351-414 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:509-575 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 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 `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:351` 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 (65 lines × 2) · ×1
  • Duplicated block (65 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala:274 — backends-bolt/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala:274-338 | backends-velox/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala:272-336 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 225 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 `backends-bolt/src/main/scala/org/apache/gluten/execution/GenerateExecTransformer.scala:274` 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 (58–65 lines × 2) · ×1
  • Duplicated block (58–65 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:292 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:292-349 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:443-507 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 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 `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:292` 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 (64 lines × 5) · ×1
  • Duplicated block (64 lines × 5) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:270 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:270-333 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:270-333 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:271-334 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:278-341 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:278-341 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 1116 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 `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:270` 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 (64 lines × 4) · ×1
  • Duplicated block (64 lines × 4) backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:202 — backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:202-265 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:297-360 | backends-velox/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala:162-225 | backends-velox/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala:258-321 — before extracting anything, compare `backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 179 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 `backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:202` 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 (62 lines × 5) · ×1
  • Duplicated block (62 lines × 5) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:157 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:157-218 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:157-218 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:157-218 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:157-218 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:157-218 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala` and `shims/spark35/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 197 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.
D4 · Code Duplication · Duplicated block (59 lines × 2) · ×1
  • Duplicated block (59 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:839 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:839-897 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala:1232-1290 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 498 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.
D4 · Code Duplication · Duplicated block (58 lines × 5) · ×1
  • Duplicated block (58 lines × 5) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:239 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:239-296 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:239-296 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:239-296 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:239-296 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:239-296 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala` and `shims/spark35/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 197 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.
D4 · Code Duplication · Duplicated block (54 lines × 2) · ×1
  • Duplicated block (54 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:405 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:405-458 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala:438-491 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 498 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 (51 lines × 2) · ×1
  • Duplicated block (51 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/execution/BoltColumnarWriteFilesExec.scala:114 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/BoltColumnarWriteFilesExec.scala:114-164 | backends-velox/src/main/scala/org/apache/spark/sql/execution/VeloxColumnarWriteFilesExec.scala:119-169 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/BoltColumnarWriteFilesExec.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/VeloxColumnarWriteFilesExec.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 148 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 `backends-bolt/src/main/scala/org/apache/spark/sql/execution/BoltColumnarWriteFilesExec.scala: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.
D4 · Code Duplication · Duplicated block (50 lines × 2) · ×1
  • Duplicated block (50 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/execution/utils/ExecUtil.scala:97 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/utils/ExecUtil.scala:97-146 | backends-velox/src/main/scala/org/apache/spark/sql/execution/utils/ExecUtil.scala:97-146 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/utils/ExecUtil.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/utils/ExecUtil.scala` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 128 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 `backends-bolt/src/main/scala/org/apache/spark/sql/execution/utils/ExecUtil.scala:97` 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 (49 lines × 2) · ×1
  • Duplicated block (49 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:285 — backends-bolt/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:285-333 | backends-velox/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:289-337 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 204 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.
D4 · Code Duplication · Duplicated block (48 lines × 2) · ×1
  • Duplicated block (48 lines × 2) backends-clickhouse/src-celeborn/main/scala/org/apache/spark/shuffle/CHCelebornColumnarBatchSerializer.scala:199 — backends-clickhouse/src-celeborn/main/scala/org/apache/spark/shuffle/CHCelebornColumnarBatchSerializer.scala:199-246 | backends-clickhouse/src/main/scala/org/apache/gluten/vectorized/CHColumnarBatchSerializer.scala:143-190 — 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 (47 lines × 3) · ×1
  • Duplicated block (47 lines × 3) shims/spark40/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:207 — shims/spark40/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:207-253 | shims/spark41/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:206-252 | shims/spark42/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:206-252 — before extracting anything, compare `shims/spark40/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala` and `shims/spark41/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 173 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.
D4 · Code Duplication · Duplicated block (40–46 lines × 2) · ×1
  • Duplicated block (40–46 lines × 2) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:448 — backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:448-493 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:431-470 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala` and `backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 385 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 `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:448` 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 (44 lines × 5) · ×1
  • Duplicated block (44 lines × 5) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:355 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:355-398 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:355-398 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:355-398 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:355-398 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala:355-398 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala` and `shims/spark35/src/main/scala/org/apache/spark/storage/GlutenPushBasedFetchHelper.scala` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 197 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.
D4 · Code Duplication · Duplicated block (42–43 lines × 5) · ×1
  • Duplicated block (42–43 lines × 5) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1141 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1141-1182 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1141-1182 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1154-1196 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1158-1200 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1158-1200 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 1116 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 `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1141` 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 (41–42 lines × 2) · ×1
  • Duplicated block (41–42 lines × 2) backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:78 — backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:78-118 | backends-velox/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:89-130 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala` and `backends-velox/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 286 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 `backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:78` 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 (41 lines × 3) · ×1
  • Duplicated block (41 lines × 3) shims/spark40/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:254 — shims/spark40/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:254-294 | shims/spark41/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:254-294 | shims/spark42/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:254-294 — before extracting anything, compare `shims/spark40/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala` and `shims/spark41/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 221 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 `shims/spark40/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:254` 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 (40 lines × 4) · ×1
  • Duplicated block (40 lines × 4) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:185 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:185-224 | backends-bolt/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala:315-354 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:415-454 | backends-velox/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala:483-522 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala` and `backends-bolt/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 100 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 `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala: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.
D4 · Code Duplication · Duplicated block (40 lines × 3) · ×1
  • Duplicated block (40 lines × 3) shims/spark40/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:158 — shims/spark40/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:158-197 | shims/spark41/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:157-196 | shims/spark42/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:157-196 — before extracting anything, compare `shims/spark40/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala` and `shims/spark41/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 173 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.
D4 · Code Duplication · Duplicated block (39 lines × 5) · ×1
  • Duplicated block (39 lines × 5) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1235 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1235-1273 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1235-1273 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1249-1287 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1253-1291 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1253-1291 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 1116 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 `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1235` 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 (39 lines × 2) · ×1
  • Duplicated block (39 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala:106 — backends-bolt/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala:106-144 | backends-velox/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala:110-148 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala` and `backends-velox/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 295 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.
D4 · Code Duplication · Duplicated block (38 lines × 2) · ×1
  • Duplicated block (38 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialGenerateExec.scala:299 — backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialGenerateExec.scala:299-336 | backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarPartialGenerateExec.scala:220-257 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarPartialGenerateExec.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarPartialGenerateExec.scala` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 122 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. 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.
D4 · Code Duplication · Duplicated block (36–37 lines × 2) · ×1
  • Duplicated block (36–37 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:252 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:252-287 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:401-437 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 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 `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:252` 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 (37 lines × 2) · ×1
  • Duplicated block (37 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/execution/utils/ExecUtil.scala:49 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/utils/ExecUtil.scala:49-85 | backends-velox/src/main/scala/org/apache/spark/sql/execution/utils/ExecUtil.scala:49-85 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/utils/ExecUtil.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/utils/ExecUtil.scala` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 128 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.
D4 · Code Duplication · Duplicated block (33–35 lines × 2) · ×1
  • Duplicated block (33–35 lines × 2) backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:337 — backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:337-369 | backends-velox/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:446-480 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala` and `backends-velox/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 286 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 `backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:337` 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 (34 lines × 5) · ×1
  • Duplicated block (34 lines × 5) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:228 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:228-261 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:228-261 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:229-262 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:236-269 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:236-269 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 1116 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 `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:228` 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 (34 lines × 2) · ×1
  • Duplicated block (34 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:429 — backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:429-462 | backends-velox/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:437-470 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 337 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.
D4 · Code Duplication · Duplicated block (4–34 lines × 3) · ×1
  • Duplicated block (4–34 lines × 3) backends-bolt/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala:163 — backends-bolt/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala:163-196 | backends-clickhouse/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala:41-44 | backends-velox/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala:167-200 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala` and `backends-velox/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 295 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 `backends-clickhouse/src/main/scala/org/apache/gluten/metrics/MetricsUtil.scala:41` 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 (29–34 lines × 2) · ×1
  • Duplicated block (29–34 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/utils/ParquetMetadataUtils.scala:120 — backends-bolt/src/main/scala/org/apache/gluten/utils/ParquetMetadataUtils.scala:120-148 | backends-velox/src/main/scala/org/apache/gluten/utils/ParquetMetadataUtils.scala:170-203 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/utils/ParquetMetadataUtils.scala` and `backends-velox/src/main/scala/org/apache/gluten/utils/ParquetMetadataUtils.scala` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 117 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.
D4 · Code Duplication · Duplicated block (33 lines × 3) · ×1
  • Duplicated block (33 lines × 3) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:370 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:370-402 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:370-402 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:373-405 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 1116 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 `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:370` 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 (32 lines × 5) · ×1
  • Duplicated block (32 lines × 5) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:705 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:705-736 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:705-736 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:713-744 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:720-751 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:720-751 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 1116 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 `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:705` 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 (32 lines × 3) · ×1
  • Duplicated block (32 lines × 3) backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarCollectLimitExec.scala:41 — backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarCollectLimitExec.scala:41-72 | backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHColumnarCollectLimitExec.scala:37-68 | backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarCollectLimitExec.scala:42-73 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarCollectLimitExec.scala` and `backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHColumnarCollectLimitExec.scala` as WHOLE FILES: 87% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 `backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarCollectLimitExec.scala:41` 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, `backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHColumnarCollectLimitExec.scala:69` calls `close` and `backends-bolt/src/main/scala/org/apache/gluten/execution/ColumnarCollectLimitExec.scala:73` 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 (29–32 lines × 2) · ×1
  • Duplicated block (29–32 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:221 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:221-249 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:366-397 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 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 `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:221` 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 × 5) · ×1
  • Duplicated block (31 lines × 5) shims/spark34/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:201 — shims/spark34/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:201-231 | shims/spark35/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:194-224 | shims/spark40/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:192-222 | shims/spark41/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:192-222 | shims/spark42/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:192-222 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala` and `shims/spark35/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 151 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 `shims/spark34/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala: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.
D4 · Code Duplication · Duplicated block (30 lines × 5) · ×1
  • Duplicated block (30 lines × 5) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1450 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1450-1479 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1452-1481 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1469-1498 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1473-1502 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1473-1502 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 1116 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.
D4 · Code Duplication · Duplicated block (28 lines × 3) · ×1
  • Duplicated block (28 lines × 3) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:880 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:880-907 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:880-907 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:889-916 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 1116 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 `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:880` 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 (25–28 lines × 2) · ×1
  • Duplicated block (25–28 lines × 2) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala:111 — backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala:111-138 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala:293-317 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala` and `backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 96 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 `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala:111` 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–27 lines × 3) · ×1
  • Duplicated block (26–27 lines × 3) backends-clickhouse/src/main/scala/org/apache/gluten/metrics/BroadcastNestedLoopJoinMetricsUpdater.scala:75 — backends-clickhouse/src/main/scala/org/apache/gluten/metrics/BroadcastNestedLoopJoinMetricsUpdater.scala:75-101 | backends-clickhouse/src/main/scala/org/apache/gluten/metrics/HashJoinMetricsUpdater.scala:86-111 | backends-clickhouse/src/main/scala/org/apache/gluten/metrics/SortMergeJoinMetricsUpdater.scala:87-112 — before extracting anything, compare `backends-clickhouse/src/main/scala/org/apache/gluten/metrics/BroadcastNestedLoopJoinMetricsUpdater.scala` and `backends-clickhouse/src/main/scala/org/apache/gluten/metrics/HashJoinMetricsUpdater.scala` as WHOLE FILES: this scan already matched 3 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 `backends-clickhouse/src/main/scala/org/apache/gluten/metrics/BroadcastNestedLoopJoinMetricsUpdater.scala:75` 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 (25–27 lines × 2) · ×1
  • Duplicated block (25–27 lines × 2) backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:449 — backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:449-473 | backends-velox/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:565-591 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala` and `backends-velox/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 286 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.
D4 · Code Duplication · Duplicated block (26–27 lines × 2) · ×1
  • Duplicated block (26–27 lines × 2) backends-clickhouse/src/main/scala/org/apache/gluten/metrics/FilterMetricsUpdater.scala:31 — backends-clickhouse/src/main/scala/org/apache/gluten/metrics/FilterMetricsUpdater.scala:31-56 | backends-clickhouse/src/main/scala/org/apache/gluten/metrics/ProjectMetricsUpdater.scala:30-56 — before extracting anything, compare `backends-clickhouse/src/main/scala/org/apache/gluten/metrics/FilterMetricsUpdater.scala` and `backends-clickhouse/src/main/scala/org/apache/gluten/metrics/ProjectMetricsUpdater.scala` as WHOLE FILES: 85% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 `backends-clickhouse/src/main/scala/org/apache/gluten/metrics/FilterMetricsUpdater.scala:31` 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 (25–26 lines × 5) · ×1
  • Duplicated block (25–26 lines × 5) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:635 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:635-659 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:635-659 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:642-667 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:649-674 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:649-674 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 1116 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 `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:635` 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 (26 lines × 3) · ×1
  • Duplicated block (26 lines × 3) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:1301 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:1301-1326 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHSparkPlanExecApi.scala:850-875 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala:1738-1763 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 498 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:1301` 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 (25 lines × 5) · ×1
  • Duplicated block (25 lines × 5) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1374 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1374-1398 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1376-1400 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1392-1416 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1396-1420 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1396-1420 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 1116 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.
D4 · Code Duplication · Duplicated block (25 lines × 3) · ×1
  • Duplicated block (25 lines × 3) backends-clickhouse/src/main/scala/org/apache/gluten/metrics/BroadcastNestedLoopJoinMetricsUpdater.scala:36 — backends-clickhouse/src/main/scala/org/apache/gluten/metrics/BroadcastNestedLoopJoinMetricsUpdater.scala:36-60 | backends-clickhouse/src/main/scala/org/apache/gluten/metrics/HashJoinMetricsUpdater.scala:53-77 | backends-clickhouse/src/main/scala/org/apache/gluten/metrics/SortMergeJoinMetricsUpdater.scala:54-78 — before extracting anything, compare `backends-clickhouse/src/main/scala/org/apache/gluten/metrics/BroadcastNestedLoopJoinMetricsUpdater.scala` and `backends-clickhouse/src/main/scala/org/apache/gluten/metrics/HashJoinMetricsUpdater.scala` as WHOLE FILES: this scan already matched 3 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 `backends-clickhouse/src/main/scala/org/apache/gluten/metrics/BroadcastNestedLoopJoinMetricsUpdater.scala:36` 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, `backends-clickhouse/src/main/scala/org/apache/gluten/metrics/BroadcastNestedLoopJoinMetricsUpdater.scala:61` calls `metrics` and `backends-clickhouse/src/main/scala/org/apache/gluten/metrics/HashJoinMetricsUpdater.scala:78` 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 (22–25 lines × 2) · ×1
  • Duplicated block (22–25 lines × 2) backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:162 — backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:162-183 | backends-velox/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:256-280 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala` and `backends-velox/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 286 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 `backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:162` 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 × 5) · ×1
  • Duplicated block (24 lines × 5) shims/spark34/src/main/scala/org/apache/spark/sql/execution/ExpandOutputPartitioningShim.scala:69 — shims/spark34/src/main/scala/org/apache/spark/sql/execution/ExpandOutputPartitioningShim.scala:69-92 | shims/spark35/src/main/scala/org/apache/spark/sql/execution/ExpandOutputPartitioningShim.scala:69-92 | shims/spark40/src/main/scala/org/apache/spark/sql/execution/ExpandOutputPartitioningShim.scala:69-92 | shims/spark41/src/main/scala/org/apache/spark/sql/execution/ExpandOutputPartitioningShim.scala:69-92 | shims/spark42/src/main/scala/org/apache/spark/sql/execution/ExpandOutputPartitioningShim.scala:69-92 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/sql/execution/ExpandOutputPartitioningShim.scala` and `shims/spark35/src/main/scala/org/apache/spark/sql/execution/ExpandOutputPartitioningShim.scala` 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. 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–24 lines × 2) · ×1
  • Duplicated block (20–24 lines × 2) backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:287 — backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:287-306 | backends-velox/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:390-413 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala` and `backends-velox/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 286 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 `backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:287` 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 (22–23 lines × 5) · ×1
  • Duplicated block (22–23 lines × 5) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1041 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1041-1062 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1041-1062 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1053-1075 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1057-1079 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1057-1079 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 1116 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 `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:1041` 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 (20–23 lines × 2) · ×1
  • Duplicated block (20–23 lines × 2) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:659 — backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:659-681 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:657-676 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala` and `backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 536 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.
D4 · Code Duplication · Duplicated block (20–22 lines × 3) · ×1
  • Duplicated block (20–22 lines × 3) backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/execution/datasources/v1/clickhouse/MergeTreeFileFormatDataWriter.scala:272 — backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/execution/datasources/v1/clickhouse/MergeTreeFileFormatDataWriter.scala:272-293 | backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:568-589 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:568-587 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala` and `backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 536 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.
D4 · Code Duplication · Duplicated block (21–22 lines × 3) · ×1
  • Duplicated block (21–22 lines × 3) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:788 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:788-809 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:788-809 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:796-816 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 1116 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 `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:788` 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 (21 lines × 4) · ×1
  • Duplicated block (21 lines × 4) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:136 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:136-156 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:186-206 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:163-183 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:221-241 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala` as WHOLE FILES: this scan already matched 35 separate duplicated blocks between them, totalling at least 485 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala: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.
D4 · Code Duplication · Duplicated block (20–21 lines × 3) · ×1
  • Duplicated block (20–21 lines × 3) backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/ClickhouseOptimisticTransaction.scala:340 — backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/ClickhouseOptimisticTransaction.scala:340-359 | backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala:203-223 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala:226-245 — before extracting anything, compare `backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/ClickhouseOptimisticTransaction.scala` and `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 90 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 (20–21 lines × 2) · ×1
  • Duplicated block (20–21 lines × 2) backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/ClickhouseOptimisticTransaction.scala:284 — backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/ClickhouseOptimisticTransaction.scala:284-303 | backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala:145-165 — before extracting anything, compare `backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/ClickhouseOptimisticTransaction.scala` and `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 90 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 `backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/ClickhouseOptimisticTransaction.scala:284` 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 (20 lines × 4) · ×1
  • Duplicated block (20 lines × 4) backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHAggregateGroupLimitExecTransformer.scala:89 — backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHAggregateGroupLimitExecTransformer.scala:89-108 | backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHWindowGroupLimitExecTransformer.scala:99-118 | gluten-substrait/src/main/scala/org/apache/gluten/execution/WindowExecTransformer.scala:93-112 | gluten-substrait/src/main/scala/org/apache/gluten/execution/WindowGroupLimitExecTransformer.scala:97-116 — before extracting anything, compare `backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHAggregateGroupLimitExecTransformer.scala` and `backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHWindowGroupLimitExecTransformer.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 114 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 `backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHAggregateGroupLimitExecTransformer.scala:89` 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 (17–20 lines × 2) · ×1
  • Duplicated block (17–20 lines × 2) shims/spark34/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:265 — shims/spark34/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:265-284 | shims/spark35/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:256-272 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala` and `shims/spark35/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 151 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 `shims/spark34/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:265` 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 (19 lines × 5) · ×1
  • Duplicated block (19 lines × 5) shims/spark34/src/main/scala/org/apache/spark/ShuffleUtils.scala:29 — shims/spark34/src/main/scala/org/apache/spark/ShuffleUtils.scala:29-47 | shims/spark35/src/main/scala/org/apache/spark/ShuffleUtils.scala:29-47 | shims/spark40/src/main/scala/org/apache/spark/ShuffleUtils.scala:29-47 | shims/spark41/src/main/scala/org/apache/spark/ShuffleUtils.scala:29-47 | shims/spark42/src/main/scala/org/apache/spark/ShuffleUtils.scala:29-47 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/ShuffleUtils.scala` and `shims/spark35/src/main/scala/org/apache/spark/ShuffleUtils.scala` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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.
D4 · Code Duplication · Duplicated block (19 lines × 4) · ×1
  • Duplicated block (19 lines × 4) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:149 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:149-167 | backends-bolt/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala:279-297 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:379-397 | backends-velox/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala:444-462 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala` and `backends-bolt/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 100 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 `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:149` 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–19 lines × 3) · ×1
  • Duplicated block (18–19 lines × 3) backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/execution/datasources/v1/clickhouse/MergeTreeFileFormatWriter.scala:334 — backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/execution/datasources/v1/clickhouse/MergeTreeFileFormatWriter.scala:334-351 | backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:464-482 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:467-485 — before extracting anything, compare `backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/execution/datasources/v1/clickhouse/MergeTreeFileFormatWriter.scala` and `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 55 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 `backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/execution/datasources/v1/clickhouse/MergeTreeFileFormatWriter.scala:334` 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–18 lines × 10) · ×1
  • Duplicated block (8–18 lines × 10) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:280 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:280-287 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:625-640 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:659-674 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:731-748 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:755-772 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:317-324 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:649-664 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:683-698 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:776-793 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:800-817 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala` as WHOLE FILES: this scan already matched 35 separate duplicated blocks between them, totalling at least 485 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:288` calls `createSizeMetric`, `createMetric` and `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:749` 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 (18 lines × 10) · ×1
  • Duplicated block (18 lines × 10) backends-clickhouse/src/main/scala/org/apache/gluten/utils/CHPartitionsUtil.scala:131 — backends-clickhouse/src/main/scala/org/apache/gluten/utils/CHPartitionsUtil.scala:131-148 | gluten-substrait/src/main/scala/org/apache/gluten/utils/PartitionsUtil.scala:126-143 | shims/spark34/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:212-229 | shims/spark35/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:205-222 | shims/spark40/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:203-220 | shims/spark40/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:178-195 | shims/spark41/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:203-220 | shims/spark41/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:177-194 | shims/spark42/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:203-220 | shims/spark42/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:177-194 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 10 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 10 times. Read the line range as the matched WINDOW rather than a finished unit: at `backends-clickhouse/src/main/scala/org/apache/gluten/utils/CHPartitionsUtil.scala:131` 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 lines × 5) · ×1
  • Duplicated block (18 lines × 5) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:395 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:395-412 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:395-412 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:398-415 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:405-422 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:405-422 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 1116 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 `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:395` 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–18 lines × 3) · ×1
  • Duplicated block (14–18 lines × 3) backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:374 — backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:374-391 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:419-436 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:447-460 — 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 `backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:374` 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 (13–18 lines × 2) · ×1
  • Duplicated block (13–18 lines × 2) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:176 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:176-188 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:313-330 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 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 (17–18 lines × 2) · ×1
  • Duplicated block (17–18 lines × 2) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala:51 — backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala:51-68 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala:71-87 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala` and `backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 96 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 (16–18 lines × 2) · ×1
  • Duplicated block (16–18 lines × 2) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:349 — backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:349-366 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:355-370 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala` and `backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 536 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 `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala: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.
D4 · Code Duplication · Duplicated block (9–17 lines × 13) · ×1
  • Duplicated block (9–17 lines × 13) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:102 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:102-110 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:151-159 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:201-209 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:289-297 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:642-658 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:676-692 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:151-159 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:121-129 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:178-186 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:236-244 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:326-334 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:666-682 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:700-716 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala` and `backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 127 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:642` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:160` calls `createMetric` and `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:111` 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 (9–17 lines × 10) · ×1
  • Duplicated block (9–17 lines × 10) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:101 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:101-109 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:286-294 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:639-655 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:673-689 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:741-757 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:120-128 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:323-331 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:663-679 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:697-713 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:786-802 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala` as WHOLE FILES: this scan already matched 35 separate duplicated blocks between them, totalling at least 485 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:286` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:285` calls `createMetric` and `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:101` 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 (7–17 lines × 10) · ×1
  • Duplicated block (7–17 lines × 10) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:285 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:285-293 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:451-457 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:531-537 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:636-652 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:670-686 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:322-330 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:465-471 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:545-551 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:660-676 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:694-710 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala` as WHOLE FILES: this scan already matched 35 separate duplicated blocks between them, totalling at least 485 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:636` 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 (16–17 lines × 8) · ×1
  • Duplicated block (16–17 lines × 8) shims/spark34/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:194 — shims/spark34/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:194-210 | shims/spark35/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:187-203 | shims/spark40/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:186-201 | shims/spark40/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:161-176 | shims/spark41/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:186-201 | shims/spark41/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:160-175 | shims/spark42/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:186-201 | shims/spark42/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:160-175 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala` and `shims/spark35/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 151 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 `shims/spark34/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:194` 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–17 lines × 6) · ×1
  • Duplicated block (9–17 lines × 6) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:99 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:99-107 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:735-751 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:759-775 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:118-126 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:780-796 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:804-820 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala` as WHOLE FILES: this scan already matched 35 separate duplicated blocks between them, totalling at least 485 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:735` 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, `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:776` calls `createNanoTimingMetric` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:127` 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 (15–17 lines × 6) · ×1
  • Duplicated block (15–17 lines × 6) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:296 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:296-310 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:572-588 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:691-707 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:342-356 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:586-602 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:727-743 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala` as WHOLE FILES: this scan already matched 35 separate duplicated blocks between them, totalling at least 485 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:296` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:310` calls `createMetric` and `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:588` 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–17 lines × 5) · ×1
  • Duplicated block (9–17 lines × 5) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:100 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:100-108 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:392-401 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:738-754 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:119-127 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:783-799 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala` as WHOLE FILES: this scan already matched 35 separate duplicated blocks between them, totalling at least 485 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:738` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:130` calls `createNanoTimingMetric` and `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:111` 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 (14–17 lines × 2) · ×1
  • Duplicated block (14–17 lines × 2) backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/ClickhouseOptimisticTransaction.scala:272 — backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/ClickhouseOptimisticTransaction.scala:272-288 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala:120-133 — 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 `backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/ClickhouseOptimisticTransaction.scala:272` 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 (14–16 lines × 10) · ×1
  • Duplicated block (14–16 lines × 10) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:620 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:620-633 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:654-667 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:726-741 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:750-765 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:333-348 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:644-657 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:678-691 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:718-733 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:771-786 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:795-810 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala` as WHOLE FILES: this scan already matched 35 separate duplicated blocks between them, totalling at least 485 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:620` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:634` calls `createNanoTimingMetric`, `createSizeMetric` and `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:741` 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 (10–16 lines × 7) · ×1
  • Duplicated block (10–16 lines × 7) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:648 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:648-663 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:744-759 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:152-161 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:331-342 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:672-687 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:712-727 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:789-804 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala` and `backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 127 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:648` 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, `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:330` calls `createMetric` and `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:648` 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 (15–16 lines × 2) · ×1
  • Duplicated block (15–16 lines × 2) backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:281 — backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:281-296 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:278-292 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala` and `backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 385 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.
D4 · Code Duplication · Duplicated block (13–16 lines × 2) · ×1
  • Duplicated block (13–16 lines × 2) tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/table/AutoTableCreator.scala:70 — tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/table/AutoTableCreator.scala:70-82 | REDACTED:90-105 — 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 `tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/table/AutoTableCreator.scala:70` 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 (13–15 lines × 4) · ×1
  • Duplicated block (13–15 lines × 4) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:570 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:570-582 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:765-779 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:584-596 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:810-824 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala` as WHOLE FILES: this scan already matched 35 separate duplicated blocks between them, totalling at least 485 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:765` 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 (15 lines × 3) · ×1
  • Duplicated block (15 lines × 3) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:1201 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:1201-1215 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHSparkPlanExecApi.scala:763-777 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala:1638-1652 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 498 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (14 lines × 5) · ×1
  • Duplicated block (14 lines × 5) shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:766 — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:766-779 | shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:766-779 | shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:774-787 | shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:781-794 | shims/spark42/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:781-794 — before extracting anything, compare `shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` and `shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 1116 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.
D4 · Code Duplication · Duplicated block (13–14 lines × 4) · ×1
  • Duplicated block (13–14 lines × 4) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:703 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:703-716 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:771-784 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:739-751 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:816-829 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala` as WHOLE FILES: this scan already matched 35 separate duplicated blocks between them, totalling at least 485 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:703` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:702` calls `createNanoTimingMetric` and `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:770` 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 (12–14 lines × 3) · ×1
  • Duplicated block (12–14 lines × 3) gluten-delta/src/main/scala/org/apache/gluten/execution/DeltaScanTransformer.scala:249 — gluten-delta/src/main/scala/org/apache/gluten/execution/DeltaScanTransformer.scala:249-260 | gluten-hudi/src/main/scala/org/apache/gluten/execution/HudiScanTransformer.scala:64-76 | gluten-substrait/src/main/scala/org/apache/gluten/execution/FileSourceScanExecTransformer.scala:77-90 — 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. 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–14 lines × 2) · ×1
  • Duplicated block (12–14 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/metrics/InputIteratorMetricsUpdater.scala:26 — backends-bolt/src/main/scala/org/apache/gluten/metrics/InputIteratorMetricsUpdater.scala:26-37 | backends-velox/src/main/scala/org/apache/gluten/metrics/InputIteratorMetricsUpdater.scala:24-37 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/metrics/InputIteratorMetricsUpdater.scala` and `backends-velox/src/main/scala/org/apache/gluten/metrics/InputIteratorMetricsUpdater.scala` as WHOLE FILES: 91% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 `backends-bolt/src/main/scala/org/apache/gluten/metrics/InputIteratorMetricsUpdater.scala:26` 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–14 lines × 2) · ×1
  • Duplicated block (13–14 lines × 2) backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:218 — backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:218-230 | backends-velox/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:320-333 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala` and `backends-velox/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 286 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.
D4 · Code Duplication · Duplicated block (13 lines × 6) · ×1
  • Duplicated block (13 lines × 6) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:111 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:111-123 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:161-173 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:211-223 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:131-143 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:189-201 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:247-259 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala` as WHOLE FILES: this scan already matched 35 separate duplicated blocks between them, totalling at least 485 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 (13 lines × 4) · ×1
  • Duplicated block (13 lines × 4) shims/spark35/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:248 — shims/spark35/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:248-260 | shims/spark40/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:246-258 | shims/spark41/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:246-258 | shims/spark42/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:246-258 — before extracting anything, compare `shims/spark35/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala` and `shims/spark40/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 169 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 `shims/spark35/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:248` 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 (11–13 lines × 3) · ×1
  • Duplicated block (11–13 lines × 3) backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/execution/datasources/v1/clickhouse/MergeTreeFileFormatWriter.scala:79 — backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/execution/datasources/v1/clickhouse/MergeTreeFileFormatWriter.scala:79-89 | backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:104-116 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala:115-127 — before extracting anything, compare `backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/execution/datasources/v1/clickhouse/MergeTreeFileFormatWriter.scala` and `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 55 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 (13 lines × 3) · ×1
  • Duplicated block (13 lines × 3) shims/spark40/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:92 — shims/spark40/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:92-104 | shims/spark41/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:91-103 | shims/spark42/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:91-103 — before extracting anything, compare `shims/spark40/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala` and `shims/spark41/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 173 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.
D4 · Code Duplication · Duplicated block (9–12 lines × 3) · ×1
  • Duplicated block (9–12 lines × 3) backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/ClickhouseOptimisticTransaction.scala:282 — backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/ClickhouseOptimisticTransaction.scala:282-293 | backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala:143-154 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala:127-135 — before extracting anything, compare `backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/ClickhouseOptimisticTransaction.scala` and `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 90 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 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–12 lines × 2) · ×1
  • Duplicated block (10–12 lines × 2) gluten-substrait/src/main/scala/org/apache/gluten/execution/BroadcastNestedLoopJoinExecTransformer.scala:118 — gluten-substrait/src/main/scala/org/apache/gluten/execution/BroadcastNestedLoopJoinExecTransformer.scala:118-127 | gluten-substrait/src/main/scala/org/apache/gluten/execution/JoinExecTransformer.scala:231-242 — 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 (7–11 lines × 8) · ×1
  • Duplicated block (7–11 lines × 8) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:106 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:106-116 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:158-166 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:208-216 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:375-381 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:125-133 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:185-191 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:243-249 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:420-426 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala` as WHOLE FILES: this scan already matched 35 separate duplicated blocks between them, totalling at least 485 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:106` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:157` calls `createMetric` and `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:106` 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 (11 lines × 6) · ×1
  • Duplicated block (11 lines × 6) shims/spark40/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:254 — shims/spark40/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:254-264 | shims/spark40/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:216-226 | shims/spark41/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:254-264 | shims/spark41/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:215-225 | shims/spark42/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:254-264 | shims/spark42/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:215-225 — before extracting anything, compare `shims/spark40/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala` and `shims/spark40/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 65 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 `shims/spark40/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:254` 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–11 lines × 3) · ×1
  • Duplicated block (10–11 lines × 3) backends-bolt/src-celeborn/main/scala/org/apache/spark/shuffle/BoltCelebornColumnarBatchSerializer.scala:189 — backends-bolt/src-celeborn/main/scala/org/apache/spark/shuffle/BoltCelebornColumnarBatchSerializer.scala:189-199 | backends-clickhouse/src-celeborn/main/scala/org/apache/spark/shuffle/CHCelebornColumnarBatchSerializer.scala:94-103 | backends-velox/src-celeborn/main/scala/org/apache/spark/shuffle/VeloxCelebornColumnarBatchSerializer.scala:152-162 — before extracting anything, compare `backends-bolt/src-celeborn/main/scala/org/apache/spark/shuffle/BoltCelebornColumnarBatchSerializer.scala` and `backends-velox/src-celeborn/main/scala/org/apache/spark/shuffle/VeloxCelebornColumnarBatchSerializer.scala` as WHOLE FILES: this scan already matched 4 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 `backends-bolt/src-celeborn/main/scala/org/apache/spark/shuffle/BoltCelebornColumnarBatchSerializer.scala: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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `backends-clickhouse/src-celeborn/main/scala/org/apache/spark/shuffle/CHCelebornColumnarBatchSerializer.scala:105` calls `closeReader` and `backends-bolt/src-celeborn/main/scala/org/apache/spark/shuffle/BoltCelebornColumnarBatchSerializer.scala:200` 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 (10 lines × 12) · ×1
  • Duplicated block (10 lines × 12) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:239 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:239-248 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:260-269 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:328-337 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:347-356 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:485-494 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:795-804 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:276-285 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:297-306 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:374-383 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:393-402 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:499-508 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:840-849 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala` as WHOLE FILES: this scan already matched 35 separate duplicated blocks between them, totalling at least 485 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:239` 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 (10 lines × 8) · ×1
  • Duplicated block (10 lines × 8) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:99 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:99-108 | backends-bolt/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala:233-242 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:133-142 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:186-195 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:281-290 | backends-velox/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala:145-154 | backends-velox/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala:241-250 | backends-velox/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala:396-405 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala` and `backends-bolt/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 100 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 `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala:99` 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 (8–10 lines × 8) · ×1
  • Duplicated block (8–10 lines × 8) backends-clickhouse/src/main/scala/org/apache/gluten/utils/CHPartitionsUtil.scala:58 — backends-clickhouse/src/main/scala/org/apache/gluten/utils/CHPartitionsUtil.scala:58-67 | shims/spark35/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:255-264 | shims/spark40/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:253-260 | shims/spark40/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:215-222 | shims/spark41/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:253-260 | shims/spark41/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:214-221 | shims/spark42/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:253-260 | shims/spark42/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:214-221 — before extracting anything, compare `backends-clickhouse/src/main/scala/org/apache/gluten/utils/CHPartitionsUtil.scala` and `shims/spark35/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 48 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. 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, `shims/spark35/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:250` calls `logInfo` and `backends-clickhouse/src/main/scala/org/apache/gluten/utils/CHPartitionsUtil.scala:55` 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 (8–10 lines × 7) · ×1
  • Duplicated block (8–10 lines × 7) backends-bolt/src/main/scala/org/apache/gluten/execution/TopNTransformer.scala:101 — backends-bolt/src/main/scala/org/apache/gluten/execution/TopNTransformer.scala:101-110 | backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHAggregateGroupLimitExecTransformer.scala:99-106 | backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHWindowGroupLimitExecTransformer.scala:109-116 | backends-velox/src/main/scala/org/apache/gluten/execution/TopNTransformer.scala:101-110 | gluten-substrait/src/main/scala/org/apache/gluten/execution/SortExecTransformer.scala:71-80 | gluten-substrait/src/main/scala/org/apache/gluten/execution/WindowExecTransformer.scala:103-110 | gluten-substrait/src/main/scala/org/apache/gluten/execution/WindowGroupLimitExecTransformer.scala:107-114 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/execution/TopNTransformer.scala` and `backends-velox/src/main/scala/org/apache/gluten/execution/TopNTransformer.scala` 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. 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 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 lines × 7) · ×1
  • Duplicated block (10 lines × 7) backends-clickhouse/src/main/scala/org/apache/gluten/metrics/CHRangeMetricsUpdater.scala:27 — backends-clickhouse/src/main/scala/org/apache/gluten/metrics/CHRangeMetricsUpdater.scala:27-36 | backends-clickhouse/src/main/scala/org/apache/gluten/metrics/ExpandMetricsUpdater.scala:28-37 | backends-clickhouse/src/main/scala/org/apache/gluten/metrics/FilterMetricsUpdater.scala:55-64 | backends-clickhouse/src/main/scala/org/apache/gluten/metrics/GenerateMetricsUpdater.scala:28-37 | backends-clickhouse/src/main/scala/org/apache/gluten/metrics/ProjectMetricsUpdater.scala:55-64 | backends-clickhouse/src/main/scala/org/apache/gluten/metrics/SortMetricsUpdater.scala:28-37 | backends-clickhouse/src/main/scala/org/apache/gluten/metrics/WindowMetricsUpdater.scala:28-37 — before extracting anything, compare `backends-clickhouse/src/main/scala/org/apache/gluten/metrics/CHRangeMetricsUpdater.scala` and `backends-clickhouse/src/main/scala/org/apache/gluten/metrics/ExpandMetricsUpdater.scala` as WHOLE FILES: 85% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 `backends-clickhouse/src/main/scala/org/apache/gluten/metrics/CHRangeMetricsUpdater.scala:27` 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–10 lines × 3) · ×1
  • Duplicated block (8–10 lines × 3) backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:504 — backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:504-513 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:687-694 | backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:715-722 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` and `backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 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 `backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:504` 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 lines × 16) · ×1
  • Duplicated block (9 lines × 16) backends-bolt/src/main/scala/org/apache/gluten/metrics/ExpandMetricsUpdater.scala:24 — backends-bolt/src/main/scala/org/apache/gluten/metrics/ExpandMetricsUpdater.scala:24-32 | backends-bolt/src/main/scala/org/apache/gluten/metrics/FilterMetricsUpdater.scala:27-35 | backends-bolt/src/main/scala/org/apache/gluten/metrics/LimitMetricsUpdater.scala:24-32 | backends-bolt/src/main/scala/org/apache/gluten/metrics/ProjectMetricsUpdater.scala:27-35 | backends-bolt/src/main/scala/org/apache/gluten/metrics/SampleMetricsUpdater.scala:24-32 | backends-bolt/src/main/scala/org/apache/gluten/metrics/SortMetricsUpdater.scala:26-34 | backends-bolt/src/main/scala/org/apache/gluten/metrics/TopNMetricsUpdater.scala:26-34 | backends-bolt/src/main/scala/org/apache/gluten/metrics/WindowMetricsUpdater.scala:24-32 | backends-velox/src/main/scala/org/apache/gluten/metrics/ExpandMetricsUpdater.scala:24-32 | backends-velox/src/main/scala/org/apache/gluten/metrics/FilterMetricsUpdater.scala:27-35 | backends-velox/src/main/scala/org/apache/gluten/metrics/LimitMetricsUpdater.scala:24-32 | backends-velox/src/main/scala/org/apache/gluten/metrics/ProjectMetricsUpdater.scala:27-35 | backends-velox/src/main/scala/org/apache/gluten/metrics/SampleMetricsUpdater.scala:24-32 | backends-velox/src/main/scala/org/apache/gluten/metrics/SortMetricsUpdater.scala:26-34 | backends-velox/src/main/scala/org/apache/gluten/metrics/TopNMetricsUpdater.scala:26-34 | backends-velox/src/main/scala/org/apache/gluten/metrics/WindowMetricsUpdater.scala:24-32 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/metrics/ExpandMetricsUpdater.scala` and `backends-bolt/src/main/scala/org/apache/gluten/metrics/FilterMetricsUpdater.scala` as WHOLE FILES: 96% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 `backends-bolt/src/main/scala/org/apache/gluten/metrics/ExpandMetricsUpdater.scala:24` 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, `backends-bolt/src/main/scala/org/apache/gluten/metrics/ExpandMetricsUpdater.scala:33` calls `metrics` and `backends-bolt/src/main/scala/org/apache/gluten/metrics/TopNMetricsUpdater.scala:35` 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 (7–9 lines × 6) · ×1
  • Duplicated block (7–9 lines × 6) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:145 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:145-153 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:195-203 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:115-121 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:143-149 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:172-180 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:230-238 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala` and `backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 127 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 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, `backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:112` calls `createTimingMetric` and `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:144` 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 (7–8 lines × 20) · ×1
  • Duplicated block (7–8 lines × 20) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:237 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:237-243 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:258-264 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:326-332 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:345-351 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:446-452 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:483-489 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:526-532 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:549-556 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:566-572 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:793-799 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:274-280 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:295-301 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:372-378 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:391-397 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:460-466 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:497-503 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:540-546 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:563-570 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:580-586 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:838-844 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala` as WHOLE FILES: this scan already matched 35 separate duplicated blocks between them, totalling at least 485 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 `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:237` 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 × 15) · ×1
  • Duplicated block (8 lines × 15) backends-bolt/src/main/scala/org/apache/gluten/spi/SharedLibraryLoaderCentos7.scala:43 — backends-bolt/src/main/scala/org/apache/gluten/spi/SharedLibraryLoaderCentos7.scala:43-50 | backends-bolt/src/main/scala/org/apache/gluten/spi/SharedLibraryLoaderCentos8.scala:47-54 | backends-bolt/src/main/scala/org/apache/gluten/spi/SharedLibraryLoaderCentos9.scala:41-48 | backends-bolt/src/main/scala/org/apache/gluten/spi/SharedLibraryLoaderDebian11.scala:45-52 | backends-bolt/src/main/scala/org/apache/gluten/spi/SharedLibraryLoaderDebian12.scala:51-58 | backends-bolt/src/main/scala/org/apache/gluten/spi/SharedLibraryLoaderOpenEuler2403.scala:41-48 | backends-bolt/src/main/scala/org/apache/gluten/spi/SharedLibraryLoaderUbuntu2004.scala:61-68 | backends-bolt/src/main/scala/org/apache/gluten/spi/SharedLibraryLoaderUbuntu2204.scala:45-52 | backends-velox/src/main/scala/org/apache/gluten/spi/SharedLibraryLoaderCentos8.scala:46-53 | backends-velox/src/main/scala/org/apache/gluten/spi/SharedLibraryLoaderCentos9.scala:40-47 | backends-velox/src/main/scala/org/apache/gluten/spi/SharedLibraryLoaderDebian11.scala:44-51 | backends-velox/src/main/scala/org/apache/gluten/spi/SharedLibraryLoaderDebian12.scala:50-57 | backends-velox/src/main/scala/org/apache/gluten/spi/SharedLibraryLoaderOpenEuler2403.scala:40-47 | backends-velox/src/main/scala/org/apache/gluten/spi/SharedLibraryLoaderUbuntu2004.scala:60-67 | backends-velox/src/main/scala/org/apache/gluten/spi/SharedLibraryLoaderUbuntu2204.scala:44-51 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/spi/SharedLibraryLoaderCentos8.scala` and `backends-velox/src/main/scala/org/apache/gluten/spi/SharedLibraryLoaderCentos8.scala` as WHOLE FILES: 89% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 `backends-bolt/src/main/scala/org/apache/gluten/spi/SharedLibraryLoaderCentos7.scala:43` 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 (8 lines × 4) · ×1
  • Duplicated block (8 lines × 4) backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHAggregateGroupLimitExecTransformer.scala:131 — backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHAggregateGroupLimitExecTransformer.scala:131-140 | backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHWindowGroupLimitExecTransformer.scala:140-149 | gluten-delta/src-delta33/main/scala/org/apache/gluten/execution/DeltaFilterExecTransformer.scala:66-73 | gluten-delta/src-delta4/main/scala/org/apache/gluten/execution/DeltaFilterExecTransformer.scala:66-73 — before extracting anything, compare `backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHAggregateGroupLimitExecTransformer.scala` and `backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHWindowGroupLimitExecTransformer.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 114 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 `backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHAggregateGroupLimitExecTransformer.scala:131` 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 (7–8 lines × 2) · ×1
  • Duplicated block (7–8 lines × 2) backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/commands/VacuumCommand.scala:383 — backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/commands/VacuumCommand.scala:383-389 | backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/commands/VacuumCommand.scala:417-424 — both copies are in the same file, so extract the 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 `backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/commands/VacuumCommand.scala: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.
D4 · Code Duplication · Duplicated block (7 lines × 9) · ×1
  • Duplicated block (7 lines × 9) backends-clickhouse/src/main/scala/org/apache/gluten/utils/CHPartitionsUtil.scala:59 — backends-clickhouse/src/main/scala/org/apache/gluten/utils/CHPartitionsUtil.scala:59-67 | shims/spark34/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:265-273 | shims/spark35/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:256-264 | shims/spark40/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:254-260 | shims/spark40/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:216-222 | shims/spark41/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:254-260 | shims/spark41/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:215-221 | shims/spark42/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala:254-260 | shims/spark42/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:215-221 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 9 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 9 times. 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 (6 lines × 10) · ×1
  • Duplicated block (6 lines × 10) backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:189 — backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:189-194 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:207-212 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:226-231 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:247-252 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:296-301 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:326-331 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:342-347 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:371-376 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:416-421 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:444-449 — all 10 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:233` calls `createMetric` and `backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:423` 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 (5 lines × 24) · ×1
  • Duplicated block (5 lines × 24) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:95 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:95-99 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:236-240 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:257-261 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:325-329 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:344-348 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:445-449 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:482-486 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:525-529 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:548-552 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:565-569 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:792-796 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:810-814 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:114-118 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:273-277 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:294-298 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:371-375 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:390-394 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:459-463 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:496-500 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:539-543 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:562-566 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:579-583 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:837-841 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:855-859 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala` as WHOLE FILES: this scan already matched 35 separate duplicated blocks between them, totalling at least 485 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:100` calls `createNanoTimingMetric` and `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:241` 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 (5 lines × 13) · ×1
  • Duplicated block (5 lines × 13) backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:90 — backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:90-94 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:110-114 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:138-142 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:191-195 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:209-213 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:228-232 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:249-253 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:298-302 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:328-332 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:344-348 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:373-377 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:418-422 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:446-450 — all 13 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:89` calls `createMetric` and `backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:190` 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 (5 lines × 12) · ×1
  • Duplicated block (5 lines × 12) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:279 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:279-283 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:622-634 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:656-668 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:728-742 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:752-766 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:316-320 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:335-349 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:646-658 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:680-692 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:720-734 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:773-787 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:797-811 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala` as WHOLE FILES: this scan already matched 35 separate duplicated blocks between them, totalling at least 485 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 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, `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:634` calls `createNanoTimingMetric`, `createSizeMetric` and `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:349` 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 (5 lines × 11) · ×1
  • Duplicated block (5 lines × 11) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:619 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:619-633 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:653-667 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:725-739 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:749-763 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:369-373 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:332-346 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:643-657 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:677-691 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:717-731 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:770-784 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:794-808 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala` and `backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 127 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 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, `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:330` calls `createMetric` and `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:652` 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 (5 lines × 8) · ×1
  • Duplicated block (5 lines × 8) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:650 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:650-664 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:746-760 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:152-162 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:368-372 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:331-343 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:674-688 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:714-728 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:791-805 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala` and `backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 127 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 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 (5 lines × 7) · ×1
  • Duplicated block (5 lines × 7) backends-bolt/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala:176 — backends-bolt/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala:176-180 | backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala:339-343 | backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala:367-371 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala:339-343 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala:367-371 | backends-velox/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala:100-104 | backends-velox/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala:131-135 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala` and `backends-velox/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 75 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 (80 lines × 2) · ×1
  • Duplicated block (80 lines × 2) backends-bolt/src/main/scala/org/apache/gluten/expression/aggregate/HLLAdapter.scala:36 — backends-bolt/src/main/scala/org/apache/gluten/expression/aggregate/HLLAdapter.scala:36-115 | backends-velox/src/main/scala/org/apache/gluten/expression/aggregate/HLLAdapter.scala:36-115 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/expression/aggregate/HLLAdapter.scala` and `backends-velox/src/main/scala/org/apache/gluten/expression/aggregate/HLLAdapter.scala` as WHOLE FILES: 97% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (124 lines × 2) · ×1
  • Duplicated block (124 lines × 2) backends-velox/src-delta33/main/scala/org/apache/spark/sql/execution/datasources/v2/DeltaWriteOperators.scala:28 — backends-velox/src-delta33/main/scala/org/apache/spark/sql/execution/datasources/v2/DeltaWriteOperators.scala:28-151 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/execution/datasources/v2/DeltaWriteOperators.scala:28-151 — before extracting anything, compare `backends-velox/src-delta33/main/scala/org/apache/spark/sql/execution/datasources/v2/DeltaWriteOperators.scala` and `backends-velox/src-delta4/main/scala/org/apache/spark/sql/execution/datasources/v2/DeltaWriteOperators.scala` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 `backends-velox/src-delta33/main/scala/org/apache/spark/sql/execution/datasources/v2/DeltaWriteOperators.scala:28` 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 lines × 4) · ×1
  • Duplicated block (11 lines × 4) shims/spark35/src/main/scala/org/apache/spark/sql/execution/python/EvalPythonExecBase.scala:32 — shims/spark35/src/main/scala/org/apache/spark/sql/execution/python/EvalPythonExecBase.scala:32-42 | shims/spark40/src/main/scala/org/apache/spark/sql/execution/python/EvalPythonExecBase.scala:23-33 | shims/spark41/src/main/scala/org/apache/spark/sql/execution/python/EvalPythonExecBase.scala:23-33 | shims/spark42/src/main/scala/org/apache/spark/sql/execution/python/EvalPythonExecBase.scala:23-33 — before extracting anything, compare `shims/spark35/src/main/scala/org/apache/spark/sql/execution/python/EvalPythonExecBase.scala` and `shims/spark40/src/main/scala/org/apache/spark/sql/execution/python/EvalPythonExecBase.scala` as WHOLE FILES: 88% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 `shims/spark35/src/main/scala/org/apache/spark/sql/execution/python/EvalPythonExecBase.scala:32` 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 (17 lines × 3) · ×1
  • Duplicated block (17 lines × 3) shims/spark40/src/main/scala/org/apache/spark/sql/execution/GlutenFileFormatWriter.scala:32 — shims/spark40/src/main/scala/org/apache/spark/sql/execution/GlutenFileFormatWriter.scala:32-48 | shims/spark41/src/main/scala/org/apache/spark/sql/execution/GlutenFileFormatWriter.scala:32-48 | shims/spark42/src/main/scala/org/apache/spark/sql/execution/GlutenFileFormatWriter.scala:32-48 — before extracting anything, compare `shims/spark40/src/main/scala/org/apache/spark/sql/execution/GlutenFileFormatWriter.scala` and `shims/spark41/src/main/scala/org/apache/spark/sql/execution/GlutenFileFormatWriter.scala` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 `shims/spark40/src/main/scala/org/apache/spark/sql/execution/GlutenFileFormatWriter.scala:32` 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 (5 lines × 6) · ×1
  • Duplicated block (5 lines × 6) backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:467 — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:467-471 | backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala:474-478 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:310-314 | backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala:317-321 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:481-485 | backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxMetricsApi.scala:488-492 — before extracting anything, compare `backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala` and `backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHMetricsApi.scala` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 127 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 lines × 4) · ×1
  • Duplicated block (6 lines × 4) shims/spark35/src/main/scala/org/apache/spark/sql/execution/datasources/v2/AbstractBatchScanExec.scala:258 — shims/spark35/src/main/scala/org/apache/spark/sql/execution/datasources/v2/AbstractBatchScanExec.scala:258-263 | shims/spark40/src/main/scala/org/apache/spark/sql/execution/datasources/v2/AbstractBatchScanExec.scala:277-282 | shims/spark41/src/main/scala/org/apache/spark/sql/execution/datasources/v2/AbstractBatchScanExec.scala:278-283 | shims/spark42/src/main/scala/org/apache/spark/sql/execution/datasources/v2/AbstractBatchScanExec.scala:150-155 — before extracting anything, compare `shims/spark40/src/main/scala/org/apache/spark/sql/execution/datasources/v2/AbstractBatchScanExec.scala` and `shims/spark41/src/main/scala/org/apache/spark/sql/execution/datasources/v2/AbstractBatchScanExec.scala` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 3 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (16 lines × 3) · ×1
  • Duplicated block (16 lines × 3) shims/spark40/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects/InvokeExtractors.scala:30 — shims/spark40/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects/InvokeExtractors.scala:30-45 | shims/spark41/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects/InvokeExtractors.scala:30-45 | shims/spark42/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects/InvokeExtractors.scala:30-45 — before extracting anything, compare `shims/spark40/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects/InvokeExtractors.scala` and `shims/spark41/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects/InvokeExtractors.scala` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (19–31 lines × 2) · ×1
  • Duplicated block (19–31 lines × 2) gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGlobalWindowAggregate.java:220 — gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGlobalWindowAggregate.java:220-250 | gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecLocalWindowAggregate.java:193-211 — before extracting anything, compare `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGlobalWindowAggregate.java` and `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecLocalWindowAggregate.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 62 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 `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGlobalWindowAggregate.java:220` 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–29 lines × 2) · ×1
  • Duplicated block (28–29 lines × 2) gluten-flink/runtime/src/main/java/org/apache/gluten/table/runtime/operators/GlutenOneInputOperator.java:213 — gluten-flink/runtime/src/main/java/org/apache/gluten/table/runtime/operators/GlutenOneInputOperator.java:213-241 | gluten-flink/runtime/src/main/java/org/apache/gluten/table/runtime/operators/GlutenTwoInputOperator.java:200-227 — before extracting anything, compare `gluten-flink/runtime/src/main/java/org/apache/gluten/table/runtime/operators/GlutenOneInputOperator.java` and `gluten-flink/runtime/src/main/java/org/apache/gluten/table/runtime/operators/GlutenTwoInputOperator.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 45 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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.
D4 · Code Duplication · Duplicated block (14–16 lines × 2) · ×1
  • Duplicated block (14–16 lines × 2) gluten-arrow/src/main/java/org/apache/spark/sql/execution/unsafe/UnsafeByteArray.java:95 — gluten-arrow/src/main/java/org/apache/spark/sql/execution/unsafe/UnsafeByteArray.java:95-110 | gluten-arrow/src/main/java/org/apache/spark/sql/execution/unsafe/UnsafeByteArray.java:140-153 — both copies are in the same file, so extract the 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 `gluten-arrow/src/main/java/org/apache/spark/sql/execution/unsafe/UnsafeByteArray.java:95` 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 (14–15 lines × 3) · ×1
  • Duplicated block (14–15 lines × 3) backends-bolt/src/main/java/org/apache/gluten/columnarbatch/BoltColumnarBatches.java:66 — backends-bolt/src/main/java/org/apache/gluten/columnarbatch/BoltColumnarBatches.java:66-80 | backends-velox/src/main/java/org/apache/gluten/columnarbatch/VeloxColumnarBatches.java:66-80 | gluten-arrow/src/main/java/org/apache/gluten/columnarbatch/ColumnarBatches.java:300-313 — before extracting anything, compare `backends-bolt/src/main/java/org/apache/gluten/columnarbatch/BoltColumnarBatches.java` and `backends-velox/src/main/java/org/apache/gluten/columnarbatch/VeloxColumnarBatches.java` as WHOLE FILES: this scan already matched 3 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 `backends-bolt/src/main/java/org/apache/gluten/columnarbatch/BoltColumnarBatches.java:66` 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. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (3–10 lines × 6) · ×1
  • Duplicated block (3–10 lines × 6) gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecDeduplicate.java:180 — gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecDeduplicate.java:180-183 | gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGlobalWindowAggregate.java:186-195 | gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGroupWindowAggregate.java:211-214 | gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecLocalWindowAggregate.java:170-173 | gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWindowAggregate.java:187-196 | gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWindowJoin.java:178-180 — before extracting anything, compare `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGlobalWindowAggregate.java` and `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecLocalWindowAggregate.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 62 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 `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGlobalWindowAggregate.java:186` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWindowJoin.java:181` calls `toVLType` and `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecDeduplicate.java:183` 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 (7–8 lines × 3) · ×1
  • Duplicated block (7–8 lines × 3) gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGlobalWindowAggregate.java:174 — gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGlobalWindowAggregate.java:174-181 | gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecLocalWindowAggregate.java:160-166 | gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWindowAggregate.java:175-182 — before extracting anything, compare `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGlobalWindowAggregate.java` and `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecLocalWindowAggregate.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 62 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) · ×1
  • Duplicated block (7 lines × 4) gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGlobalWindowAggregate.java:199 — gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGlobalWindowAggregate.java:199-205 | gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGroupWindowAggregate.java:217-223 | gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecLocalWindowAggregate.java:176-182 | gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWindowAggregate.java:200-206 — before extracting anything, compare `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGlobalWindowAggregate.java` and `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecLocalWindowAggregate.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 62 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (6 lines × 5) · ×1
  • Duplicated block (6 lines × 5) gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGlobalWindowAggregate.java:201 — gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGlobalWindowAggregate.java:201-206 | gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGroupAggregate.java:194-199 | gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGroupWindowAggregate.java:219-224 | gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecLocalWindowAggregate.java:178-183 | gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWindowAggregate.java:202-207 — before extracting anything, compare `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGlobalWindowAggregate.java` and `gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecLocalWindowAggregate.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 62 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 (29–30 lines × 3) · ×1
  • Duplicated block (29–30 lines × 3) REDACTED:35 — REDACTED:42-71 | REDACTED:35-63 | REDACTED:37-65 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: 88% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (16–18 lines × 3) · ×1
  • Duplicated block (16–18 lines × 3) tools/scripts/gen-function-support-docs.py:1118 — tools/scripts/gen-function-support-docs.py:1118-1135 | tools/scripts/gen-function-support-docs.py:1219-1236 | tools/scripts/gen-function-support-docs.py:1384-1399 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (15–17 lines × 8) · ×1
  • Duplicated block (15–17 lines × 8) tools/scripts/gen-function-support-docs.py:1141 — tools/scripts/gen-function-support-docs.py:1141-1157 | tools/scripts/gen-function-support-docs.py:1160-1177 | tools/scripts/gen-function-support-docs.py:1180-1197 | tools/scripts/gen-function-support-docs.py:1242-1258 | tools/scripts/gen-function-support-docs.py:1261-1278 | tools/scripts/gen-function-support-docs.py:1281-1297 | tools/scripts/gen-function-support-docs.py:1300-1316 | tools/scripts/gen-function-support-docs.py:1317-1331 — all 8 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 `tools/scripts/gen-function-support-docs.py:1141` 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 (45 lines × 3) · ×1
  • Duplicated block (45 lines × 3) backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/perf/DeltaOptimizedWriterTransformer.scala:144 — backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/perf/DeltaOptimizedWriterTransformer.scala:144-188 | backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala:117-161 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala:117-161 — before extracting anything, compare `backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/perf/DeltaOptimizedWriterTransformer.scala` and `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 97 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.
D4 · Code Duplication · Duplicated block (24 lines × 3) · ×1
  • Duplicated block (24 lines × 3) backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/perf/DeltaOptimizedWriterTransformer.scala:280 — backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/perf/DeltaOptimizedWriterTransformer.scala:280-303 | backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala:267-290 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala:267-290 — before extracting anything, compare `backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/perf/DeltaOptimizedWriterTransformer.scala` and `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 97 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 `backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/perf/DeltaOptimizedWriterTransformer.scala:280` 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 (16–17 lines × 3) · ×1
  • Duplicated block (16–17 lines × 3) backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/perf/DeltaOptimizedWriterTransformer.scala:218 — backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/perf/DeltaOptimizedWriterTransformer.scala:218-233 | backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala:204-220 | backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala:204-220 — before extracting anything, compare `backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/perf/DeltaOptimizedWriterTransformer.scala` and `backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 97 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.
Minor — 237 finding(s)
D34 · Knowledge Freshness · Orphaned file · ×158
  • Orphaned file backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/execution/datasources/v1/clickhouse/MergeTreeFileFormatWriter.scala: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 gluten-arrow/src/main/java/org/apache/gluten/vectorized/ArrowColumnVector.java: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 backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/perf/DeltaOptimizedWriterTransformer.scala: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 gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecRank.java: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 gluten-flink/planner/src/main/java/org/apache/gluten/velox/PulsarSourceSinkFactory.java: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 gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGroupWindowAggregate.java: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 gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWindowJoin.java: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 gluten-substrait/src/main/scala/org/apache/gluten/extension/columnar/heuristic/ExpandFallbackPolicy.scala: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 shims/spark41/src/main/scala/org/apache/spark/sql/execution/AbstractFileSourceScanExec.scala: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 gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecDeduplicate.java: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 gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGroupAggregate.java: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 tools/qualification-tool/src/main/java/org/apache/gluten/qt/support/NodeSupportVisitor.java: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 gluten-flink/runtime/src/main/java/org/apache/flink/streaming/runtime/io/AbstractStreamTaskNetworkInput.java: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 backends-clickhouse/src/main/scala/org/apache/gluten/extension/CommonSubexpressionEliminateRule.scala: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 gluten-ui/src/main/scala/org/apache/spark/sql/execution/ui/GlutenAllExecutionsPage.scala: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 gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecExchange.java: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 backends-clickhouse/src/main/scala/org/apache/gluten/parser/GlutenClickhouseSqlParserBase.scala: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 gluten-substrait/src/main/scala/org/apache/gluten/execution/SortMergeJoinExecTransformer.scala: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 backends-velox/src/main/scala/org/apache/gluten/utils/VeloxIntermediateData.scala: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 backends-clickhouse/src/main/scala/org/apache/spark/sql/execution/commands/GlutenCHCacheDataCommand.scala: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 backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/PreprocessTableWithDVs.scala: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 backends-clickhouse/src/main/scala/org/apache/gluten/parser/GlutenCacheFileSqlParserBase.scala: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 backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/execution/datasources/v2/clickhouse/metadata/AddFileTags.scala: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 backends-clickhouse/src-celeborn/main/scala/org/apache/spark/shuffle/CHCelebornColumnarBatchSerializer.scala: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 backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/catalog/ClickHouseTableV2.scala: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.
  • + 133 more in this group — see findings.md.
X10 · Duplicated predicate · Duplicated predicate · ×25
  • Duplicated predicate .github/workflows/util/iceberg-upstream/compare.py:81 — `row["status"] == "FAILED" and row.get("failure_origin") != "GLUTEN"` appears character-identically in 2 files — .github/workflows/util/iceberg-upstream/compare.py, REDACTED. 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 .github/workflows/util/iceberg-upstream/compare.py:79 — `row["status"] == "PASSED_NATIVE" and not native_proven(row)` appears character-identically in 2 files — .github/workflows/util/iceberg-upstream/compare.py, REDACTED. 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 backends-bolt/src/main/scala/org/apache/gluten/extension/HLLRewriteRule.scala:33 — `!GlutenConfig.get.enableNativeHyperLogLogAggregateFunction || !GlutenConfig.get.enableColumnarHashAgg` appears character-identically in 2 files — backends-bolt/src/main/scala/org/apache/gluten/extension/HLLRewriteRule.scala, backends-velox/src/main/scala/org/apache/gluten/extension/HLLRewriteRule.scala. 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 backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:910 — `!SQLConf.get.caseSensitiveAnalysis && ExpressionUtils.hasUppercaseStructFieldName(child.dataType)` appears character-identically in 2 files — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala, backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala. 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 shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala:586 — `!doBatchFetch && curBlocks.size >= maxBlocksInFlightPerAddress` appears character-identically in 5 files — shims/spark34/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala, shims/spark35/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala, shims/spark40/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala, shims/spark41/src/main/scala/org/apache/spark/storage/GlutenShuffleBlockFetcherIterator.scala. 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 backends-bolt/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:315 — `!file.isDirectory && !f.endsWith(LIB_EXTENSION)` appears character-identically in 2 files — backends-bolt/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala, backends-velox/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala. 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 gluten-delta/src-delta33/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala:143 — `!hadDvMetadata && !addFileLookup.hasDeletionVector` appears character-identically in 2 files — gluten-delta/src-delta33/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala, gluten-delta/src-delta4/main/scala/org/apache/gluten/delta/DeltaDeletionVectorScanInfo.scala. 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 backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/ClickhouseOptimisticTransaction.scala:274 — `!isOptimize && shouldOptimizeWrite(writeOptions, spark.sessionState.conf)` appears character-identically in 3 files — backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/delta/ClickhouseOptimisticTransaction.scala, backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala, backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala. 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 backends-clickhouse/src/main/scala/org/apache/gluten/metrics/BroadcastNestedLoopJoinMetricsUpdater.scala:30 — `!operatorMetrics.metricsList.isEmpty && operatorMetrics.joinParams != null` appears character-identically in 3 files — backends-clickhouse/src/main/scala/org/apache/gluten/metrics/BroadcastNestedLoopJoinMetricsUpdater.scala, backends-clickhouse/src/main/scala/org/apache/gluten/metrics/HashJoinMetricsUpdater.scala, backends-clickhouse/src/main/scala/org/apache/gluten/metrics/SortMergeJoinMetricsUpdater.scala. 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 backends-bolt/src/main/scala/org/apache/gluten/extension/AppendBatchResizeForShuffleInputAndOutput.scala:35 — `!resizeBatchesShuffleInputEnabled && !resizeBatchesShuffleOutputEnabled` appears character-identically in 2 files — backends-bolt/src/main/scala/org/apache/gluten/extension/AppendBatchResizeForShuffleInputAndOutput.scala, backends-velox/src/main/scala/org/apache/gluten/extension/AppendBatchResizeForShuffleInputAndOutput.scala. 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 shims/spark34/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala:86 — `!static || !partitionFilters.exists(isDynamicPruningFilter)` appears character-identically in 5 files — shims/spark34/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala, shims/spark35/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala, shims/spark40/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala, shims/spark41/src/main/scala/org/apache/spark/sql/execution/FileSourceScanExecShim.scala. 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 backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:347 — `!useMetadataRowIndex || rowIndexColumnOpt.isDefined` appears character-identically in 2 files — backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala, backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala. 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 backends-clickhouse/src/main/scala/org/apache/spark/sql/execution/commands/GlutenCacheFilesCommand.scala:194 — `(name.startsWith("_") && !name.contains("=")) || name.startsWith(".")` appears character-identically in 2 files — backends-clickhouse/src/main/scala/org/apache/spark/sql/execution/commands/GlutenCacheFilesCommand.scala, gluten-substrait/src/main/scala/org/apache/spark/sql/hive/HivePartitionConverter.scala. 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 backends-bolt/src/main/scala/org/apache/gluten/spi/SharedLibraryLoaderCentos8.scala:26 — `(osName.contains("CentOS") && osVersion.startsWith("8")) || (osName.contains("Oracle") && osVersion.startsWith("8")) || (osName.contains("An…` appears character-identically in 2 files — backends-bolt/src/main/scala/org/apache/gluten/spi/SharedLibraryLoaderCentos8.scala, backends-velox/src/main/scala/org/apache/gluten/spi/SharedLibraryLoaderCentos8.scala. 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 backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:208 — `(schema != null) && hasLower && hasUpper && schema(col).dataType.isInstanceOf[StringType]` appears character-identically in 2 files — backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala, backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala. 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 backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala:206 — `(schema == null) || CachedColumnarBatchKryoSerializer.isDispatchable(schema(col).dataType)` appears character-identically in 2 files — backends-bolt/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala, backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarCachedBatchSerializer.scala. 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 backends-bolt/src/main/scala/org/apache/gluten/config/BoltConfig.scala:90 — `ConfigJniWrapper.isEnhancedFeaturesEnabled && getConf(ENABLE_ENHANCED_FEATURES)` appears character-identically in 2 files — backends-bolt/src/main/scala/org/apache/gluten/config/BoltConfig.scala, backends-velox/src/main/scala/org/apache/gluten/config/VeloxConfig.scala. 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 backends-bolt/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala:231 — `Files.isRegularFile(p) && p.toString.endsWith(extension)` appears character-identically in 2 files — backends-bolt/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala, backends-velox/src/main/scala/org/apache/spark/sql/expression/UDFResolver.scala. 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 backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala:142 — `GlutenConfig.get.forceOrcCharTypeScanFallbackEnabled && charTypePattern .findFirstIn( CharVarcharUtils .getRawTypeString(metadata) .getOrEls…` appears character-identically in 2 files — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala, backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxBackend.scala. 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 backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala:284 — `IcebergCompatV1.isEnabled(metadata) || IcebergCompatV2.isEnabled(metadata)` appears character-identically in 2 files — backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala, backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala. 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 shims/spark41/src/main/scala/org/apache/gluten/sql/shims/spark41/Spark41Shims.scala:437 — `Option(field.getLogicalTypeAnnotation) .exists(_.isInstanceOf[LogicalTypeAnnotation.VariantLogicalTypeAnnotation]) || (!field.isPrimitive &&…` appears character-identically in 2 files — shims/spark41/src/main/scala/org/apache/gluten/sql/shims/spark41/Spark41Shims.scala, shims/spark42/src/main/scala/org/apache/gluten/sql/shims/spark42/Spark42Shims.scala. 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 backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala:417 — `SQLConf.get.sortBeforeRepartition && num > 1` appears character-identically in 2 files — backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltSparkPlanExecApi.scala, backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala. 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 shims/spark34/src/main/scala/org/apache/gluten/sql/shims/spark34/Spark34Shims.scala:196 — `SQLConf.get.v2BucketingPushPartValuesEnabled && SQLConf.get.v2BucketingPartiallyClusteredDistributionEnabled` appears character-identically in 2 files — shims/spark34/src/main/scala/org/apache/gluten/sql/shims/spark34/Spark34Shims.scala, shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala. 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 gluten-substrait/src/main/scala/org/apache/gluten/execution/BatchScanExecTransformer.scala:168 — `SparkShimLoader.getSparkShims.findRowIndexColumnIndexInSchema(schema) > 0 && !BackendsApiManager.getSettings.supportNativeRowIndexColumn()` appears character-identically in 2 files — gluten-substrait/src/main/scala/org/apache/gluten/execution/BatchScanExecTransformer.scala, gluten-substrait/src/main/scala/org/apache/gluten/execution/FileSourceScanExecTransformer.scala. 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 backends-bolt/src/main/scala/org/apache/spark/sql/hive/BoltHiveUDFTransformer.scala:50 — `UDFResolver.UDFNames.contains(udfClassName) || UDFMappings.hiveUDFMap.contains(udfName.toLowerCase(Locale.ROOT))` appears character-identically in 2 files — backends-bolt/src/main/scala/org/apache/spark/sql/hive/BoltHiveUDFTransformer.scala, backends-velox/src/main/scala/org/apache/spark/sql/hive/VeloxHiveUDFTransformer.scala. 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.
X4 · Structured logging · Interpolated log message defeats structured logging · ×25
  • Interpolated log message defeats structured logging tools/scripts/gen-function-support-docs.py:893 — `log` at line 893 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.log(logging.INFO, "order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging tools/scripts/gen-function-support-docs.py:1078 — `log` at line 1078 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.log(logging.INFO, "order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging tools/scripts/gen-function-support-docs.py:1105 — `log` at line 1105 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.log(logging.INFO, "order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging tools/scripts/gen-function-support-docs.py:1136 — `log` at line 1136 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.log(logging.INFO, "order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging tools/scripts/gen-function-support-docs.py:1210 — `log` at line 1210 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.log(logging.INFO, "order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging tools/scripts/gen-function-support-docs.py:1237 — `log` at line 1237 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.log(logging.INFO, "order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging tools/scripts/gen-function-support-docs.py:1426 — `log` at line 1426 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.log(logging.INFO, "order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging tools/scripts/gen-function-support-docs.py:1462 — `log` at line 1462 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.log(logging.INFO, "order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging tools/scripts/gen-function-support-docs.py:1496 — `log` at line 1496 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.log(logging.INFO, "order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging tools/scripts/gen-function-support-docs.py:1499 — `log` at line 1499 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.log(logging.INFO, "order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging tools/scripts/gen-function-support-docs.py:1503 — `log` at line 1503 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.log(logging.INFO, "order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging tools/scripts/gen-function-support-docs.py:1507 — `log` at line 1507 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.log(logging.INFO, "order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging tools/scripts/gen-function-support-docs.py:1511 — `log` at line 1511 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.log(logging.INFO, "order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging tools/scripts/gen-function-support-docs.py:1515 — `log` at line 1515 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.log(logging.INFO, "order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging tools/scripts/gen-function-support-docs.py:1592 — `log` at line 1592 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.log(logging.INFO, "order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging gluten-arrow/src/main/scala/org/apache/gluten/memory/NativeMemoryManager.scala:63 — `info` at line 63 is handed an interpolated string as its message through SLF4J, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.info("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. scala-logging's `LazyLogging` logger takes an `s"…"` message apart into that pattern at compile time, so switching to it is also a fix.
  • Interpolated log message defeats structured logging gluten-core/src/main/java/org/apache/gluten/memory/memtarget/DynamicOffHeapSizingMemoryTarget.java:194 — `warn` at line 194 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.warn("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
  • Interpolated log message defeats structured logging gluten-core/src/main/java/org/apache/gluten/memory/memtarget/DynamicOffHeapSizingMemoryTarget.java:329 — `warn` at line 329 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.warn("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
  • Interpolated log message defeats structured logging gluten-core/src/main/java/org/apache/gluten/memory/memtarget/DynamicOffHeapSizingMemoryTarget.java:370 — `warn` at line 370 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.warn("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
  • Interpolated log message defeats structured logging gluten-core/src/main/java/org/apache/gluten/memory/memtarget/DynamicOffHeapSizingMemoryTarget.java:410 — `info` at line 410 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.info("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
  • Interpolated log message defeats structured logging gluten-core/src/main/java/org/apache/gluten/memory/memtarget/LoggingMemoryTarget.java:36 — `info` at line 36 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.info("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
  • Interpolated log message defeats structured logging gluten-core/src/main/java/org/apache/gluten/memory/memtarget/LoggingMemoryTarget.java:47 — `info` at line 47 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.info("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
  • Interpolated log message defeats structured logging gluten-arrow/src/main/java/org/apache/gluten/memory/arrow/alloc/ArrowBufferAllocators.java:101 — `warn` at line 101 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.warn("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
  • Interpolated log message defeats structured logging gluten-arrow/src/main/java/org/apache/gluten/memory/arrow/alloc/ArrowBufferAllocators.java:107 — `warn` at line 107 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.warn("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
  • Interpolated log message defeats structured logging backends-bolt/src/main/java/org/apache/gluten/jni/BoltJniLibLoader.java:344 — `info` at line 344 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.info("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
AX6 · Interface segregation · Fat interface · ×3
  • Fat interface: MetricsApi (44 abstract members) gluten-substrait/src/main/scala/org/apache/gluten/backendsapi/MetricsApi.scala:30 — `MetricsApi` declares 44 abstract members: `genInputIteratorTransformerMetrics`, `genInputIteratorTransformerMetricsUpdater`, `metricsUpdatingFunction`, `genBatchScanTransformerMetrics`, `genBatchScanTransformerMetricsUpdater`, `genHiveTableScanTransformerMetrics`, `genHiveTableScanTransformerMetricsUpdater`, `genFileSourceScanTransformerMetrics`, `genFileSourceScanTransformerMetricsUpdater`, `genFilterTransformerMetrics`, `genFilterTransformerMetricsUpdater`, `genProjectTransformerMetrics`, `genProjectTransformerMetricsUpdater`, `genHashAggregateTransformerMetrics`, `genHashAggregateTransformerMetricsUpdater`, `genExpandTransformerMetrics`, `genExpandTransformerMetricsUpdater`, `genCustomExpandMetrics`, `genColumnarShuffleExchangeMetrics`, `genWindowTransformerMetrics`, `genWindowTransformerMetricsUpdater`, `genColumnarToRowMetrics`, `genRowToColumnarMetrics`, `genLimitTransformerMetrics`, `genLimitTransformerMetricsUpdater`, `genWriteFilesTransformerMetrics`, `genWriteFilesTransformerMetricsUpdater`, `genBatchWriteMetrics`, `genSortTransformerMetrics`, `genSortTransformerMetricsUpdater`, `genTopNTransformerMetrics`, `genTopNTransformerMetricsUpdater`, `genSortMergeJoinTransformerMetrics`, `genSortMergeJoinTransformerMetricsUpdater`, `genColumnarBroadcastExchangeMetrics`, `genColumnarSubqueryBroadcastMetrics`, `genHashJoinTransformerMetrics`, `genHashJoinTransformerMetricsUpdater`, `genNestedLoopJoinTransformerMetrics`, `genNestedLoopJoinTransformerMetricsUpdater`, and 4 more. Counted over its ABSTRACT members — a `def` with no body or a `val`/`var` with no initializer, once per signature; concrete members, private and protected members, and members of a companion `object` are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: SparkPlanExecApi (33 abstract members) gluten-substrait/src/main/scala/org/apache/gluten/backendsapi/SparkPlanExecApi.scala:53 — `SparkPlanExecApi` declares 33 abstract members: `genFilterExecTransformer`, `genHashAggregateExecTransformer`, `genHashAggregateExecPullOutHelper`, `genColumnarShuffleExchange`, `genShuffledHashJoinExecTransformer`, `genBroadcastHashJoinExecTransformer`, `genSampleExecTransformer`, `genSortMergeJoinExecTransformer`, `genCartesianProductExecTransformer`, `genBroadcastNestedLoopJoinExecTransformer`, `genGetMapValueTransformer`, `genGetArrayItemTransformer`, `genPosExplodeTransformer`, `genShuffleDependency`, `genColumnarShuffleWriter`, `genColumnarShuffleReader`, `createColumnarBatchSerializer`, `createBroadcastRelation`, `createColumnarWriteFilesExec`, `createColumnarArrowEvalPythonExec`, `genLikeTransformer`, `genToUnixTimestampTransformer`, `genDateDiffTransformer`, `genWindowFunctionsNode`, `genGenerateTransformer`, `genPreProjectForGenerate`, `genPostProjectForGenerate`, `genColumnarCollectLimitExec`, `genColumnarRangeExec`, `genColumnarTailExec`, `genColumnarToCarrierRow`, `genTimestampAddTransformer`, `genMonthsBetweenTransformer`. Counted over its ABSTRACT members — a `def` with no body or a `val`/`var` with no initializer, once per signature; concrete members, private and protected members, and members of a companion `object` are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: SparkShims (26 abstract members) shims/common/src/main/scala/org/apache/gluten/sql/shims/SparkShims.scala:73 — `SparkShims` declares 26 abstract members: `scalarExpressionMappings`, `aggregateExpressionMappings`, `runtimeReplaceableExpressionMappings`, `filesGroupedToBuckets`, `getSampleSeed`, `isKeyGroupedPartitioning`, `setJobDescriptionOrTagForBroadcastExchange`, `cancelJobGroupForBroadcastExchange`, `getFileStatus`, `isFileSplittable`, `isRowIndexMetadataColumn`, `findRowIndexColumnIndexInSchema`, `splitFiles`, `getAnalysisExceptionPlan`, `getCommonPartitionValues`, `orderPartitions`, `extractExpressionTimestampAddUnit`, `isNullIntolerant`, `createParquetFilters`, `getOperatorId`, `setOperatorId`, `unsetOperatorId`, `isParquetFileEncrypted`, `getErrorMessage`, `createSparkPlan`, `getShuffleBlockFetcherIterator`. Counted over its ABSTRACT members — a `def` with no body or a `val`/`var` with no initializer, once per signature; concrete members, private and protected members, and members of a companion `object` are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
D16 · Bus Factor · Off-boarding risk · ×3
  • Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 12 significant file(s) lose their only recent owner: tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/ds/TpcdsTableLayout.scala, gluten-substrait/src/main/scala/org/apache/gluten/extension/joinagg/PushAggregateThroughJoin.scala, gluten-substrait/src/main/scala/org/apache/gluten/extension/joinagg/ImplementJoinAggregate.scala, gluten-substrait/src/main/scala/org/apache/gluten/extension/joinagg/JoinAggregateFunctionWrapper.scala, backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/GlutenOptimisticTransaction.scala, tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/action/QueriesCompare.scala, tools/gluten-it/common/src/main/scala/org/apache/gluten/integration/action/Queries.scala, gluten-arrow/src/main/java/org/apache/gluten/memory/arrow/alloc/ArrowBufferAllocators.java (+4 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 7 significant file(s) lose their only recent owner: backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltBackend.scala, backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltIteratorApi.scala, backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltListenerApi.scala, gluten-core/src/main/java/org/apache/gluten/hash/ConsistentHash.java, backends-bolt/src/main/scala/org/apache/gluten/spi/SharedLibraryLoaderCentos8.scala, backends-bolt/src/main/scala/org/apache/gluten/spi/SharedLibraryLoaderCentos7.scala, backends-bolt/src/main/scala/org/apache/spark/sql/execution/datasources/bolt/BoltBlockStripes.java. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #3 — If anonymized user #3 becomes unavailable, 6 significant file(s) lose their only recent owner: gluten-flink/planner/src/main/java/org/apache/gluten/velox/KafkaSourceSinkFactory.java, gluten-flink/planner/src/main/java/org/apache/gluten/velox/HiveSourceSinkFactory.java, gluten-flink/runtime/src/main/java/org/apache/gluten/table/runtime/operators/WindowAggOperator.java, gluten-flink/runtime/src/main/java/org/apache/gluten/table/runtime/operators/GlutenStreamingFileWriterOperator.java, gluten-flink/runtime/src/main/java/org/apache/gluten/table/runtime/metrics/SourceOperatorMetrics.java, gluten-flink/runtime/src/main/java/org/apache/gluten/util/ReflectUtils.java. Pair on, review, or document these before any departure.
D29 · Static Analysis (SAST) · REDACTED · ×3
  • REDACTED
  • REDACTED
  • REDACTED
D30 · Dependency Vulnerabilities · Low CVE · ×3
  • REDACTED
  • REDACTED
  • REDACTED
X23 · Unguarded diagnostic materialisation · Diagnostic log message is built whether or not it is wanted · ×3
  • Diagnostic log message is built whether or not it is wanted gluten-flink/runtime/src/main/java/org/apache/gluten/table/runtime/operators/GlutenOneInputOperator.java:140 — `debug` at line 140 is called with an argument built by `Serde.toJson(mockInput)` (line 140), whose cost grows with the collection it walks. Java evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isDebugEnabled`/`isTraceEnabled` test, no debug flag, no lambda or `Supplier` the logger calls only when the level is on.
  • Diagnostic log message is built whether or not it is wanted gluten-flink/runtime/src/main/java/org/apache/gluten/streaming/api/operators/GlutenOneInputOperatorFactory.java:55 — `debug` at line 55 is called with an argument built by `Serde.toJson(getOperator().getPlanNode())` (line 55), whose cost grows with the collection it walks. Java evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isDebugEnabled`/`isTraceEnabled` test, no debug flag, no lambda or `Supplier` the logger calls only when the level is on.
  • Diagnostic log message is built whether or not it is wanted gluten-flink/runtime/src/main/java/org/apache/gluten/streaming/api/operators/GlutenTwoInputOperatorFactory.java:56 — `debug` at line 56 is called with an argument built by `Serde.toJson(getOperator().getPlanNode())` (line 56), whose cost grows with the collection it walks. Java evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isDebugEnabled`/`isTraceEnabled` test, no debug flag, no lambda or `Supplier` the logger calls only when the level is on.
D29 · Static Analysis (SAST) · REDACTED · ×2
  • REDACTED
  • REDACTED
D31 · IaC & Container Security · Low IaC · ×2
  • REDACTED
  • REDACTED
D16 · Bus Factor · Further sole-owners (lower concentration) · ×1
  • Further sole-owners (lower concentration) — 13 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 (47 single-owned of 828 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; 828 of the 1418 production source files in this repository met that bar). They are anonymized user #4 (2 file(s)), 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)) (+7 more) — spread or document their files in the same way, at lower priority than the named off-boarding risks above. The files folded here: backends-bolt/src/main/scala/org/apache/gluten/backendsapi/bolt/BoltMetricsApi.scala, backends-bolt/src/main/scala/org/apache/gluten/execution/TopNTransformer.scala, backends-clickhouse/src/main/scala/org/apache/gluten/extension/JoinAggregateToAggregateUnion.scala, backends-clickhouse/src/main/scala/org/apache/gluten/extension/ConvertWindowToAggregate.scala, backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/files/GlutenDeltaFileFormatWriter.scala, backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenDeltaParquetFileFormat.scala, backends-velox/src/main/scala/org/apache/gluten/extension/VeloxBroadcastNestedLoopJoinRewriteRule.scala, gluten-substrait/src/main/scala/org/apache/spark/sql/hive/HiveUDFTransformer.scala (+14 more).
D26 · Project Cohesion · Projects may be oversized for their cohesion · ×1
  • Projects may be oversized for their cohesion — 7 of 25 project(s) overshoot their size bounds, lowering Project Cohesion to 4.7/10. The most over is `backends-clickhouse` (30399 LoC, 405 module-visible types across 62 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) — 158 smaller file(s) also have no living knowledge — folded into the freshness score and metrics rather than raised one row each — most significant first: backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/execution/datasources/v1/clickhouse/MergeTreeFileFormatWriter.scala, gluten-arrow/src/main/java/org/apache/gluten/vectorized/ArrowColumnVector.java, backends-clickhouse/src-delta33/main/scala/org/apache/spark/sql/perf/DeltaOptimizedWriterTransformer.scala, gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecRank.java, gluten-flink/planner/src/main/java/org/apache/gluten/velox/PulsarSourceSinkFactory.java, gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGroupWindowAggregate.java, gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWindowJoin.java, gluten-substrait/src/main/scala/org/apache/gluten/extension/columnar/heuristic/ExpandFallbackPolicy.scala (and 150 more) (165 orphaned of 831 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; 831 of the 1418 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
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 9/10 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`.
P6 · Release Hygiene · No changelog · ×1
  • No changelog — No CHANGELOG/HISTORY/RELEASES file — what shipped when isn't easy to reconstruct for support or audit. (Versioning/tagging makes releases traceable, but a changelog records the what.)
X5 · Nullable reference types · Scala's null is not held to the type system everywhere · ×1
  • Scala's null is not held to the type system everywhere — No build over this repository's 1002 Scala product file(s) passes `-Yexplicit-nulls`, enables WartRemover's `Null` wart or runs Scalafix's `DisableSyntax.noNulls`, so every reference type admits null and nothing reports a `null` written into the code or returned from a Java API — the first one to reach a method call is a `NullPointerException`. `Option` by convention is a habit no tool here holds the code to.

Appendix B — Reproduction & audit trail

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

DimensionToolVersionCommandFindingsRaw output
D28 · Secrets (history)gitleaks—gitleaks detect --no-banner --config /opt/gitleaks-rules/watchdog-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-712b38be9edb4a0b80ac1b7e908bd229/history.json --exit-code 0 --source .0artifacts/raw/gitleaks-history.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-git --no-banner --config /opt/gitleaks-rules/watchdog-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-712b38be9edb4a0b80ac1b7e908bd229/tree.json --exit-code 0 --source .0artifacts/raw/gitleaks-tree.json
D29 · Static Analysis (SAST)semgrep—semgrep --config /opt/semgrep-rules/security-audit.yml --config /opt/semgrep-rules/owasp-top-ten.yml --config /opt/semgrep-rules/watchdog-sast.yml --json --quiet --timeout 10 --timeout-threshold 3 --metrics off --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 --exclude backends-velox/src/test/resources/tpch-approved-plan .393artifacts/raw/semgrep.json
D30 · Dependency Vulnerabilitiesosv-scanner—osv-scanner --format json --recursive --experimental-disable-plugins transitivedependency/requirements --experimental-disable-plugins dotnet/csproj --experimental-disable-plugins dotnet/nugetcpm .55artifacts/raw/osv-scanner.json
D31 · IaC & Container Securitytrivy—trivy config --format json --quiet .102artifacts/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. semgrep could not parse 2 file(s) — `backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxTransformerApi.scala`, `gluten-ui/src/main/scala/org/apache/spark/sql/execution/ui/GlutenAllExecutionsPage.scala` — so the PII/GDPR sweep did not cover them at all.0—
D37 · Vulnerability-disclosure Policydisclosure—disclosure: not applicable — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.0—
D40 · Network Egress Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.0—
D41 · Kernel & Syscall Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.0—
D42 · Runtime Threat Enforcementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.0—
D43 · Malicious Dependenciesosv-scanner—osv-scanner --format json --recursive --experimental-disable-plugins transitivedependency/requirements --experimental-disable-plugins dotnet/csproj --experimental-disable-plugins dotnet/nugetcpm .0artifacts/raw/osv-scanner.json

Run 01a177d2-c7f3-7058-abd8-26edbf6f9632 · 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