xiangfu0 commented on code in PR #18724:
URL: https://github.com/apache/pinot/pull/18724#discussion_r3388168362


##########
pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/realtimetoofflinesegments/RealtimeToOfflineSegmentsTaskGenerator.java:
##########
@@ -337,20 +339,27 @@ public void validateTaskConfigs(TableConfig tableConfig, 
Schema schema, Map<Stri
     Set<String> columnNames = schema.getColumnNames();
     for (Map.Entry<String, String> entry : taskConfigs.entrySet()) {
       if (entry.getKey().endsWith(".aggregationType")) {
-        Preconditions.checkState(columnNames.contains(
-                StringUtils.removeEnd(entry.getKey(), 
RealtimeToOfflineSegmentsTask.AGGREGATION_TYPE_KEY_SUFFIX)),
-            String.format("Column \"%s\" not found in schema!", 
entry.getKey()));
+        String column =
+            StringUtils.removeEnd(entry.getKey(), 
RealtimeToOfflineSegmentsTask.AGGREGATION_TYPE_KEY_SUFFIX);
+        Preconditions.checkState(columnNames.contains(column),
+            String.format("Column \"%s\" not found in schema!", column));
+        AggregationFunctionType aft;
         try {
           // check that it's a valid aggregation function type
-          AggregationFunctionType aft = 
AggregationFunctionType.getAggregationFunctionType(entry.getValue());
+          aft = MergeTaskUtils.getAggregationFunctionType(entry.getValue());
           // check that a value aggregator is available
           if 
(!MinionConstants.RealtimeToOfflineSegmentsTask.AVAILABLE_CORE_VALUE_AGGREGATORS.contains(aft))
 {
             throw new IllegalArgumentException("ValueAggregator not enabled 
for type: " + aft.toString());
           }
         } catch (IllegalArgumentException e) {
-          String err =
-              String.format("Column \"%s\" has invalid aggregate type: %s", 
entry.getKey(), entry.getValue());
-          throw new IllegalStateException(err);
+          String err = String.format("Column \"%s\" has invalid aggregate 
type: %s", column, entry.getValue());
+          throw new IllegalStateException(err, e);
+        }
+        if (aft == AggregationFunctionType.FIRSTWITHTIME || aft == 
AggregationFunctionType.LASTWITHTIME) {

Review Comment:
   This validation only checks that `first` / `last` target a metric column. It 
still accepts configs with no usable time column, but the minion reducer now 
throws later when `FIRSTWITHTIME` / `LASTWITHTIME` run without the 
original-time sort field. That means the controller can schedule a task that is 
guaranteed to fail at runtime. Please mirror the MergeRollup guard here and 
reject these aggregation types unless the table has a resolvable EPOCH time 
column up front.



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