class DataRowIterator implements Iterator<DataRow>, AutoCloseable {

    public RowAttribute[] calculateHeader() {

        if (currentRow == null) {
            return new RowAttribute[0];
        }

        List<String> names = new ArrayList<>(currentRow.keySet());

        // ensure predictable order on each run...
        Collections.sort(names);

        RowAttribute[] header = new RowAttribute[currentRow.size()];
        for (int i = 0; i < header.length; i++) {
            String name = names.get(i);
            header[i] = new BaseRowAttribute(Object.class, name, ASTDbPath.DB_PREFIX + name, i);
        }

        return header;
    }

    public  DataRowIterator(ResultIterator<DataRow> delegate);

}