question: protected void convertOrder ( SqlSelect select , Blackboard bb , RelCollation collation , List < SqlNode > orderExprList , SqlNode offset , SqlNode fetch ) { if ( select . getOrderList ( ) == null || select . getOrderList ( ) . getList ( ) . isEmpty ( ) ) { assert collation . getFieldCollations ( ) . isEmpty ( ) ; if ( ( offset == null || ( ( SqlLiteral ) offset ) . bigDecimalValue ( ) . equals ( BigDecimal . ZERO ) ) && fetch == null ) { return ; } } bb . setRoot ( LogicalSort . create ( bb . root , collation , offset == null ? null : convertExpression ( offset ) , fetch == null ? null : convertExpression ( fetch ) ) , false ) ; if ( orderExprList . size ( ) > 0 && ! bb . top ) { final List < RexNode > exprs = new ArrayList < > ( ) ; final RelDataType rowType = bb . root . getRowType ( ) ; final int fieldCount = rowType . getFieldCount ( ) - orderExprList . size ( ) ; for ( int i = 0 ; i < fieldCount ; i ++ ) { exprs . add ( rexBuilder . makeInputRef ( bb . root , i ) ) ; } bb . setRoot ( LogicalProject . create ( bb . root , exprs , rowType . getFieldNames ( ) . subList ( 0 , fieldCount ) ) , false ) ; } }
target:  Converts a query's ORDER BY clause, if any.