return sb.toString();
}
@Test
public void compareInnerTuples() throws IOException {
NullableTuple t = new NullableTuple(tf.newTuple(list));
int res = compareHelper(prototype, t, comparator);
assertEquals(Math.signum(prototype.compareTo(t)), Math.signum(res), 0);
assertTrue(res == 0);
list.set(8, tf.newTuple(Arrays.<Object> asList(8.0, 9f, 10l, 12)));
t = new NullableTuple(tf.newTuple(list));
res = compareHelper(prototype, t, comparator);
assertEquals(Math.signum(prototype.compareTo(t)), Math.signum(res), 0);
assertTrue(res < 0);
list.set(8, tf.newTuple(Arrays.<Object> asList(8.0, 9f, 9l, 12)));
t = new NullableTuple(tf.newTuple(list));
res = compareHelper(prototype, t, comparator);
assertEquals(Math.signum(prototype.compareTo(t)), Math.signum(res), 0);
assertTrue(res > 0);
list.set(8, tf.newTuple(Arrays.<Object> asList(7.0, 9f, 9l, 12)));
t = new NullableTuple(tf.newTuple(list));
res = compareHelper(prototype, t, comparator);
assertEquals(Math.signum(prototype.compareTo(t)), Math.signum(res), 0);
assertTrue(res > 0);
//Tuple that will fit into BinInterSedes.TINYTUPLE
Tuple tinyTuple = createLargeTuple(1, 200, tf);
list.set(8, tinyTuple);
t = new NullableTuple(tf.newTuple(list));
res = compareHelper(prototype, t, comparator);
assertEquals(Math.signum(prototype.compareTo(t)), Math.signum(res), 0);
//Tuple that will fit into BinInterSedes.SMALLTUPLE
Tuple smallTuple = createLargeTuple(1, 1000, tf);
list.set(8, smallTuple);
t = new NullableTuple(tf.newTuple(list));
res = compareHelper(prototype, t, comparator);
assertEquals(Math.signum(prototype.compareTo(t)), Math.signum(res), 0);
// DataType.LONG < DataType.DOUBLE
list.set(8, tf.newTuple(Arrays.<Object> asList(8l, 9f, 9l, 12)));
t = new NullableTuple(tf.newTuple(list));
res = compareHelper(prototype, t, comparator);
assertEquals(Math.signum(prototype.compareTo(t)), Math.signum(res), 0);
assertTrue(res > 0);
// object after tuple
list = new ArrayList<Object>(list);
list.add(10);
NullableTuple t1 = new NullableTuple(tf.newTuple(list));
list.set(list.size() - 1, 11);
NullableTuple t2 = new NullableTuple(tf.newTuple(list));
res = compareHelper(t1, t2, comparator);
assertEquals(Math.signum(t1.compareTo(t2)), Math.signum(res), 0);
assertTrue(res < 0);
// fancy tuple nesting
list.set(list.size() - 1, tf.newTuple(list));
t1 = new NullableTuple(tf.newTuple(list));
list.set(list.size() - 1, 10);
list.set(list.size() - 1, tf.newTuple(list));
t2 = new NullableTuple(tf.newTuple(list));
res = compareHelper(t1, t2, comparator);
assertEquals(Math.signum(t1.compareTo(t2)), Math.signum(res), 0);
assertTrue(res > 0);
}