public static FilterPredicate rewrite(FilterPredicate pred) {
    Objects.requireNonNull(pred, "pred cannot be null");
    return pred.accept(INSTANCE);
  }
@Test
  public void testBaseCases() {
    UserDefined<Integer, DummyUdp> ud = userDefined(intColumn, DummyUdp.class);

    assertNoOp(eq(intColumn, 17));
    assertNoOp(notEq(intColumn, 17));
    assertNoOp(lt(intColumn, 17));
    assertNoOp(ltEq(intColumn, 17));
    assertNoOp(gt(intColumn, 17));
    assertNoOp(gtEq(intColumn, 17));
    assertNoOp(and(eq(intColumn, 17), eq(doubleColumn, 12.0)));
    assertNoOp(or(eq(intColumn, 17), eq(doubleColumn, 12.0)));
    assertNoOp(ud);

    Contains<Integer> containsLhs = contains(eq(intColumn, 17));
    Contains<Integer> containsRhs = contains(eq(intColumn, 7));

    assertNoOp(containsLhs);
    assertEquals(containsLhs.and(containsRhs), rewrite(and(containsLhs, containsRhs)));
    assertEquals(containsLhs.or(containsRhs), rewrite(or(containsLhs, containsRhs)));
  }