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.
Description
testBuild
testCompute
inside theMainTest
class.dumpToStringTwice
inside theSatTest
class.test
inside theScriptTest
class.testNestedSchema
inside theCalciteTest
class.Root Cause
All test mentioned above has been reported as flaky when run with the NonDex tool.
These tests failed because the
asserteval()
method would invoke a compile process for a hard-coded code and the compile process will eventually invoke this method:morel/src/main/java/net/hydromatic/morel/compile/Compiler.java
Line 710 in b3ce1d8
Inside the
eval
execution, methods inevalEnvOf()
will be invoked and a new object with the typeTypeMap
will be created. These methods and class utilizeHashMap
which do not guarantee elements' order. Therefore, unexpected results will be generated while testing.morel/src/main/java/net/hydromatic/morel/compile/CalciteCompiler.java
Lines 777 to 778 in b3ce1d8
morel/src/main/java/net/hydromatic/morel/compile/TypeMap.java
Lines 44 to 48 in b3ce1d8
To reproduce run:
Fix
Tests are fixed by changing
HashMap
toLinkedHashMap
which can guarantee element order and change the expected result with the correct executing order. Besides, fortestBuild
testCompute
inMainTest
class I change the matcher toequalsUnordered
to check only elements of a map instead of their orders. FordumpToStringTwice
inside theSatTest
I create an expected map and useassertEquals
to compare the tested result and the expected result.Key changed/added classes in this PR
CalciteTest.testNestedSchema
SatTest.testBuild
ScriptTest.test
MainTest.testCrossApplyGroup
MainTest.testCompute