public static boolean equivalent(
      Expression left, Expression right, Types.StructType struct, boolean caseSensitive) {
    return Binder.bind(struct, Expressions.rewriteNot(left), caseSensitive)
        .isEquivalentTo(Binder.bind(struct, Expressions.rewriteNot(right), caseSensitive));
  }
@Test
  public void testInEquivalence() {
    assertThat(
            ExpressionUtil.equivalent(
                Expressions.in("id", 1, 2, 1), Expressions.in("id", 2, 1, 2), STRUCT, true))
        .as("Should ignore duplicate longs (in)")
        .isTrue();
    assertThat(
            ExpressionUtil.equivalent(
                Expressions.notIn("id", 1, 2, 1), Expressions.notIn("id", 2, 1, 2), STRUCT, true))
        .as("Should ignore duplicate longs (notIn)")
        .isTrue();

    assertThat(
            ExpressionUtil.equivalent(
                Expressions.in("data", "a", "b", "a"),
                Expressions.in("data", "b", "a"),
                STRUCT,
                true))
        .as("Should ignore duplicate strings (in)")
        .isTrue();
    assertThat(
            ExpressionUtil.equivalent(
                Expressions.notIn("data", "b", "b"), Expressions.notIn("data", "b"), STRUCT, true))
        .as("Should ignore duplicate strings (notIn)")
        .isTrue();

    assertThat(
            ExpressionUtil.equivalent(
                Expressions.in("data", "a"), Expressions.equal("data", "a"), STRUCT, true))
        .as("Should detect equivalence with equal (in, string)")
        .isTrue();
    assertThat(
            ExpressionUtil.equivalent(
                Expressions.notIn("id", 1), Expressions.notEqual("id", 1), STRUCT, true))
        .as("Should detect equivalence with notEqual (notIn, long)")
        .isTrue();

    assertThat(
            ExpressionUtil.equivalent(
                Expressions.in("id", 1, 2, 3), Expressions.in("id", 1, 2), STRUCT, true))
        .as("Should detect different sets (in, long)")
        .isFalse();
    assertThat(
            ExpressionUtil.equivalent(
                Expressions.notIn("data", "a", "b"), Expressions.notIn("data", "a"), STRUCT, true))
        .as("Should detect different sets (notIn, string)")
        .isFalse();
  }