apache/flink · error · RuntimeException

Seek to many rows.

Error message

Seek to many rows.

What it means

RuntimeException from seekToRow(long) in ParquetColumnarRowSplitReader: after skipping whole row groups, the method loops rowCount times calling reachedEnd()/nextRecord(); if the file signals end-of-input before the seek completes, the requested offset exceeds the rows actually available. Like the 'expecting more rows' error, it usually indicates footer row counts larger than real data, or a seek offset beyond the split.

Source

Thrown at flink-formats/flink-parquet/src/main/java/org/apache/flink/formats/parquet/vector/ParquetColumnarRowSplitReader.java:365

        List<BlockMetaData> blockMetaData = reader.getRowGroups();

        for (BlockMetaData metaData : blockMetaData) {
            if (metaData.getRowCount() > rowCount) {
                break;
            } else {
                reader.skipNextRowGroup();
                rowsReturned += metaData.getRowCount();
                totalCountLoadedSoFar += metaData.getRowCount();
                rowsInBatch = (int) metaData.getRowCount();
                nextRow = (int) metaData.getRowCount();
                rowCount -= metaData.getRowCount();
            }
        }
        for (int i = 0; i < rowCount; i++) {
            boolean end = reachedEnd();
            if (end) {
                throw new RuntimeException("Seek to many rows.");
            }
            nextRecord();
        }
    }

    @Override
    public void close() throws IOException {
        if (reader != null) {
            reader.close();
            reader = null;
        }
    }

    /** Interface to gen {@link VectorizedColumnBatch}. */
    public interface ColumnBatchGenerator {
        VectorizedColumnBatch generate(ColumnVector[] readVectors);
    }
}

View on GitHub (pinned to 2f3c205e92)

Solutions

  1. Recompute the split offsets from the same file version the reader opens (avoid TOCTOU between job planning and task execution)
  2. Validate the file with parquet-tools; regenerate corrupted files
  3. Clamp the seek offset to the row count reported by the reader's own footer before calling seekToRow
Defensive patterns

Strategy: validation

Validate before calling

long available = reader.getTotalRowCount(); // totalRowCount from footer
if (seekOffset >= available) { throw new IllegalArgumentException("seek offset " + seekOffset + " >= row count " + available); }
reader.seekToRow(seekOffset);

Prevention

When it happens

Trigger: seekToRow(rowCount) with rowCount larger than the rows remaining after skipped row groups - reachedEnd() returns true inside the seek loop and the RuntimeException fires.

Common situations: Split offsets computed from stale or wrong file metadata; corrupted/truncated Parquet files where actual rows < footer row count; concurrent file replacement between planning and reading.

Related errors


AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14). Data as JSON: /api/errors/12e4fa02ac226862. Report an issue: GitHub.