[hotfix] Fixing flaky tests in flink-table-planner /hints #25486
+18
−18
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What is the purpose of the change
This fix is intended to fix flaky tests in the following classes -
org.apache.flink.table.planner.hint.ClearJoinHintsWithCapitalizeQueryHintsShuttleTest
org.apache.flink.table.planner.hint.ClearLookupJoinHintsWithInvalidPropagationShuttleTest
For example, when the following command is run on one of these tests using the Nondex plugin -
mvn -pl flink-table/flink-table-planner edu.illinois:nondex-maven-plugin:2.1.7:nondex -Dtest=org.apache.flink.table.planner.hint.ClearJoinHintsWithCapitalizeQueryHintsShuttleTest
This error is thrown.
This flakiness presents itself because the test is doing a direct string comparison over String forms of objects. Since the hintOptions required for these tests are stored in a map (
org.apache.flink.table.planner.plan.nodes.exec.spec.LookupJoinHintTestUtil#getLookupJoinHintOptions
), their ordering is non-deterministic, and thus leads to these tests intermittently failing. Furthermore, the examples that were used to compare these tests with (in filesflink-table/flink-table-planner/src/test/resources/org/apache/flink/table/planner/hint/ClearJoinHintsWithCapitalizeQueryHintsShuttleTest.xml
andflink-table/flink-table-planner/src/test/resources/org/apache/flink/table/planner/hint/ClearJoinHintsWithCapitalizeQueryHintsShuttleTest.xml
do not have consistent ordering for hintOptions.The following tests have been fixed with this change -
org.apache.flink.table.planner.hint.ClearJoinHintsWithCapitalizeQueryHintsShuttleTest#testClearCaseInsensitiveLookupHint
org.apache.flink.table.planner.hint.ClearLookupJoinHintsWithInvalidPropagationShuttleTest#testNoNeedToClearLookupHint
org.apache.flink.table.planner.hint.ClearLookupJoinHintsWithInvalidPropagationShuttleTest#testClearLookupHintWithInvalidPropagationToSubQuery
org.apache.flink.table.planner.hint.ClearLookupJoinHintsWithInvalidPropagationShuttleTest#testNoNeedToClearLookupHintWhileJoinWithUnnest
org.apache.flink.table.planner.hint.ClearLookupJoinHintsWithInvalidPropagationShuttleTest#testNoNeedToClearLookupHintWhileJoinWithUDTF
Brief change log
org.apache.flink.table.planner.plan.nodes.exec.spec.LookupJoinHintTestUtil#getLookupJoinHintOptions
) have been changed to use a LinkedHashMap instead of a HashMap, which will preserve insertion order.flink-table/flink-table-planner/src/test/resources/org/apache/flink/table/planner/hint/ClearJoinHintsWithCapitalizeQueryHintsShuttleTest.xml
andflink-table/flink-table-planner/src/test/resources/org/apache/flink/table/planner/hint/ClearLookupJoinHintsWithInvalidPropagationShuttleTest.xml
have been amended to have a consistent ordering for hint options.Verifying this change
Please make sure both new and modified tests in this PR follow the conventions for tests defined in our code quality guide.
This change added tests and can be verified as follows:
Does this pull request potentially affect one of the following parts:
@Public(Evolving)
: (no)Documentation