Skip to content

[BUG](pyspark) Honor string min_length in base-row generation - #578

Merged
Seth Fitzsimmons (sethfitz) merged 1 commit into
mainfrom
base-row-string-min-length
Jul 23, 2026
Merged

Seth Fitzsimmons (sethfitz) merged 1 commit into
mainfrom
base-row-string-min-length

Conversation

@sethfitz

@sethfitz Seth Fitzsimmons (sethfitz) commented Jul 21, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

_value_from_check_string_min_length (base-row test-data synthesis) ignored the descriptor's min_length and always returned a single character. For any string field with min_length > 1, the synthesized base/valid row value ('a', length 1) already violates the constraint -- so the generated conformance ::valid row would be invalid and the ::invalid scenario's baseline wrong.

The fix reads the min_length bound from the descriptor and emits a filler of that length ('a' * min_length).

Scope

Latent on main today: no live schema field declares a string min_length > 1, so the conformance suite stays green and generated output is unchanged. The defect surfaced while working the generalize-field-path branch, where a mixed-shape test had to use min_length=1 rather than 3 to keep its valid row valid. Genuinely orthogonal to that branch -- it does not mask a defect in #570.

The analogous array min-length synthesizer (_min_length_from_shape_constraints) already reads min_length correctly and generates that many elements; string max-length and array max-length are not lower bounds and need no base-row value. The string min-length synthesizer was the sole offender.

Part of and partly closes #517.

@github-actions

github-actions Bot commented Jul 21, 2026 •

Copy link
Copy Markdown

🗺️ Schema reference docs preview is live!

🌍 Preview https://staging.overturemaps.org/schema/pr/578/schema/index.html
🕐 Updated Jul 21, 2026 18:07 UTC
📝 Commit 75a34d0
🔧 env SCHEMA_PREVIEW true

Note

♻️ This preview updates automatically with each push to this PR.

@sethfitz
Seth Fitzsimmons (sethfitz) marked this pull request as draft July 21, 2026 03:34
@sethfitz
Seth Fitzsimmons (sethfitz) marked this pull request as ready for review July 21, 2026 04:16
Base automatically changed from pyspark-expression-codegen to main July 21, 2026 17:31
_value_from_check_string_min_length ignored the descriptor's min_length
and always returned a single character, so a string field with
min_length > 1 would get a base/valid row value that already violates
the constraint -- making the generated conformance ::valid row invalid
and the ::invalid scenario's baseline wrong.

Read the min_length bound from the descriptor and emit a filler of that
length. Latent today (no live schema field declares string min_length >
1); surfaced while working the generalize-field-path branch (bd-swy2).

Fixes bd-mwy8.

Signed-off-by: Seth Fitzsimmons <seth@mojodna.net>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Re-approved and I got the PR check green by editing the description with "partly closes #517".

@sethfitz
Seth Fitzsimmons (sethfitz) merged commit 068a9df into main Jul 23, 2026
25 of 27 checks passed
@sethfitz
Seth Fitzsimmons (sethfitz) deleted the base-row-string-min-length branch July 23, 2026 16:18

This branch was successfully deployed

1 active deployment
staging — 75a34d05 Deployed Jul 21, 2026 by sethfitz via Deploy #232
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.

Validate Overture data on Spark against the Pydantic schema

3 participants