rubenada commented on a change in pull request #1575: [CALCITE-3498] Unnest operation's ordinality should be deterministic URL: https://github.com/apache/calcite/pull/1575#discussion_r346192777
########## File path: core/src/test/java/org/apache/calcite/test/JdbcTest.java ########## @@ -2188,9 +2188,32 @@ private static void checkJoinNWay(int n) { + " UNNEST(d.\"employees\", array[1, 2]) with ordinality as e (ei, d, n, s, c, i, o)\n" + "where ei + i > 151") .returnsUnordered( - "name=HR; EI=200; D=20; N=Eric; S=8000.0; C=500; I=1; O=2", - "name=HR; EI=200; D=20; N=Eric; S=8000.0; C=500; I=2; O=4", - "name=Sales; EI=150; D=10; N=Sebastian; S=7000.0; C=null; I=2; O=5"); + "name=HR; EI=200; D=20; N=Eric; S=8000.0; C=500; I=1; O=1", + "name=HR; EI=200; D=20; N=Eric; S=8000.0; C=500; I=2; O=2", + "name=Sales; EI=150; D=10; N=Sebastian; S=7000.0; C=null; I=2; O=4"); + } + + /** Test case for + * <a href="https://issues.apache.org/jira/browse/CALCITE-3498">[CALCITE-3498] + * Unnest operation's ordinality should be deterministic</a>. */ + @Test public void testUnnestArrayWithDeterministicOrdinality2() { + CalciteAssert.that() + .query("select v, o\n" + + "from unnest(array[100, 200]) with ordinality as t1(v, o)\n" + + "where v > 1") + .returnsUnordered( Review comment: Sorry @DonnyZone , I was not very specific on my previous comment. I think `returns` can only be used on the first test: `unnest(array[100, 200]) with ordinality as t1(v, o)`; in the second one, since there is a JOIN involved (with no ORDER BY), I believe order cannot be guaranteed, so in that case `returnsUnordered` would be safer. Do you agree? Sorry for the inconvenience. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services