Skip to content

API: Fix struct metrics in nested struct evaluator test - #17412

Open
nastra wants to merge 1 commit into
mainfrom
metrics-for-structs
Open

API: Fix struct metrics in nested struct evaluator test#17412
nastra wants to merge 1 commit into
mainfrom
metrics-for-structs

Conversation

@nastra

@nastra nastra commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

FILE_6 in TestInclusiveMetricsEvaluator carried value and null counts for the required_address and optional_address structs. Parquet produces metrics for leaf columns only in ParquetMetrics.MetricsVisitor.struct and returns just the concatenation of its children and never emits a FieldMetrics for the struct — so no Parquet file yields those entries. They made notNull("optional_address") appear prunable when in practice it is not

  • Model: Claude Opus 4.6
  • Platform/Tool: Cursor
  • Human Oversight: [unknown - human to fill in]
  • Prompt Summary: Align the nested struct test fixture with the metrics Parquet actually
    produces, which excludes struct-level value and null counts.

`FILE_6` in `TestInclusiveMetricsEvaluator` carried value and null counts for the
`required_address` and `optional_address` structs. Parquet produces metrics for leaf
columns only in `ParquetMetrics.MetricsVisitor.struct` and returns just the concatenation of
its children and never emits a `FieldMetrics` for the struct — so no Parquet file yields
those entries. They made `notNull("optional_address")` appear prunable when in practice it is not
shouldRead =
new InclusiveMetricsEvaluator(NESTED_SCHEMA, isNull("optional_address.required_street2"))
.eval(FILE_6);
assertThat(shouldRead).as("Should read: optional_address is optional").isTrue();

@dramaticlly dramaticlly Jul 29, 2026

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.

nit, not related to the change but I think the reason to prune the field 104 and 105 for notNull predicate is a bit different from "optional_address is optional".

Since both are nested within an optional struct, we cannot decide based on schema whether values are nullable or not. The decision is made based on the leaf field metrics (value count = 5 and null count = 5. so all values are null and evaluate to false)

Meant to comment on LINE966, my bad

@anoopj anoopj left a comment

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.

lgtm

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants