class AbstractReduceIndexAdapter extends BaseIndex {
    /**
     * @param ctx  Context.
     * @param tbl  Table.
     * @param name Index name.
     * @param type Type.
     * @param cols Columns.
     */
    protected AbstractReduceIndexAdapter(GridKernalContext ctx,
        Table tbl,
        String name,
        IndexType type,
        IndexColumn[] cols
    ) {
        initBaseIndex(tbl, 0, name, cols, type);
    }

    /**
     * @return Index reducer.
     */
    abstract AbstractReducer reducer();

    /** {@inheritDoc} */
    @Override public long getRowCount(Session ses) {<FILL_FUNCTION_BODY>}

    /** {@inheritDoc} */
    @Override public long getRowCountApproximation() {
        return 10_000;
    }

    /** {@inheritDoc} */
    @Override public final Cursor find(Session ses, SearchRow first, SearchRow last) {
        return reducer().find(first, last);
    }

    /** {@inheritDoc} */
    @Override public void checkRename() {
        throw DbException.getUnsupportedException("rename");
    }

    /** {@inheritDoc} */
    @Override public void close(Session ses) {
        // No-op.
    }

    /** {@inheritDoc} */
    @Override public void add(Session ses, Row row) {
        throw DbException.getUnsupportedException("add");
    }

    /** {@inheritDoc} */
    @Override public void remove(Session ses, Row row) {
        throw DbException.getUnsupportedException("remove row");
    }

    /** {@inheritDoc} */
    @Override public void remove(Session ses) {
        throw DbException.getUnsupportedException("remove index");
    }

    /** {@inheritDoc} */
    @Override public void truncate(Session ses) {
        throw DbException.getUnsupportedException("truncate");
    }

    /** {@inheritDoc} */
    @Override public boolean canGetFirstOrLast() {
        return false;
    }

    /** {@inheritDoc} */
    @Override public Cursor findFirstOrLast(Session ses, boolean first) {
        throw DbException.getUnsupportedException("findFirstOrLast");
    }

    /** {@inheritDoc} */
    @Override public boolean needRebuild() {
        return false;
    }

    /** {@inheritDoc} */
    @Override public long getDiskSpaceUsed() {
        return 0;
    }
}

        Cursor c = find(ses, null, null);

        long cnt = 0;

        while (c.next())
            cnt++;

        return cnt;
    
<no_super_class>