Skip to content

model-train store: read_table_row out of reconstruct_param; 439 -> 149 lines - #551

Merged
ypriverol merged 1 commit into
mainfrom
refactor/reconstruct-param
Nov 24, 2026
Merged

ypriverol merged 1 commit into
mainfrom
refactor/reconstruct-param

Conversation

@ypriverol

@ypriverol ypriverol commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Part of the function-length work: reconstruct_param (crates/model-train/src/store/read.rs) goes from 439 to 149 lines.

Most of the function was the arm that reads one table row: partitions, precursor and fragment offsets, rank distributions, error and existence tables. That arm moves unchanged to read_table_row.

  • The seven tables it fills are a TableRows accumulator, destructured under the old names before the Param is built.
  • Its row skips (continue on the row loop, all at arm level) become return Ok(()).
  • The batch it receives is a reference.

The function's line is dropped from fn_lines.tsv.

Verification: release build; tests pass in every crate, including train_end_to_end and the model store round-trip tests; clippy is clean with both feature sets.

Summary by CodeRabbit

  • Refactor
    • Updated the handling of model parameter data while preserving existing behavior for supported table types, missing values, and validation.
    • No changes to user-facing features or workflows are included in this update.

reconstruct_param was 439 lines, most of it the arm reading one 'table'
row (partition, precursor and fragment offsets, rank distributions,
error and existence tables). That arm moves unchanged to read_table_row;
the seven tables it fills are a TableRows accumulator, destructured
under the old names before the Param is built. Its row skips (continue
on the row loop) become returns, and the batch it receives is a
reference. Its fn_lines.tsv line is dropped.
reconstruct_param 439 -> 149 lines.
@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing

@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change extracts table-row decoding from reconstruct_param into read_table_row and groups partition and model-table data in TableRows. The decoder retains per-kind handling, null skips, type checks, and validation behavior.

Changes: Table Row Decoding

Layer / File(s) Summary
Accumulator and table-row decoding
crates/model-train/src/store/read.rs
TableRows groups the partition list and six model-table collections. read_table_row decodes table records and retains null handling, Arrow type checks, and row validation.
Reconstruction integration
crates/model-train/src/store/read.rs
reconstruct_param initializes TableRows, delegates row decoding to read_table_row, and uses the accumulated fields to continue parameter construction.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Refactor

Merge Risk: Minimal · up to 427f4 · assessed changes only

Path filters excluded changed files. This rating applies only to the assessed changes.

Pre-merge checks: Passed 3 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Description check Inconclusive The description covers the what and why. It explains that reconstruct_param drops from 439 to 149 lines and that the table-row arm moves unchanged to read_table_row. It also lists the TableRows accumu… Complete the 'Results changed?' section. Tick 'No' if identifications, scores, quantities and output files are unchanged, or describe the change and give the evidence otherwise. Also address the checklist items that apply, such as goldens, …
Passed Passed checks: 3 passed

Check name Status Explanation
Title check Passed The title names the main change: the table-row reading arm moves out of reconstruct_param into read_table_row. It also gives the line count drop from 439 to 149. The changeset matches this description…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: the table-row reading arm moves out of reconstruct_param into read_table_row. It also gives the line count drop from 439 to 149. The changeset matches this description, so the title is related to the main change.

Full details: Description check

Explanation

The description covers the what and why. It explains that reconstruct_param drops from 439 to 149 lines and that the table-row arm moves unchanged to read_table_row. It also lists the TableRows accumulator, the continue-to-return change, and the verification steps. It does not fill in the template's 'Results changed?' section, the checklist, or the stacked-PR note. The results section is needed here, because the PR changes code paths that feed the output. The description does not say whether outputs are unchanged, so the author must state this.

Resolution

Complete the 'Results changed?' section. Tick 'No' if identifications, scores, quantities and output files are unchanged, or describe the change and give the evidence otherwise. Also address the checklist items that apply, such as goldens, parameter declarations, logs, and docs (ARCHITECTURE.md and DOCS.md), or state why they do not apply. Mark the stacked-PR item as not applicable if the PR is not stacked.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 000be7c0-9871-4f43-89e5-37d2139e62cc
Commits

Reviewing files that changed from the base of the PR and between 22e48e8 and 427f48c.

Files ignored due to path filters: 1

  • crates/andes/tests/ratchets/fn_lines.tsv is excluded by !**/*.tsv
Files selected for processing: 1

  • crates/model-train/src/store/read.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@ypriverol
ypriverol merged commit 945b5bd into main Nov 24, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant