Akshat-Jain commented on code in PR #16781: URL: https://github.com/apache/druid/pull/16781#discussion_r1687729479
########## extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/WindowOperatorQueryKit.java: ########## @@ -230,6 +229,13 @@ public QueryDefinition makeQueryDefinition( partitionColumnNames ); + // We need to pass only the window factories for the window stage definition. + // Sorting and partitioning are expected to be handled by the shuffle spec of the previous stage. + final List<OperatorFactory> windowOperatorList = operatorList.get(i) + .stream() + .filter(operator -> operator instanceof WindowOperatorFactory) Review Comment: Currently, we are passing incorrect shuffle spec, and then explicitly passing sort+partition operators. So we're doing unnecessary additional work. This PR fixes the shuffle spec, and removes the sort+partition operators. > there are benefits of further partitioning an existing sort; and that's rather cheap.... Right now, MSQ creates the stages based on the list of operator factories we get from `Windowing.java` layer. So logic chance for optimisation like this should happen there IIUC? So it feels unrelated to this PR to me. ########## extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/WindowOperatorQueryKit.java: ########## @@ -230,6 +229,13 @@ public QueryDefinition makeQueryDefinition( partitionColumnNames ); + // We need to pass only the window factories for the window stage definition. + // Sorting and partitioning are expected to be handled by the shuffle spec of the previous stage. + final List<OperatorFactory> windowOperatorList = operatorList.get(i) + .stream() + .filter(operator -> operator instanceof WindowOperatorFactory) Review Comment: Please correct me if I'm wrong though, thanks! -- 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: commits-unsubscr...@druid.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For additional commands, e-mail: commits-h...@druid.apache.org