Drew Schmitt created CALCITE-3883:
-------------------------------------
Summary: Multiple tests can fail if collection ordering is
different than expected
Key: CALCITE-3883
URL: https://issues.apache.org/jira/browse/CALCITE-3883
Project: Calcite
Issue Type: Bug
Reporter: Drew Schmitt
Multiple tests across at least two components (e.g. core and linq4j) can fail
if collection ordering (but not contents) is different than expected. Below are
a subset of the failing tests. In total, I'm seeing 21 failing tests in core
and 4 failing tests in linq4j.
For example, org.apache.calcite.test.SqlFunctionsTest's testMultiset:
FAILURE 0.1sec, org.apache.calcite.test.SqlFunctionsTest > testMultiset()
java.lang.AssertionError:
Expected: is <[b, e]>
but: was <[e, b]>
at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:18)
at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:6)
at
org.apache.calcite.test.SqlFunctionsTest.testMultiset(SqlFunctionsTest.java:906)
This failure is coming from:
assertThat(SqlFunctions.multisetExceptDistinct(abacee, addc),
is(Arrays.asList("b", "e")));
which is calling into the following function:
public static <E> Collection<E> multisetExceptDistinct(Collection<E> c1,
Collection<E> c2) {
final Set<E> result = new HashSet<>(c1);
result.removeAll(c2);
return new ArrayList<>(result);
}
Another example is org.apache.calcite.linq4j.test.Linq4jTest's
testGroupByWithKeySelectorAndElementSelector:
FAILURE 0.0sec, org.apache.calcite.linq4j.test.Linq4jTest >
testGroupByWithKeySelectorAndElementSelector()
java.lang.AssertionError:
Expected: is "[10: Fred+Eric+Janet, 30: Bill]"
but: was "[30: Bill, 10: Fred+Eric+Janet]"
at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:18)
at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:6)
at
org.apache.calcite.linq4j.test.Linq4jTest.testGroupByWithKeySelectorAndElementSelector(Linq4jTest.java:1949)
This failure is generated from:
assertThat(s, is("[10: Fred+Eric+Janet, 30: Bill]"));
This behavior may have similarities with the issue reported in
https://issues.apache.org/jira/browse/CALCITE-3389.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)