private static AbstractPlanNode handleOrderBy ( AbstractParsedStmt parsedStmt , AbstractPlanNode root ) { assert ( parsedStmt instanceof ParsedSelectStmt || parsedStmt instanceof ParsedUnionStmt || parsedStmt instanceof ParsedDeleteStmt ) ; if ( ! isOrderByNodeRequired ( parsedStmt , root ) ) { return root ; } OrderByPlanNode orderByNode = buildOrderByPlanNode ( parsedStmt . orderByColumns ( ) ) ; orderByNode . addAndLinkChild ( root ) ; return orderByNode ; }
Create an order by node as required by the statement and make it a parent of root .