Skip to content

Add regression tests for hash-join dynamic filter expression policy#23319

Draft
kosiew wants to merge 4 commits into
apache:mainfrom
kosiew:dynamic-filter-01-22772
Draft

Add regression tests for hash-join dynamic filter expression policy#23319
kosiew wants to merge 4 commits into
apache:mainfrom
kosiew:dynamic-filter-01-22772

Conversation

@kosiew

@kosiew kosiew commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

This change adds focused regression coverage for the current dynamic-filter expression assembly performed by SharedBuildAccumulator::build_filter. The intent is to make the existing expression policy explicit before refactoring, ensuring that future changes preserve the current pruning semantics for both CollectLeft and Partitioned finalize paths.

What changes are included in this PR?

  • Add reusable test helpers for constructing SharedBuildAccumulator instances, partition state, bounds, and pushdown strategies.

  • Add unit tests covering CollectLeft dynamic-filter expression assembly for:

    • membership-only filters,
    • bounds-only filters,
    • empty build data that should not update the dynamic filter.
  • Add unit tests covering Partitioned dynamic-filter expression assembly for:

    • a single real partition with otherwise empty partitions (ensuring no unnecessary CASE expression),
    • canceled/unknown partitions (ensuring permissive fallback for unknown routes).
  • Add helper assertions that validate the structural shape of the generated expressions (for example, InListExpr, BinaryExpr, CaseExpr, and literal boolean expressions) rather than relying on brittle textual representations.

Are these changes tested?

Yes.

This PR adds the following unit tests:

  • collect_left_updates_with_membership_only
  • collect_left_updates_with_bounds_only
  • collect_left_empty_build_data_does_not_update_filter
  • partitioned_one_real_partition_with_rest_empty_skips_case
  • partitioned_canceled_unknown_partitions_keep_unknown_routes_permissive

These tests exercise the dynamic-filter expression policy without changing production behavior.

Are there any user-facing changes?

No. This PR only adds regression tests and does not change runtime behavior.

LLM-generated code disclosure

This PR includes LLM-generated code and comments. All LLM-generated content has been manually reviewed.

kosiew added 3 commits July 4, 2026 13:52
…ds.rs

- Added tests for `CollectLeft`:
- membership only
- bounds only
- membership + bounds
- empty/no-expression → no update
- Added tests for `Partitioned`:
- one real + rest empty → no CASE
- multiple real → CASE, else false
- all empty → false
- canceled unknown + empty → CASE, else true
…sion helpers

- Deduplicated test accumulator setup using `make_accumulator_for_test`.
- Introduced new narrow expression helpers: `in_list_expr`, `binary_expr`, and `case_expr`.
- Enhanced panic context for `current_expr` and downcasting.
- Maintained existing `pub(super) make_partitioned_accumulator_for_test` without changes.
- Update CollectLeft no-expression test to assert that dynamic filter generation remains unchanged.
- Improve partitioned CASE test to assert:
- Routing expression is set to '%'
- Branch keys are 0 and 1
- Branch expressions are verified to be InList
- Fallback condition remains false
@github-actions github-actions Bot added the physical-plan Changes to the physical-plan crate label Jul 4, 2026
…in hash_join

- Removed overlapping tests:
- collect_left_combines_membership_and_bounds
- partitioned_multiple_real_partitions_uses_case_with_false_fallback
- partitioned_all_empty_partitions_updates_filter_to_false
- Removed now-unused helper function: assert_literal_u64.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

physical-plan Changes to the physical-plan crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant