You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (Jira)" <ji...@apache.org> on 2020/03/27 22:00:00 UTC
[jira] [Commented] (CALCITE-3883) Multiple tests can fail if
collection ordering is different than expected
[ https://issues.apache.org/jira/browse/CALCITE-3883?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17069072#comment-17069072 ]
Julian Hyde commented on CALCITE-3883:
--------------------------------------
Don't necessarily try to make things deterministic. If order doesn't matter, change the test to check for an unordered collection.
> 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: dasch
> Priority: Minor
>
> 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)