prestodb/presto · error · UnsupportedOperationException

rewind is not supported in this ConnectorSplitSource

Error message

rewind is not supported in this ConnectorSplitSource

What it means

ConnectorSplitSource.rewind is an optional capability: the interface's default implementation throws UnsupportedOperationException, so split sources that have not overridden rewind cannot go back to re-emit splits for a given partition handle.

Source

Thrown at presto-spi/src/main/java/com/facebook/presto/spi/ConnectorSplitSource.java:31

 */
package com.facebook.presto.spi;

import com.facebook.presto.spi.connector.ConnectorPartitionHandle;

import java.io.Closeable;
import java.util.List;
import java.util.concurrent.CompletableFuture;

import static java.util.Objects.requireNonNull;

public interface ConnectorSplitSource
        extends Closeable
{
    CompletableFuture<ConnectorSplitBatch> getNextBatch(ConnectorPartitionHandle partitionHandle, int maxSize);

    default void rewind(ConnectorPartitionHandle partitionHandle)
    {
        throw new UnsupportedOperationException("rewind is not supported in this ConnectorSplitSource");
    }

    @Override
    void close();

    /**
     * Returns whether any more {@link ConnectorSplit} may be produced.
     * <p>
     * This method should only be called when there has been no invocation of getNextBatch,
     * or result Future of previous getNextBatch is done.
     * Calling this method at other time is not useful because the contract of such an invocation
     * will be inherently racy.
     */
    boolean isFinished();

    class ConnectorSplitBatch
    {
        private final List<ConnectorSplit> splits;

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Use a ConnectorSplitSource implementation that overrides rewind
  2. Restructure logic to re-create the split source instead of rewinding it
  3. Check rewind support (e.g. instanceof the rewirable type) before calling

Example fix

// before
splitSource.rewind(partitionHandle);
// after
splitSource.close();
ConnectorSplitSource fresh = connector.getSplits(...); // re-create instead
Defensive patterns

Strategy: fallback

Try / catch

try { splitSource.rewind(partitionHandle); } catch (UnsupportedOperationException e) { splitSource.close(); splitSource = connector.getSplits(txnHandle, session, table, partitionHandle); }

Prevention

When it happens

Trigger: Calling rewind on any ConnectorSplitSource implementation that does not override the default rewind method (e.g. a connector's split source built from a simple iterator).

Common situations: Query retry logic that asks the split source to rewind after a failure; connectors that do not implement rewindable split sourcing being used in a context that assumes support; code written against a custom split source lacking rewind.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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