gortiz commented on code in PR #17576:
URL: https://github.com/apache/pinot/pull/17576#discussion_r2770157092
##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/InStageStatsTreeBuilder.java:
##########
@@ -139,6 +164,45 @@ private long getChildrenStat(MultiStageOperator.Type type,
JsonNode[] children,
.sum();
}
+ @Nullable
+ private ObjectNode extractPipelineBreakerResult(BasePlanNode node, Context
context) {
+ MailboxReceiveNode pipelineBreakerNode = getPipelineBreakerNode(node);
+ if (pipelineBreakerNode == null) {
+ return null;
+ }
+ _index--;
+ return visitMailboxReceive(pipelineBreakerNode, context);
+ }
+
+ @Nullable
+ private MailboxReceiveNode getPipelineBreakerNode(BasePlanNode node) {
+ if (_index == 0) {
+ return null;
+ }
+ MultiStageOperator.Type nextOperatorType =
_stageStats.getOperatorType(_index - 1);
+ if (nextOperatorType != MultiStageOperator.Type.PIPELINE_BREAKER) {
+ // even if the plan may say there is a pipeline breaker, the stats do
not have it
+ return null;
+ }
+ // This code assumes there is a single pipeline breaker in the stage,
which is true for now.
+ ArrayList<PlanNode> nodeStack = new ArrayList<>(1);
+ nodeStack.add(node);
+ while (!nodeStack.isEmpty()) {
+ PlanNode currentNode = nodeStack.remove(nodeStack.size() - 1);
+ if (currentNode instanceof JoinNode) {
+ JoinNode joinNode = (JoinNode) currentNode;
+ if (joinNode.getInputs().size() > 1 && joinNode.getJoinType() ==
JoinRelType.SEMI) {
Review Comment:
I've added anti-joins as well. Anyway, the more I have to touch this code,
the less reliable the algorithm looks to me. We should modify this in the
future. The stats themselves should include the operator relations, so we don't
need to reconstruct that here.
--
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]