docs: private AbstractPlanNode getSelectSubPlanForJoinNode(JoinNode joinNode) {
          assert(joinNode != null);
          if (joinNode instanceof BranchNode) {
              BranchNode branchJoinNode = (BranchNode)joinNode;
              // Outer node
              AbstractPlanNode outerScanPlan =
                      getSelectSubPlanForJoinNode(branchJoinNode.getLeftNode());
              if (outerScanPlan == null) {
                  return null;
              }
              // Inner Node.
              AbstractPlanNode innerScanPlan =
                      getSelectSubPlanForJoinNode((branchJoinNode).getRightNode());
              if (innerScanPlan == null) {
                  return null;
              }
              // Join Node
              IndexSortablePlanNode answer = getSelectSubPlanForJoin(branchJoinNode,
                                                                outerScanPlan,
                                                                innerScanPlan);
              // Propagate information used for order by clauses in window functions
              // and the statement level order by clause.  This is only if the
              // branch node is an inner join.
              if ((answer != null)
                      && (branchJoinNode.getJoinType() == JoinType.INNER)
                      && outerScanPlan instanceof IndexSortablePlanNode) {
                  IndexUseForOrderBy indexUseForJoin = answer.indexUse();
                  IndexUseForOrderBy indexUseFromScan = ((IndexSortablePlanNode)outerScanPlan).indexUse();
                  indexUseForJoin.setWindowFunctionUsesIndex(indexUseFromScan.getWindowFunctionUsesIndex());
                  indexUseForJoin.setWindowFunctionIsCompatibleWithOrderBy(indexUseFromScan.isWindowFunctionCompatibleWithOrderBy());
                  indexUseForJoin.setFinalExpressionOrderFromIndexScan(indexUseFromScan.getFinalExpressionOrderFromIndexScan());
                  indexUseForJoin.setSortOrderFromIndexScan(indexUseFromScan.getSortOrderFromIndexScan());
              }
              if (answer == null) {
                  return null;
              }
              return answer.planNode();
          }
  
          // End of recursion
          AbstractPlanNode scanNode = getAccessPlanForTable(joinNode);
          // Connect the sub-query tree if any
          if (joinNode instanceof SubqueryLeafNode) {
              StmtSubqueryScan tableScan = ((SubqueryLeafNode)joinNode).getSubqueryScan();
              CompiledPlan subQueryPlan = tableScan.getBestCostPlan();
              assert(subQueryPlan != null);
              assert(subQueryPlan.rootPlanGraph != null);
              // The sub-query best cost plan needs to be un-linked from the previous parent plan
              // it's the same child plan that gets re-attached to many parents one at a time
              subQueryPlan.rootPlanGraph.disconnectParents();
              scanNode.addAndLinkChild(subQueryPlan.rootPlanGraph);
          }
          return scanNode;
      }