{"record":{"id":"241110ad50961865","repo":"prestodb/presto","slug":"partitionhandle-must-be-not-partitioned","errorCode":null,"errorMessage":"partitionHandle must be NOT_PARTITIONED","messagePattern":"partitionHandle must be NOT_PARTITIONED","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"presto-spi/src/main/java/com/facebook/presto/spi/FixedSplitSource.java","lineNumber":48,"sourceCode":"    private final List<ConnectorSplit> splits;\n    private int offset;\n\n    public FixedSplitSource(Iterable<? extends ConnectorSplit> splits)\n    {\n        requireNonNull(splits, \"splits is null\");\n        List<ConnectorSplit> splitsList = new ArrayList<>();\n        for (ConnectorSplit split : splits) {\n            splitsList.add(split);\n        }\n        this.splits = Collections.unmodifiableList(splitsList);\n    }\n\n    @SuppressWarnings(\"ObjectEquality\")\n    @Override\n    public CompletableFuture<ConnectorSplitBatch> getNextBatch(ConnectorPartitionHandle partitionHandle, int maxSize)\n    {\n        if (!partitionHandle.equals(NOT_PARTITIONED)) {\n            throw new IllegalArgumentException(\"partitionHandle must be NOT_PARTITIONED\");\n        }\n\n        int remainingSplits = splits.size() - offset;\n        int size = Math.min(remainingSplits, maxSize);\n        List<ConnectorSplit> results = splits.subList(offset, offset + size);\n        offset += size;\n\n        return completedFuture(new ConnectorSplitBatch(results, isFinished()));\n    }\n\n    @Override\n    public boolean isFinished()\n    {\n        return offset >= splits.size();\n    }\n\n    @Override\n    public void close()","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-spi/src/main/java/com/facebook/presto/spi/FixedSplitSource.java#L30-L66","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Pass ConnectorPartitionHandle.NOT_PARTITIONED when calling getNextBatch on a FixedSplitSource","Ensure each driver/segment using this source is constructed with NOT_PARTITIONED rather than an output-partition handle","If partitioned consumption is required, use a partition-aware split source instead of FixedSplitSource","Compare with equals() not == when checking the handle; the check itself uses ObjectEquality on purpose"],"exampleFix":"// before\nsplitSource.getNextBatch(outputPartitionHandle, maxSize);\n// after\nsplitSource.getNextBatch(ConnectorPartitionHandle.NOT_PARTITIONED, maxSize);","handlingStrategy":"validation","validationCode":"if (!ConnectorPartitionHandle.NOT_PARTITIONED.equals(partitionHandle)) {\n    throw new IllegalArgumentException(\"FixedSplitSource requires NOT_PARTITIONED, got: \" + partitionHandle);\n}","typeGuard":null,"tryCatchPattern":"try {\n    batch = splitSource.getNextBatch(ConnectorPartitionHandle.NOT_PARTITIONED, maxSize);\n} catch (IllegalArgumentException e) {\n    throw new IllegalStateException(\"split source does not support partitioning\", e);\n}","preventionTips":["Always pass ConnectorPartitionHandle.NOT_PARTITIONED to FixedSplitSource","Never reuse partition handles from other sources across split-source implementations","Use equals(), not ==, when comparing handles"],"tags":["spi","connector","split-source","illegal-argument"],"backgroundTag":"unexpected-partition-handle","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}