private int indexMismatch(ITuple tuple1, ITuple tuple2, int minFieldIndex,
	    int maxFieldIndex) {
		int schemaId1 = tupleMRConfig.getSchemaIdByName(tuple1.getSchema().getName());
		int schemaId2 = tupleMRConfig.getSchemaIdByName(tuple2.getSchema().getName());
		int[] translationTuple1 = serInfo.getGroupSchemaIndexTranslation(schemaId1);
		int[] translationTuple2 = serInfo.getGroupSchemaIndexTranslation(schemaId2);

		for(int i = minFieldIndex; i <= maxFieldIndex; i++) {
			Object obj1 = tuple1.get(translationTuple1[i]);
			Object obj2 = tuple2.get(translationTuple2[i]);
			@SuppressWarnings("unchecked")
			RawComparator<Object> customComparator = (RawComparator<Object>) customComparators[i];

			if(customComparator != null) {
				//TODO we assume here that customComparator must implement compare by objects.
				//Even if it's annoying, we should serialize and compare in binary.
				if(customComparator.compare(obj1, obj2) != 0) {
					return i;
				}
			} else {
				if (SortComparator.compareObjects(obj1,obj2) != 0){
					return i;
				}
			}
		}
		throw new RuntimeException("Illegal state.The tuples " + tuple1 + " and " + tuple2
		    + " compare the same between indexes " + minFieldIndex + " and " + maxFieldIndex);
	}
private int indexMismatch ( ITuple tuple1 , ITuple tuple2 , int minFieldIndex , int maxFieldIndex ) { int schemaId1 = tupleMRConfig . getSchemaIdByName ( tuple1 . getSchema ( ) . getName ( ) ) ; int schemaId2 = tupleMRConfig . getSchemaIdByName ( tuple2 . getSchema ( ) . getName ( ) ) ; int [ ] translationTuple1 = serInfo . getGroupSchemaIndexTranslation ( schemaId1 ) ; int [ ] translationTuple2 = serInfo . getGroupSchemaIndexTranslation ( schemaId2 ) ; for ( int i = minFieldIndex ; i <= maxFieldIndex ; i ++ ) { Object obj1 = tuple1 . get ( translationTuple1 [ i ] ) ; Object obj2 = tuple2 . get ( translationTuple2 [ i ] ) ; @ SuppressWarnings ( "unchecked" ) RawComparator < Object > customComparator = ( RawComparator < Object > ) customComparators [ i ] ; if ( customComparator != null ) { if ( customComparator . compare ( obj1 , obj2 ) != 0 ) { return i ; } } else { if ( SortComparator . compareObjects ( obj1 , obj2 ) != 0 ) { return i ; } } } throw new RuntimeException ( "Illegal state.The tuples " + tuple1 + " and " + tuple2 + " compare the same between indexes " + minFieldIndex + " and " + maxFieldIndex ) ; }
Compares sequentially the fields from two tuples and returns which field
they differ from. Use custom comparators when provided. The provided
RawComparators must implement "compare" so we should use them.<p>

Important. The contract of this method is that the tuples will differ
always between minField and maxField. If they are equal then an Exception
is thrown.</p>