Source:
<code>private static boolean isOrderByNodeRequired(AbstractParsedStmt parsedStmt, AbstractPlanNode root) { if ( ! parsedStmt.hasOrderByColumns()) { return false; } AbstractPlanNode nonAggPlan; int numberWindowFunctions = 0; int numberReceiveNodes = 0; int numberHashAggregates = 0; AbstractPlanNode probe; for (probe = root; ! ((probe instanceof AbstractJoinPlanNode) || (probe instanceof AbstractScanPlanNode)) && (probe != null); probe = (probe.getChildCount() > 0) ? probe.getChild(0) : null) { if (probe.getPlanNodeType() == PlanNodeType.WINDOWFUNCTION) { numberWindowFunctions += 1; } if (probe.getPlanNodeType() == PlanNodeType.RECEIVE) { numberReceiveNodes += 1; } if ((probe.getPlanNodeType() == PlanNodeType.HASHAGGREGATE) || (probe.getPlanNodeType() == PlanNodeType.PARTIALAGGREGATE)) { numberHashAggregates += 1; } } if (probe != null) { nonAggPlan = probe; <START> } else { <END> nonAggPlan = root; return true; } if (nonAggPlan.getSortOrderFromIndexScan() == SortDirectionType.INVALID) { return true; } if (numberHashAggregates > 0) { return true; } if ( numberWindowFunctions == 0 ) { if ( nonAggPlan.getWindowFunctionUsesIndex() == SubPlanAssembler.NO_INDEX_USE ) { return true; } assert( nonAggPlan.getWindowFunctionUsesIndex() == SubPlanAssembler.STATEMENT_LEVEL_ORDER_BY_INDEX ); return numberReceiveNodes > 0; } else if (numberWindowFunctions == 1) { if ( ( nonAggPlan.getWindowFunctionUsesIndex() != 0 ) || ( ! nonAggPlan.isWindowFunctionCompatibleWithOrderBy() ) ) { return true; } return false; } else { return true; } }</code><technical_language>existing code in this module pretty evenly split "} else {" "else {"-on-its-own-line. style is mentioned a preference in a coding conventions section github wiki page discussing Eclipse setup for java -- mentioned in official github wiki page code conventions. Chris I agreed prefer convention, I opportunistically migrating code it. if stop paddling in direction</technical_language>

Target:
private static boolean isOrderByNodeRequired(AbstractParsedStmt parsedStmt, AbstractPlanNode root) { if ( ! parsedStmt.hasOrderByColumns()) { return false; } int numberWindowFunctions = 0; int numberReceiveNodes = 0; int numberHashAggregates = 0; AbstractPlanNode probe; for (probe = root; ! ((probe instanceof AbstractJoinPlanNode) || (probe instanceof AbstractScanPlanNode)) && (probe != null); probe = (probe.getChildCount() > 0) ? probe.getChild(0) : null) { if (probe.getPlanNodeType() == PlanNodeType.WINDOWFUNCTION) { numberWindowFunctions += 1; } if (probe.getPlanNodeType() == PlanNodeType.RECEIVE) { numberReceiveNodes += 1; } if ((probe.getPlanNodeType() == PlanNodeType.HASHAGGREGATE) || (probe.getPlanNodeType() == PlanNodeType.PARTIALAGGREGATE)) { numberHashAggregates += 1; } } if (probe == null) { return true; } if ( ! (probe instanceof IndexSortablePlanNode)) { return true; } IndexUseForOrderBy indexUse = ((IndexSortablePlanNode)probe).indexUse(); if (indexUse.getSortOrderFromIndexScan() == SortDirectionType.INVALID) { return true; } if (numberHashAggregates > 0) { return true; } if ( numberWindowFunctions == 0 ) { if ( indexUse.getWindowFunctionUsesIndex() == SubPlanAssembler.NO_INDEX_USE ) { return true; } assert( indexUse.getWindowFunctionUsesIndex() == SubPlanAssembler.STATEMENT_LEVEL_ORDER_BY_INDEX ); return numberReceiveNodes > 0; } if (numberWindowFunctions == 1) { if ( ( indexUse.getWindowFunctionUsesIndex() != 0 ) || ( ! indexUse.isWindowFunctionCompatibleWithOrderBy() ) ) { return true; } return false; } return true; }