public SplitDataProperties < T > splitsOrderedBy ( int [ ] orderFields , Order [ ] orders ) { if ( orderFields == null || orders == null ) { throw new InvalidProgramException ( "OrderFields or Orders may not be null." ) ; } else if ( orderFields . length == 0 ) { throw new InvalidProgramException ( "OrderFields may not be empty." ) ; } else if ( orders . length == 0 ) { throw new InvalidProgramException ( "Orders may not be empty" ) ; } else if ( orderFields . length != orders . length ) { throw new InvalidProgramException ( "Number of OrderFields and Orders must match." ) ; } if ( this . splitGroupKeys != null ) { throw new InvalidProgramException ( "DataSource may either be grouped or sorted." ) ; } this . splitOrdering = new Ordering ( ) ; for ( int i = 0 ; i < orderFields . length ; i ++ ) { int pos = orderFields [ i ] ; int [ ] flatKeys = this . getAllFlatKeys ( new int [ ] { pos } ) ; for ( int key : flatKeys ) { // check for duplicates for ( int okey : splitOrdering . getFieldPositions ( ) ) { if ( key == okey ) { throw new InvalidProgramException ( "Duplicate field in the field expression " + pos ) ; } } // append key this . splitOrdering . appendOrdering ( key , null , orders [ i ] ) ; } } return this ; }
Defines that the data within an input split is sorted on the fields defined by the field positions in the specified orders . All records of an input split must be emitted by the input format in the defined order .