I have not committed the patch because I ran into trouble when I ran the lang._Suite.
The behavior is that the expected row count for some of the test cases is different when run in the suite, and also, it seemed that the expanded test caused failures in the test OptimizerOverridesTest, even though all three tests use CleanDatabaseSetup.
To overcome the failures in the OptimizerOverridesTest, I changed the name of the table used in SelectivityTest from 'test' (which was also used in OptimizerOverridesTest), to 'seltest', and that seemed to do the trick for that issue.
I debugged the other failures to where if the test GroupByExpressionTest is run before the expanded SelectivityTest, there is a failure after the following query:
s.executeQuery("select template.id from " +
"--DERBY-PROPERTIES joinOrder=fixed \n" +
"seltest, template --DERBY-PROPERTIES joinStrategy=hash, " +
"index=null \n" +
"where seltest.twenty = template.twenty " +
"and seltest.two = template.two").close();
and in 3 other places.
I thought the difference in estimated rowcount might be dependent on the name of the table also, because GroupByExpressionsTest also used table name 'test', but even after the change of the table name to 'seltest; in the SelectivityTest, this failure still occurred. I eliminated things from the GroupByExpressionsTest until I get this error when the only thing happening in the GroupByExpressionsTest is the creation of the 3 tables 'test', 'coal', and 'AllTypes'. If any of these 3 are eliminated, the error does not occur.
Does anyone have a suggestion of how to prevent the earlier test from affecting the estimated rowcount in the later test?