Skip to content

Comments

test: add unit test for multiple partition filters on same column#17934

Merged
nsivabalan merged 7 commits intoapache:masterfrom
suryaprasanna:surya-devx-05
Feb 11, 2026
Merged

test: add unit test for multiple partition filters on same column#17934
nsivabalan merged 7 commits intoapache:masterfrom
suryaprasanna:surya-devx-05

Conversation

@suryaprasanna
Copy link
Contributor

@suryaprasanna suryaprasanna commented Jan 18, 2026

Describe the issue this Pull Request addresses

Initially, we observed partition filters being dropped in our production systems when multiple conditions were applied to the same partition column (e.g., datestr > '2016-01-01' AND datestr < '2016-12-31'). However, when creating a unit test to reproduce the issue, the filters were correctly preserved without any code changes. Since we could not reliably reproduce the issue in the test environment, this PR adds test coverage to prevent potential regressions.

Summary and Changelog

Adds testMultiplePartitionFiltersPushDown test in TestHoodiePruneFileSourcePartitions to validate that multiple partition filters (IsNotNull, GreaterThan, LessThan) on the same column are preserved during query optimization. Test covers both COW and MOR table types with range queries.

Impact

Adds test coverage to ensure partition filter correctness, helping prevent potential filter loss issues in the future. No user-facing changes.

Risk Level

none - Test-only change, no production code modifications.

Documentation Update

none

Contributor's checklist

  • Read through contributor's guide
  • Enough context is provided in the sections above
  • Adequate tests were added if applicable

@github-actions github-actions bot added the size:S PR with lines of changes in (10, 100] label Jan 18, 2026
Copy link
Member

@voonhous voonhous left a comment

Choose a reason for hiding this comment

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

Possible to add an FT for this? Thank you

Copy link
Contributor

@nsivabalan nsivabalan left a comment

Choose a reason for hiding this comment

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

thanks for the fix.
we need to add tests please.

@github-actions github-actions bot added size:M PR with lines of changes in (100, 300] and removed size:S PR with lines of changes in (10, 100] labels Feb 1, 2026
@suryaprasanna
Copy link
Contributor Author

@voonhous @nsivabalan
In our systems, we noticed partition filters getting dropped when multiple conditions are added for the same column.
Ex: Where condition like WHERE datestr >= '2025-01-01' and datestr <= '2025-01-31'.
What we noticed is filter dropped one of them,s o we removed the usage of ExpressionSet. But somehow when I created the unit test, it is working without the fix as well.
Not sure, why the error showed up in our systems. Can it because we compiled the code using Java 8 and running with Java 11?

@suryaprasanna
Copy link
Contributor Author

suryaprasanna commented Feb 1, 2026

If the build passes, then I will reword the PR to include only the unit test.

@voonhous
Copy link
Member

voonhous commented Feb 1, 2026

@voonhous @nsivabalan In our systems, we noticed partition filters getting dropped when multiple conditions are added for the same column. Ex: Where condition like WHERE datestr >= '2025-01-01' and datestr <= '2025-01-31'. What we noticed is filter dropped one of them,s o we removed the usage of ExpressionSet. But somehow when I created the unit test, it is working without the fix as well. Not sure, why the error showed up in our systems. Can it because we compiled the code using Java 8 and running with Java 11?

No idea, i was trying to reproduce this too and couldn't. Which is why i asked for a unit test to be added so i could repro it... Hmmm, nonetheless, we can change this PR to a test PR to add test coverage.

@suryaprasanna suryaprasanna changed the title fix: preserve all partition filters by removing ExpressionSet conversion test: add unit test for multiple partition filters on same column Feb 1, 2026
@suryaprasanna
Copy link
Contributor Author

@voonhous @nsivabalan I reworded the description, can you please review this again?
Thanks!


@ParameterizedTest
@CsvSource(value = Array("cow", "mor"))
def testMultiplePartitionFiltersPushDown(tableType: String): Unit = {
Copy link
Contributor

Choose a reason for hiding this comment

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

oh, can you parametrize to run this for both version 6 and 9.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, made the change.

@apache apache deleted a comment from hudi-bot Feb 10, 2026
…partition filters

When there are multiple filters on the same column (e.g., datestr > '2016-01-01' AND datestr < '2016-12-31'), using ExpressionSet to append filters and then converting back to Seq[Expression] causes some filters to be dropped. This fix removes the ExpressionSet conversion logic to preserve all partition filters.
@hudi-bot
Copy link
Collaborator

CI report:

Bot commands @hudi-bot supports the following commands:
  • @hudi-bot run azure re-run the last Azure build

@nsivabalan nsivabalan merged commit 5720910 into apache:master Feb 11, 2026
72 checks passed
@suryaprasanna suryaprasanna deleted the surya-devx-05 branch February 11, 2026 00:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M PR with lines of changes in (100, 300]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants