@Override public int compare( BufferedInputStream lhsStream, BufferedInputStream rhsStream ) { if( lhsStream == null && rhsStream == null ) return 0; if( lhsStream == null ) return !reverse ? -1 : 1; if( rhsStream == null ) return !reverse ? 1 : -1; HadoopTupleInputStream lhsInput = new HadoopTupleInputStream( lhsStream, new TupleSerialization().getElementReader() ); HadoopTupleInputStream rhsInput = new HadoopTupleInputStream( rhsStream, new TupleSerialization().getElementReader() ); try { // explicit for debugging purposes Long l1 = (Long) lhsInput.readVLong(); Long l2 = (Long) rhsInput.readVLong(); return reverse ? l2.compareTo( l1 ) : l1.compareTo( l2 ); } catch( Exception exception ) { throw new CascadingException( exception ); } }
@Override public int compare( BufferedInputStream lhsStream, BufferedInputStream rhsStream ) { if( lhsStream == null && rhsStream == null ) return 0; if( lhsStream == null ) return !reverse ? -1 : 1; if( rhsStream == null ) return !reverse ? 1 : -1; HadoopTupleInputStream lhsInput = new HadoopTupleInputStream( lhsStream, new TupleSerialization().getElementReader() ); HadoopTupleInputStream rhsInput = new HadoopTupleInputStream( rhsStream, new TupleSerialization().getElementReader() ); try { // explicit for debugging purposes Long l1 = (Long) lhsInput.readVLong(); Long l2 = (Long) rhsInput.readVLong(); return reverse ? l2.compareTo( l1 ) : l1.compareTo( l2 ); } catch( Exception exception ) { throw new CascadingException( exception ); } }
protected final Object readType( int type ) throws IOException { switch( type ) { case 0: return null; case 1: return readString(); case 2: return readFloat(); case 3: return readDouble(); case 4: return readVInt(); case 5: return readVLong(); case 6: return readBoolean(); case 7: return readShort(); case 8: return readTuple(); case 9: return readTuplePair(); case 10: return readIndexTuple(); default: return elementReader.read( type, this ); } }
protected final Object readType( int type ) throws IOException { switch( type ) { case 0: return null; case 1: return readString(); case 2: return readFloat(); case 3: return readDouble(); case 4: return readVInt(); case 5: return readVLong(); case 6: return readBoolean(); case 7: return readShort(); case 8: return readTuple(); case 9: return readTuplePair(); case 10: return readIndexTuple(); default: return elementReader.read( type, this ); } }
return readVInt(); if( type == Long.TYPE ) return readVLong(); if( type == Boolean.TYPE ) return readBoolean();
return readVInt(); if( type == Long.TYPE ) return readVLong(); if( type == Boolean.TYPE ) return readBoolean();