You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ro...@apache.org on 2023/11/20 23:56:05 UTC

(pinot) branch master updated: fix flakyness by replacing HashSet and HashMap with LinkedHashSet and LinkedHashMap (#11941)

This is an automated email from the ASF dual-hosted git repository.

rongr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new 2c88c4f74d fix flakyness by replacing HashSet and HashMap with LinkedHashSet and LinkedHashMap (#11941)
2c88c4f74d is described below

commit 2c88c4f74d9e74984b284298b76a855f42e7cc61
Author: Yuxuan Guo <gu...@gmail.com>
AuthorDate: Mon Nov 20 17:55:56 2023 -0600

    fix flakyness by replacing HashSet and HashMap with LinkedHashSet and LinkedHashMap (#11941)
    
    * fix flakyness by replacing HashSet and HashMap with LinkedHashSet and LinkedHashMap
    * fix by sorting PROJECT field
    
    ---------
    
    Co-authored-by: yuxuang6 <yu...@fa23-cs527-090.cs.illinois.edu>
---
 .../pinot/queries/ExplainPlanQueriesTest.java      |  2 +-
 .../org/apache/pinot/queries/QueriesTestUtils.java | 25 ++++++++++++++++++++++
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/pinot-core/src/test/java/org/apache/pinot/queries/ExplainPlanQueriesTest.java b/pinot-core/src/test/java/org/apache/pinot/queries/ExplainPlanQueriesTest.java
index d68b4fb1ce..73f6f7dcd1 100644
--- a/pinot-core/src/test/java/org/apache/pinot/queries/ExplainPlanQueriesTest.java
+++ b/pinot-core/src/test/java/org/apache/pinot/queries/ExplainPlanQueriesTest.java
@@ -416,7 +416,7 @@ public class ExplainPlanQueriesTest extends BaseQueriesTest {
         _brokerReduceService.reduceOnDataTable(brokerRequest, brokerRequest, dataTableMap,
             CommonConstants.Broker.DEFAULT_BROKER_TIMEOUT_MS, null);
 
-    QueriesTestUtils.testInterSegmentsResult(brokerResponse, expected);
+    QueriesTestUtils.testExplainSegmentsResult(brokerResponse, expected);
   }
 
   private ServerQueryRequest getQueryRequest(InstanceRequest instanceRequest) {
diff --git a/pinot-core/src/test/java/org/apache/pinot/queries/QueriesTestUtils.java b/pinot-core/src/test/java/org/apache/pinot/queries/QueriesTestUtils.java
index af227f5663..f98ae81afd 100644
--- a/pinot-core/src/test/java/org/apache/pinot/queries/QueriesTestUtils.java
+++ b/pinot-core/src/test/java/org/apache/pinot/queries/QueriesTestUtils.java
@@ -90,6 +90,11 @@ public class QueriesTestUtils {
     validateRows(brokerResponse.getResultTable().getRows(), expectedRows);
   }
 
+  public static void testExplainSegmentsResult(BrokerResponseNative brokerResponse, ResultTable expectedResultTable) {
+    assertEquals(brokerResponse.getResultTable().getDataSchema(), expectedResultTable.getDataSchema());
+    validateExplainedRows(brokerResponse.getResultTable().getRows(), expectedResultTable.getRows());
+  }
+
   public static void testInterSegmentsResult(BrokerResponseNative brokerResponse, ResultTable expectedResultTable) {
     validateResultTable(brokerResponse.getResultTable(), expectedResultTable);
   }
@@ -130,6 +135,26 @@ public class QueriesTestUtils {
     validateRows(actual.getRows(), expected.getRows());
   }
 
+  private static void validateExplainedRows(List<Object[]> actual, List<Object[]> expected) {
+    assertEquals(actual.size(), expected.size());
+    // Sorting here to eliminate the nondeternism of nested sql calls
+    for (int j = 0; j < actual.size(); j++) {
+      Object[] act = actual.get(j);
+      Object[] exp = expected.get(j);
+      String attributeToSort = "PROJECT";
+      assertEquals(act.length, exp.length);
+      if (act[0].toString().startsWith(attributeToSort)) {
+        char[] act0 = act[0].toString().toCharArray();
+        char[] exp0 = exp[0].toString().toCharArray();
+        Arrays.sort(act0);
+        Arrays.sort(exp0);
+        act[0] = new String(act0);
+        exp[0] = new String(exp0);
+      }
+      assertEquals(act, exp);
+    }
+  }
+
   private static void validateRows(List<Object[]> actual, List<Object[]> expected) {
     assertEquals(actual.size(), expected.size());
     for (int i = 0; i < actual.size(); i++) {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org