{"record":{"id":"e18e3ca257993d8e","repo":"prestodb/presto","slug":"unexpected-fragment-partitioning-s-fragmentid","errorCode":null,"errorMessage":"Unexpected fragment partitioning %s, fragmentId: %s","messagePattern":"Unexpected fragment partitioning (.+?), fragmentId: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"presto-spark-base/src/main/java/com/facebook/presto/spark/planner/PrestoSparkRddFactory.java","lineNumber":176,"sourceCode":"                partitioning.equals(FIXED_HASH_DISTRIBUTION) ||\n                partitioning.equals(FIXED_ARBITRARY_DISTRIBUTION) ||\n                partitioning.equals(SOURCE_DISTRIBUTION) ||\n                partitioning.getConnectorId().isPresent()) {\n            return createRdd(\n                    sparkContext,\n                    session,\n                    fragment,\n                    executorFactoryProvider,\n                    taskInfoCollector,\n                    shuffleStatsCollector,\n                    tableWriteInfo,\n                    rddInputs,\n                    broadcastInputs,\n                    outputType,\n                    nativeTempStorage);\n        }\n        else {\n            throw new IllegalArgumentException(format(\"Unexpected fragment partitioning %s, fragmentId: %s\", partitioning, fragment.getId()));\n        }\n    }\n\n    private <T extends PrestoSparkTaskOutput> JavaPairRDD<MutablePartitionId, T> createRdd(\n            JavaSparkContext sparkContext,\n            Session session,\n            PlanFragment fragment,\n            PrestoSparkTaskExecutorFactoryProvider executorFactoryProvider,\n            CollectionAccumulator<SerializedTaskInfo> taskInfoCollector,\n            CollectionAccumulator<PrestoSparkShuffleStats> shuffleStatsCollector,\n            TableWriteInfo tableWriteInfo,\n            Map<PlanFragmentId, JavaPairRDD<MutablePartitionId, PrestoSparkMutableRow>> rddInputs,\n            Map<PlanFragmentId, Broadcast<?>> broadcastInputs,\n            Class<T> outputType,\n            TempStorage nativeTempStorage)\n    {\n        checkInputs(fragment.getRemoteSourceNodes(), rddInputs, broadcastInputs);\n","sourceCodeStart":158,"sourceCodeEnd":194,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-spark-base/src/main/java/com/facebook/presto/spark/planner/PrestoSparkRddFactory.java#L158-L194","documentation":"After checking each known partitioning scheme, createSparkRdd falls through to a default branch and throws IllegalArgumentException for any fragment partitioning handle it does not recognize, including the fragment ID in the message. This indicates a plan partitioning that the Spark RDD factory cannot map to an RDD creation strategy.","triggerScenarios":"createSparkRdd receives a fragment whose getPartitioning() is not one of the handled schemes (system distributions, single-dynamic, fixed hash/passthrough/broadcast, scaled writer, coordinator — depending on the if-else chain).","commonSituations":"Coordinator/executor version skew so newer partitioning handles reach the factory; connector-specific partitioning handles not understood by Spark; internal planner changes introducing a new distribution not yet mapped in the RDD factory.","solutions":["Align Presto versions across coordinator and workers to avoid unknown partitioning handles from newer plans","Log/examine the partitioning handle in the message and identify which connector or feature produced it","Re-rewrite the query to avoid connector-specific distribution requirements (e.g. disable connector bucketed/scaled distribution features)","File/patch support for the missing partitioning in PrestoSparkRddFactory's if-else chain"],"exampleFix":"// before\nthrow new IllegalArgumentException(format(\"Unexpected fragment partitioning %s, fragmentId: %s\", partitioning, fragment.getId()));\n// after (add explicit handling earlier)\nif (partitioning.equals(SOME_NEW_DISTRIBUTION)) {\n    return createDefaultRdd(partitioning, fragment, ...);\n}","handlingStrategy":"try-catch","validationCode":"Set<PartitioningHandle> supported = ImmutableSet.of(SYSTEM_DISTRIBUTION, SINGLE_DYNAMIC_DISTRIBUTION, FIXED_HASH_DISTRIBUTION, ...);\ncheckArgument(supported.contains(fragment.getPartitioning()), \"unsupported partitioning: \" + fragment.getPartitioning());","typeGuard":"boolean isSupportedPartitioning(PartitioningHandle p) { return p != null && SparkSupportedPartitionings.ALL.contains(p); }","tryCatchPattern":"try { rdd = rddFactory.createSparkRdd(...); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith(\"Unexpected fragment partitioning\")) { log.error(\"unsupported partitioning \" + e.getMessage(), e); } throw e; }","preventionTips":["Keep coordinator and worker Presto versions identical","Log partitioning handles on plan creation to catch new distributions early","Extend the RDD factory's partitioning switch when upgrading Presto"],"tags":["presto-on-spark","illegal-argument","unknown-partitioning","rdd-factory"],"backgroundTag":"unexpected-fragment-partitioning","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"}