raghavyadav01 commented on code in PR #20002:
URL: https://github.com/apache/pinot/pull/20002#discussion_r4364527447


##########
pinot-segment-local/src/test/java/org/apache/pinot/segment/local/realtime/converter/RealtimeSegmentConverterTest.java:
##########
@@ -1641,6 +1641,121 @@ public void 
testRangeIndexOnIngestionAggregatedNoDictColumn()
     }
   }
 
+  @DataProvider
+  public static Object[][] noDictSortedAggregationKeyParams() {
+    List<Object[]> params = new ArrayList<>();
+    for (DataType dataType : new DataType[]{DataType.INT, DataType.LONG, 
DataType.STRING, DataType.BYTES}) {
+      params.add(new Object[]{dataType, false});  // row-major segment builder
+      params.add(new Object[]{dataType, true});   // column-major segment 
builder
+    }
+    return params.toArray(new Object[0][]);
+  }
+
+  /// A sorted DIMENSION column configured as no-dictionary gets no inverted 
index in the consuming segment, but
+  /// ingestion aggregation forces a dictionary on it because it is part of 
the aggregation key. The sort step at seal
+  /// time used to take the inverted-index path because the column had a 
dictionary, and failed with an NPE. This
+  /// test verifies that the segment builds, the rows aggregate, and the 
sorted column stays sorted and raw.
+  @Test(dataProvider = "noDictSortedAggregationKeyParams")
+  public void testNoDictSortedColumnAsIngestionAggregationKey(DataType 
dataType, boolean columnMajorSegmentBuilder)
+      throws Exception {
+    File tmpDir = new File(TMP_DIR,
+        "tmp_sorted_agg_" + dataType + "_" + columnMajorSegmentBuilder + "_" + 
System.nanoTime());
+    String sortedColumn = "sorted_col";
+    List<AggregationConfig> aggregationConfigs =
+        List.of(new AggregationConfig(LONG_COLUMN4, "SUM(" + LONG_COLUMN4 + 
")"));
+    IngestionConfig ingestionConfig = new IngestionConfig();
+    ingestionConfig.setAggregationConfigs(aggregationConfigs);

Review Comment:
   The description says legacy `aggregateMetrics` hits the same NPE. Should we 
add that case to the data provider too?



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to