presto-main/src/main/java/io/prestosql/operator/index/FieldSetFilteringRecordSet.java/FieldSetFilteringRecordSet/fieldEquals
class FieldSetFilteringRecordSet:        private static boolean fieldEquals(RecordCursor cursor, Field field1, Field field2)
        {
            checkArgument(cursor.getType(field1.getField()).equals(cursor.getType(field2.getField())), "Should only be comparing fields of the same type");

            if (cursor.isNull(field1.getField()) || cursor.isNull(field2.getField())) {
                return false;
            }

            Class<?> javaType = cursor.getType(field1.getField()).getJavaType();
            try {
                if (javaType == long.class) {
                    return TRUE.equals((Boolean) field1.getEqualsMethodHandle().invokeExact(cursor.getLong(field1.getField()), cursor.getLong(field2.getField())));
                }
                if (javaType == double.class) {
                    return TRUE.equals((Boolean) field1.getEqualsMethodHandle().invokeExact(cursor.getDouble(field1.getField()), cursor.getDouble(field2.getField())));
                }
                if (javaType == boolean.class) {
                    return TRUE.equals((Boolean) field1.getEqualsMethodHandle().invokeExact(cursor.getBoolean(field1.getField()), cursor.getBoolean(field2.getField())));
                }
                if (javaType == Slice.class) {
                    return TRUE.equals((Boolean) field1.getEqualsMethodHandle().invokeExact(cursor.getSlice(field1.getField()), cursor.getSlice(field2.getField())));
                }
                return TRUE.equals((Boolean) field1.getEqualsMethodHandle().invoke(cursor.getObject(field1.getField()), cursor.getObject(field2.getField())));
            }
            catch (Throwable t) {
                throwIfUnchecked(t);
                throw new RuntimeException(t);
            }
        }