Skip to content

Logging skips lazy aggregate field enumeration#3054

Open
anderson-joyle wants to merge 1 commit intomainfrom
A-TEAM/fix-applygetlogging-no-enumerate
Open

Logging skips lazy aggregate field enumeration#3054
anderson-joyle wants to merge 1 commit intomainfrom
A-TEAM/fix-applygetlogging-no-enumerate

Conversation

@anderson-joyle
Copy link
Copy Markdown
Contributor

Issue: #2858

CheckResult.ApplyGetLogging funnels through StructuralPrint.IsExpandedType, which called DType.AggregateHasExpandedType for every FirstName reference. For lazy aggregate types (DKind.LazyRecord / LazyTable used by CDP-style data sources), GetAllNames forces per-field resolution via LazyTypeProvider.TryGetFieldType, potentially materializing relationship metadata that a logging call should never need.

Short-circuit lazy types in StructuralPrint.IsExpandedType so no TryGetFieldType calls happen on the logging path. Non-lazy aggregate behavior is unchanged: the '#$fne$#' marker continues to fire exactly as before for the dominant (non-CDP) population of expressions, and all 223 existing CheckResult + Formatter tests pass unchanged.

Note for consumers that pattern-match on '#$fne$#': for FirstName references whose bound type is a lazy aggregate whose lazily-resolved fields would have contained an expand entity, the marker is no longer emitted. A follow-up can restore marker parity for lazy aggregates by adding a non-materializing predicate to LazyTypeProvider.

Adds LazyLoggingSpyRecordType test helper and
ApplyGetLoggingDoesNotEnumerateLazyFields regression test. Spy asserts TryGetFieldTypeCallCount and FieldNamesIterationCount stay at zero after ApplyGetLogging; without the fix the counter reaches 2 (one per field).

CheckResult.ApplyGetLogging funnels through StructuralPrint.IsExpandedType,
which called DType.AggregateHasExpandedType for every FirstName reference.
For lazy aggregate types (DKind.LazyRecord / LazyTable used by CDP-style
data sources), GetAllNames forces per-field resolution via
LazyTypeProvider.TryGetFieldType, potentially materializing relationship
metadata that a logging call should never need.

Short-circuit lazy types in StructuralPrint.IsExpandedType so no
TryGetFieldType calls happen on the logging path. Non-lazy aggregate
behavior is unchanged: the '#$fne$#' marker continues to fire exactly as
before for the dominant (non-CDP) population of expressions, and all 223
existing CheckResult + Formatter tests pass unchanged.

Note for consumers that pattern-match on '#$fne$#': for FirstName
references whose bound type is a lazy aggregate whose lazily-resolved
fields would have contained an expand entity, the marker is no longer
emitted. A follow-up can restore marker parity for lazy aggregates by
adding a non-materializing predicate to LazyTypeProvider.

Adds LazyLoggingSpyRecordType test helper and
ApplyGetLoggingDoesNotEnumerateLazyFields regression test. Spy asserts
TryGetFieldTypeCallCount and FieldNamesIterationCount stay at zero after
ApplyGetLogging; without the fix the counter reaches 2 (one per field).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@anderson-joyle anderson-joyle requested a review from a team as a code owner April 21, 2026 19:24
@jas-valgotar
Copy link
Copy Markdown
Contributor

✅ No public API change.

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.

2 participants