abhishekrb19 commented on code in PR #15495:
URL: https://github.com/apache/druid/pull/15495#discussion_r1425931493


##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/exec/ControllerImpl.java:
##########
@@ -2689,20 +2711,15 @@ private void startStages() throws IOException, 
InterruptedException
           }
 
           final StageId shuffleStageId = new StageId(queryDef.getQueryId(), 
shuffleStageNumber);
-          final boolean isTimeBucketed = 
isTimeBucketedIngestion(task.getQuerySpec());
-          final ClusterByPartitions partitionBoundaries =
-              queryKernel.getResultPartitionBoundariesForStage(shuffleStageId);
+          final Boolean isShuffleStageOutputEmpty = 
queryKernel.isStageOutputEmpty(shuffleStageId);
 
-          // We require some data to be inserted in case it is partitioned by 
anything other than all and we are
-          // inserting everything into a single bucket. This can be handled 
more gracefully instead of throwing an exception
-          // Note: This can also be the case when we have limit queries but 
validation in Broker SQL layer prevents such
-          // queries
-          if (isTimeBucketed && 
partitionBoundaries.equals(ClusterByPartitions.oneUniversalPartition())) {
+          if (!isFailOnEmptyInsertEnabled && 
Boolean.TRUE.equals(isShuffleStageOutputEmpty)) {

Review Comment:
   Added unit tests for `ALL` grain and `LIMIT` queries with:
   - `failOnEmptyInsert: true`  in `MSQFaultsTest`
   - `failOnEmptyInsert: false` in `MSQInsertTest` and `MSQReplaceTest`
   
   The output stage is empty (`true`) for all these cases. 
   
   `LIMIT` queries with a granularity other than `ALL` throws validation 
exception and I see existing tests 
`testInsertLimitWithPeriodGranularityThrowsException` and 
`testReplaceLimitWithPeriodGranularityThrowsException` already cover them.
   
   
   Is there a specific unknown case you can think of?



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