public static RowRanges calculateRowRanges(
      FilterCompat.Filter filter, ColumnIndexStore columnIndexStore, Set<ColumnPath> paths, long rowCount) {
    return filter.accept(new FilterCompat.Visitor<RowRanges>() {
      @Override
      public RowRanges visit(FilterPredicateCompat filterPredicateCompat) {
        try {
          return filterPredicateCompat
              .getFilterPredicate()
              .accept(new ColumnIndexFilter(columnIndexStore, paths, rowCount));
        } catch (MissingOffsetIndexException e) {
          LOGGER.info(e.getMessage());
          return RowRanges.createSingle(rowCount);
        }
      }

      @Override
      public RowRanges visit(UnboundRecordFilterCompat unboundRecordFilterCompat) {
        return RowRanges.createSingle(rowCount);
      }

      @Override
      public RowRanges visit(NoOpFilter noOpFilter) {
        return RowRanges.createSingle(rowCount);
      }
    });
  }
@Test
  public void testFilteringOnMissingColumns() {
    Set<ColumnPath> paths = paths("column1", "column2", "column3", "column4");

    // Missing column filter is always true
    assertAllRows(
        calculateRowRanges(
            FilterCompat.get(notEq(intColumn("missing_column"), 0)), STORE, paths, TOTAL_ROW_COUNT),
        TOTAL_ROW_COUNT);
    assertRows(
        calculateRowRanges(
            FilterCompat.get(and(
                and(gtEq(intColumn("column1"), 7), lt(intColumn("column1"), 11)),
                eq(binaryColumn("missing_column"), null))),
            STORE,
            paths,
            TOTAL_ROW_COUNT),
        7,
        8,
        9,
        10,
        11,
        12,
        13);

    // Missing column filter is always false
    assertRows(
        calculateRowRanges(
            FilterCompat.get(or(
                and(gtEq(intColumn("column1"), 7), lt(intColumn("column1"), 11)),
                notEq(binaryColumn("missing_column"), null))),
            STORE,
            paths,
            TOTAL_ROW_COUNT),
        7,
        8,
        9,
        10,
        11,
        12,
        13);
    assertRows(calculateRowRanges(
        FilterCompat.get(gt(intColumn("missing_column"), 0)), STORE, paths, TOTAL_ROW_COUNT));
  }