prestodb/presto · error

FUNCTION_IMPLEMENTATION_ERROR

FUNCTION_IMPLEMENTATION_ERROR

Error message

Row ID ordinal not found

What it means

Thrown in the AccumuloPageSink constructor when no column in the table's column list has a name matching the table's configured rowId. The sink maps rows to Accumulo mutations by ordinal, so it must know which column ordinal holds the Accumulo row ID; if the row ID column is missing from the sink's column handles, this internal consistency error (FUNCTION_IMPLEMENTATION_ERROR) is raised.

Source

Thrown at presto-accumulo/src/main/java/com/facebook/presto/accumulo/io/AccumuloPageSink.java:101

    private long numRows;

    public AccumuloPageSink(
            Connector connector,
            AccumuloTable table,
            String username)
    {
        requireNonNull(table, "table is null");

        this.columns = table.getColumns();

        // Fetch the row ID ordinal, throwing an exception if not found for safety
        Optional<Integer> ordinal = columns.stream()
                .filter(columnHandle -> columnHandle.getName().equals(table.getRowId()))
                .map(AccumuloColumnHandle::getOrdinal)
                .findAny();

        if (!ordinal.isPresent()) {
            throw new PrestoException(FUNCTION_IMPLEMENTATION_ERROR, "Row ID ordinal not found");
        }

        this.rowIdOrdinal = ordinal.get();
        this.serializer = table.getSerializerInstance();

        try {
            // Create a BatchWriter to the Accumulo table
            BatchWriterConfig conf = new BatchWriterConfig();
            writer = connector.createBatchWriter(table.getFullTableName(), conf);

            // If the table is indexed, create an instance of an Indexer, else empty
            if (table.isIndexed()) {
                indexer = Optional.of(
                        new Indexer(
                                connector,
                                connector.securityOperations().getUserAuthorizations(username),
                                table,
                                conf));

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Verify the table's row_id in Presto metadata matches an existing column name via SHOW CREATE TABLE or the metadata JSON
  2. Re-register or repair the table metadata so the column list includes the row ID column with the correct ordinal
  3. Drop and recreate the Accumulo table registration in Presto if metadata is corrupted
  4. If writing a custom connector path, always pass the full table column list to the sink, not a filtered subset

Example fix

// before
// sink columns built from projection only, missing rowid column
List<AccumuloColumnHandle> cols = handles.stream().filter(h -> projectionUses(h)).collect(toList());
// after
// always include the row ID column
List<AccumuloColumnHandle> cols = new ArrayList<>(handles);
handles.stream().filter(h -> h.getName().equals(table.getRowId()))
       .filter(h -> cols.stream().noneMatch(c -> c.getName().equals(h.getName())))
       .forEach(cols::add);
Defensive patterns

Strategy: validation

Validate before calling

boolean rowIdPresent = columns.stream()
    .anyMatch(c -> c.getName().equals(table.getRowId()));
if (!rowIdPresent) {
    throw new IllegalStateException("Sink column handles missing row ID column: " + table.getRowId());
}

Try / catch

try {
    AccumuloPageSink sink = new AccumuloPageSink(...);
} catch (PrestoException e) {
    if (e.getMessage().contains("Row ID ordinal not found")) {
        // metadata drift: re-fetch table metadata or re-register the table
        throw new IllegalStateException("Table metadata is out of sync; run SHOW CREATE TABLE and repair row_id column", e);
    }
    throw e;
}

Prevention

When it happens

Trigger: Creating an AccumuloPageSink for a table whose columnHandles list does not contain any AccumuloColumnHandle whose getName() equals table.getRowId(); typically caused by stale or truncated column metadata (e.g. connector metadata not matching the table's registered row ID column after schema changes).

Common situations: Table row_id renamed or columns dropped in Accumulo metadata without updating Presto's column handles; a query selecting a subset of columns passed as sink columns instead of the full table column list; deserialization/upgrade issues where old table metadata lacks the row ID column.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/727f9a6d7e1e5946. Report an issue: GitHub.