Skip to content

[TEST](pyspark) Batch per-test DataFrames into one collect#577

Open
Seth Fitzsimmons (sethfitz) wants to merge 1 commit into
generalize-field-pathfrom
pyspark-test-batching
Open

[TEST](pyspark) Batch per-test DataFrames into one collect#577
Seth Fitzsimmons (sethfitz) wants to merge 1 commit into
generalize-field-pathfrom
pyspark-test-batching

Conversation

@sethfitz

Copy link
Copy Markdown
Collaborator

Follow-up to #572, stacked on its generalize-field-path branch (the column_patterns cases use the nested_map_{keys,values}_check helpers #572 adds). I'll rebase onto the integration branch once #572 merges.

Closes #576.

What changed

test_column_patterns.py and test_constraint_expressions.py each built a DataFrame and collect()ed once per test — roughly 200 Spark jobs between them. Both now use a case registry: each _Case carries its input column, the check over it, and a predicate on the result; a module-scoped fixture packs every case's input into one wide single-row DataFrame, applies every check in a single select, and collects once. This is the batch-once pattern the generated conformance harness already uses.

Effect

Every prior assertion is preserved — the distinct asserted literals all survive and the parametrized cases stay green.

file before after cases
test_column_patterns.py 6.4s 4.0s 33 → 37
test_constraint_expressions.py 16.9s 5.1s 164 → 165

The extra cases come from splitting valid/invalid two-row tests into explicit per-input cases; no coverage is dropped. The remaining floor is Spark session startup.

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown

🗺️ Schema reference docs preview is live!

🌍 Preview https://staging.overturemaps.org/schema/pr/577/schema/index.html
🕐 Updated Jul 21, 2026 18:24 UTC
📝 Commit e7ddca5
🔧 env SCHEMA_PREVIEW true

Note

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

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.

1.5X-3X test speed-up. I'll take it!

test_column_patterns.py and test_constraint_expressions.py each built a
DataFrame and collected once per test -- ~200 Spark jobs between them.
Both now use a case registry: each _Case carries its input column, the
check over it, and a predicate on the result; a module-scoped fixture
packs every case's input into one wide single-row DataFrame, applies
every check in a single select, and collects once. This is the
batch-once pattern the generated conformance harness uses.

Every prior assertion is preserved. Timings (remaining floor is Spark
session startup):

  test_column_patterns.py         6.4s -> 4.0s   (33 -> 37 cases)
  test_constraint_expressions.py  16.9s -> 5.1s  (164 -> 165 cases)

The extra cases come from splitting valid/invalid two-row tests into
explicit per-input cases; no coverage dropped.

Signed-off-by: Seth Fitzsimmons <seth@mojodna.net>
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.

2 participants