From 5ebd4cfd1262c9b9e9125110d369c4706f7153bc Mon Sep 17 00:00:00 2001 From: Frank Chen Date: Sun, 2 Aug 2026 21:35:43 +0800 Subject: [PATCH] test(processing): avoid flaky incremental index cursor ordering --- .../IncrementalIndexCursorFactoryTest.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/processing/src/test/java/org/apache/druid/segment/incremental/IncrementalIndexCursorFactoryTest.java b/processing/src/test/java/org/apache/druid/segment/incremental/IncrementalIndexCursorFactoryTest.java index 9a447dd39e0c..cfd89f73eaf5 100644 --- a/processing/src/test/java/org/apache/druid/segment/incremental/IncrementalIndexCursorFactoryTest.java +++ b/processing/src/test/java/org/apache/druid/segment/incremental/IncrementalIndexCursorFactoryTest.java @@ -232,11 +232,14 @@ public void testSanity() throws Exception Assert.assertEquals(2, results.size()); - ResultRow row = results.get(0); - Assert.assertArrayEquals(new Object[]{null, "bo", 1L}, row.getArray()); - - row = results.get(1); - Assert.assertArrayEquals(new Object[]{"hi", null, 1L}, row.getArray()); + // GroupingEngine.process returns raw grouped results without applying the query's order-by post-processing. + // The result order is therefore not guaranteed when the incremental index is not sorted by dimensions. + Assert.assertTrue( + results.stream().anyMatch(row -> Arrays.deepEquals(new Object[]{null, "bo", 1L}, row.getArray())) + ); + Assert.assertTrue( + results.stream().anyMatch(row -> Arrays.deepEquals(new Object[]{"hi", null, 1L}, row.getArray())) + ); } @Test