docs: private static AbstractPlanNode pushDownAggregate(AbstractPlanNode root,
                                         AggregatePlanNode distNode,
                                         AggregatePlanNode coordNode,
                                         ParsedSelectStmt selectStmt) {
          AggregatePlanNode rootAggNode;
  
          // remember that coordinating aggregation has a pushed-down
          // counterpart deeper in the plan. this allows other operators
          // to be pushed down past the receive as well.
          if (coordNode != null) {
              coordNode.m_isCoordinatingAggregator = true;
          }
  
          /*
           * Push this node down to partition if it's distributed. First remove
           * the send/receive pair, add the node, then put the send/receive pair
           * back on top of the node, followed by another top node at the
           * coordinator.
           */
          if (coordNode != null && root instanceof ReceivePlanNode) {
              AbstractPlanNode accessPlanTemp = root;
              root = accessPlanTemp.getChild(0).getChild(0);
              root.clearParents();
              accessPlanTemp.getChild(0).clearChildren();
              distNode.addAndLinkChild(root);
  
              if (selectStmt.hasPartitionColumnInGroupby()) {
                  // Set post predicate for final distributed Aggregation node
                  distNode.setPostPredicate(selectStmt.getHavingPredicate());
  
                  // Edge case: GROUP BY clause contains the partition column
                  // No related GROUP BY or even Re-agg will apply on coordinator
                  // Projection plan node can just be pushed down also except for
                  // a very edge ORDER BY case.
                  if (selectStmt.isComplexOrderBy()) {
                      // Put the send/receive pair back into place
                      accessPlanTemp.getChild(0).addAndLinkChild(distNode);
                      root = processComplexAggProjectionNode(selectStmt, accessPlanTemp);
                      return root;
                  }
  
                  root = processComplexAggProjectionNode(selectStmt, distNode);
                  // Put the send/receive pair back into place
                  accessPlanTemp.getChild(0).addAndLinkChild(root);
                  return accessPlanTemp;
              }
  
              // Without including partition column in GROUP BY clause,
              // there has to be a top GROUP BY plan node on coordinator.
              //
              // Now that we're certain the aggregate will be pushed down
              // (no turning back now!), fix any APPROX_COUNT_DISTINCT aggregates.
              fixDistributedApproxCountDistinct(distNode, coordNode);
  
              // Put the send/receive pair back into place
              accessPlanTemp.getChild(0).addAndLinkChild(distNode);
              // Add the top node
              coordNode.addAndLinkChild(accessPlanTemp);
              rootAggNode = coordNode;
          }
          else {
              distNode.addAndLinkChild(root);
              rootAggNode = distNode;
          }
  
          // Set post predicate for final Aggregation node.
          rootAggNode.setPostPredicate(selectStmt.getHavingPredicate());
          root = processComplexAggProjectionNode(selectStmt, rootAggNode);
          return root;
      }