gortiz commented on code in PR #19121:
URL: https://github.com/apache/pinot/pull/19121#discussion_r4707853095
##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/plan/server/ServerPlanRequestVisitor.java:
##########
@@ -337,6 +352,41 @@ public Void visitUnnest(UnnestNode node,
ServerPlanRequestContext context) {
return null;
}
+ /// An unbounded sort can be folded into the V1 request only when the leaf
runs exactly one physical request: a V1
+ /// ORDER BY then yields one sorted run per worker, whichever combine V1
picks. `sortedSelectionMergeMode` does not
+ /// affect that ordering; it is the opt-in, and when it streams (ON, or AUTO
resolving to ON over sorted segments) the
+ /// leaf no longer materializes every row. The sort itself must have no
offset, every sort key must be a plain column
+ /// (so the leaf's conversion to the MSE type cannot reorder V1's output),
and nothing below the sort may already have
+ /// set an ORDER BY, OFFSET or a narrower LIMIT, which the pushed sort would
overwrite.
+ private static boolean canPushUnboundedSort(SortNode node, PinotQuery
pinotQuery,
+ ServerPlanRequestContext context) {
+ if (!context.isSinglePhysicalRequest() ||
!context.isSortedSelectionMergeRequested() || node.getOffset() > 0
Review Comment:
+1 to this. I'd push the sort into V1 only for ON for now. AUTO can come
back once its sorted-ratio check runs before the decision, or once the V1
combine has a k-way merge for unbounded limits.
--
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]