private Comparator<Object> getComparator( Object lhs, Object rhs ) { Class type = lhs != null ? lhs.getClass() : null; type = type == null && rhs != null ? rhs.getClass() : type; Comparator comparator = tupleSerialization.getComparator( type ); if( comparator instanceof StreamComparator ) return new TupleElementStreamComparator( (StreamComparator) comparator ); return new TupleElementComparator( comparator ); }
private Comparator<Object> getComparator( Object lhs, Object rhs ) { Class type = lhs != null ? lhs.getClass() : null; type = type == null && rhs != null ? rhs.getClass() : type; Comparator comparator = tupleSerialization.getComparator( type ); if( comparator instanceof StreamComparator ) return new TupleElementStreamComparator( (StreamComparator) comparator ); return new TupleElementComparator( comparator ); }
comparators[ i ] = new TupleElementStreamComparator( (StreamComparator) fieldComparators[ i ] ); else if( fieldComparators[ i ] != null ) comparators[ i ] = new TupleElementComparator( fieldComparators[ i ] ); else comparators[ i ] = new DelegatingTupleElementComparator( tupleSerialization ); // lazy lookup
comparators[ i ] = new TupleElementStreamComparator( (StreamComparator) fieldComparators[ i ] ); else if( fieldComparators[ i ] != null ) comparators[ i ] = new TupleElementComparator( fieldComparators[ i ] ); else comparators[ i ] = new DelegatingTupleElementComparator( tupleSerialization ); // lazy lookup
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 ); } } }