Skip to content

Clarify ArrayRecord handling of Multiple Null Records - #132479

Draft
adamsitnik with Copilot wants to merge 1 commit into
mainfrom
copilot/replace-comment-arrayrecord
Draft

Clarify ArrayRecord handling of Multiple Null Records#132479
adamsitnik with Copilot wants to merge 1 commit into
mainfrom
copilot/replace-comment-arrayrecord

Conversation

Copilot AI commented Aug 18, 2026

Copy link
Copy Markdown
Contributor
  • Problem

    • The comment above CheckExpectedRecordCount described record counting with extra detail and mixed concerns; this update narrows it to the exact invariant around Multiple Null Records.
  • Change

    • Replaced the existing multi-line comment with the requested two-line wording to explicitly state:
      • most records map to one value,
      • Multiple Null Records can represent multiple nulls when nulls are allowed, so record count may differ from element count.
  • Updated snippet

    // Every record represents a single value, except for the Multiple Null Records which represent more than one null.
    // When nulls are allowed, Multiple Null Records are permitted and the record count is not expected to match the total element count.

Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@GrabYourPitchforks

GrabYourPitchforks commented Aug 18, 2026

Copy link
Copy Markdown
Member

@adamsitnik I think the pertinent question is "why does this check exist?" It's purely a performance optimization, but it comes across as a correctness check.

That's also why, in the conversation I had with you, I pushed back a bit against the unit test. Unit tests typically check correctness, and I think most readers and maintainers of the code base would not expect the presence of a performance-check-only unit test. (That deserves a comment in the unit test!)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the inline documentation above ArrayRecord.CheckExpectedRecordCount to clarify how NRBF array record counting behaves when “multiple null” records are present, especially when allowNulls is enabled.

Changes:

  • Replaced the existing XML doc/remarks block with a shorter two-line comment describing the record-count vs element-count invariant.
  • Focused the comment specifically on the special-case behavior of multiple-null records when nulls are allowed.

Comment on lines +117 to +118
// Every record represents a single value, except for the Multiple Null Records which represent more than one null.
// When nulls are allowed, Multiple Null Records are permitted and the record count is not expected to match the total element count.
/// It's important to perform this check before allocating the array, as the array can be very large.
/// </remarks>
// Every record represents a single value, except for the Multiple Null Records which represent more than one null.
// When nulls are allowed, Multiple Null Records are permitted and the record count is not expected to match the total element count.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is a comment required at all?

If anything, just keep it simple.

// Other than multiple-null, every record represents one object.
// So for null-disallowed, we can do a quick check to avoid unnecessary work.

But my recommendation is just to delete the comment altogether.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants