private StreamComparator getComparator( TupleInputStream lhsStream ) { try { lhsStream.mark( 4 * 1024 ); Comparator foundComparator = lhsStream.getComparatorFor( lhsStream.readToken() ); // grab the configured default comparator, its ok if its null, just wasn't configured externally if( foundComparator == null ) foundComparator = tupleSerialization.getDefaultComparator(); if( foundComparator instanceof StreamComparator ) return new TupleElementStreamComparator( (StreamComparator) foundComparator ); else return new TupleElementComparator( foundComparator ); } catch( IOException exception ) { throw new CascadingException( exception ); } finally { try { lhsStream.reset(); } catch( IOException exception ) { throw new CascadingException( exception ); } } }
private StreamComparator getComparator( TupleInputStream lhsStream ) { try { lhsStream.mark( 4 * 1024 ); Comparator foundComparator = lhsStream.getComparatorFor( lhsStream.readToken() ); // grab the configured default comparator, its ok if its null, just wasn't configured externally if( foundComparator == null ) foundComparator = tupleSerialization.getDefaultComparator(); if( foundComparator instanceof StreamComparator ) return new TupleElementStreamComparator( (StreamComparator) foundComparator ); else return new TupleElementComparator( foundComparator ); } catch( IOException exception ) { throw new CascadingException( exception ); } finally { try { lhsStream.reset(); } catch( IOException exception ) { throw new CascadingException( exception ); } } }