prestodb/presto · error · IllegalArgumentException

partitionHandle must be NOT_PARTITIONED

Error message

partitionHandle must be NOT_PARTITIONED

What it means

FixedSplitSource serves a fixed list of ConnectorSplit objects and only supports a single, non-partitioned stream. getNextBatch validates that callers pass ConnectorPartitionHandle.NOT_PARTITIONED; any other partition handle indicates the caller expects real partitioned splits, which this source cannot produce, so it fails fast with IllegalArgumentException.

Source

Thrown at presto-spi/src/main/java/com/facebook/presto/spi/FixedSplitSource.java:48

    private final List<ConnectorSplit> splits;
    private int offset;

    public FixedSplitSource(Iterable<? extends ConnectorSplit> splits)
    {
        requireNonNull(splits, "splits is null");
        List<ConnectorSplit> splitsList = new ArrayList<>();
        for (ConnectorSplit split : splits) {
            splitsList.add(split);
        }
        this.splits = Collections.unmodifiableList(splitsList);
    }

    @SuppressWarnings("ObjectEquality")
    @Override
    public CompletableFuture<ConnectorSplitBatch> getNextBatch(ConnectorPartitionHandle partitionHandle, int maxSize)
    {
        if (!partitionHandle.equals(NOT_PARTITIONED)) {
            throw new IllegalArgumentException("partitionHandle must be NOT_PARTITIONED");
        }

        int remainingSplits = splits.size() - offset;
        int size = Math.min(remainingSplits, maxSize);
        List<ConnectorSplit> results = splits.subList(offset, offset + size);
        offset += size;

        return completedFuture(new ConnectorSplitBatch(results, isFinished()));
    }

    @Override
    public boolean isFinished()
    {
        return offset >= splits.size();
    }

    @Override
    public void close()

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Pass ConnectorPartitionHandle.NOT_PARTITIONED when calling getNextBatch on a FixedSplitSource
  2. Ensure each driver/segment using this source is constructed with NOT_PARTITIONED rather than an output-partition handle
  3. If partitioned consumption is required, use a partition-aware split source instead of FixedSplitSource
  4. Compare with equals() not == when checking the handle; the check itself uses ObjectEquality on purpose

Example fix

// before
splitSource.getNextBatch(outputPartitionHandle, maxSize);
// after
splitSource.getNextBatch(ConnectorPartitionHandle.NOT_PARTITIONED, maxSize);
Defensive patterns

Strategy: validation

Validate before calling

if (!ConnectorPartitionHandle.NOT_PARTITIONED.equals(partitionHandle)) {
    throw new IllegalArgumentException("FixedSplitSource requires NOT_PARTITIONED, got: " + partitionHandle);
}

Try / catch

try {
    batch = splitSource.getNextBatch(ConnectorPartitionHandle.NOT_PARTITIONED, maxSize);
} catch (IllegalArgumentException e) {
    throw new IllegalStateException("split source does not support partitioning", e);
}

Prevention

When it happens

Trigger: Calling getNextBatch(ConnectorPartitionHandle, int) on a FixedSplitSource with any partition handle other than NOT_PARTITIONED (e.g. a handle obtained from a partitioned split source or a non-default handle instance).

Common situations: Connector code reusing a split-source implementation across drivers with partition handles; scheduler changes that pass per-worker partition handles into a source that only holds an unpartitioned split list; mixing FixedSplitSource into code paths written for partitioned connectors.

Related errors


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