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 testInequalityEquivalence() {
    String[] cols = new String[] {"id", "val", "ts", "date", "time"};

    for (String col : cols) {
      assertThat(
              ExpressionUtil.equivalent(
                  Expressions.lessThan(col, 34L),
                  Expressions.lessThanOrEqual(col, 33L),
                  STRUCT,
                  true))
          .as("Should detect < to <= equivalence: " + col)
          .isTrue();
      assertThat(
              ExpressionUtil.equivalent(
                  Expressions.lessThanOrEqual(col, 34L),
                  Expressions.lessThan(col, 35L),
                  STRUCT,
                  true))
          .as("Should detect <= to < equivalence: " + col)
          .isTrue();
      assertThat(
              ExpressionUtil.equivalent(
                  Expressions.greaterThan(col, 34L),
                  Expressions.greaterThanOrEqual(col, 35L),
                  STRUCT,
                  true))
          .as("Should detect > to >= equivalence: " + col)
          .isTrue();
      assertThat(
              ExpressionUtil.equivalent(
                  Expressions.greaterThanOrEqual(col, 34L),
                  Expressions.greaterThan(col, 33L),
                  STRUCT,
                  true))
          .as("Should detect >= to > equivalence: " + col)
          .isTrue();
    }

    assertThat(
            ExpressionUtil.equivalent(
                Expressions.lessThan("val", 34L),
                Expressions.lessThanOrEqual("val2", 33L),
                STRUCT,
                true))
        .as("Should not detect equivalence for different columns")
        .isFalse();
    assertThat(
            ExpressionUtil.equivalent(
                Expressions.lessThan("val", 34L),
                Expressions.lessThanOrEqual("id", 33L),
                STRUCT,
                true))
        .as("Should not detect equivalence for different types")
        .isFalse();
  }