{"record":{"id":"6ffed1924556f2d3","repo":"apache/hadoop","slug":"invalid-split-type-6ffed1","errorCode":null,"errorMessage":"Invalid split type:{}","messagePattern":"Invalid split type:(.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/join/Parser.java","lineNumber":466,"sourceCode":"      }\n      final int size = splits.get(0).size();\n      List<InputSplit> ret = new ArrayList<InputSplit>();\n      for (int i = 0; i < size; ++i) {\n        CompositeInputSplit split = new CompositeInputSplit(splits.size());\n        for (int j = 0; j < splits.size(); ++j) {\n          split.add(splits.get(j).get(i));\n        }\n        ret.add(split);\n      }\n      return ret;\n    }\n\n    @SuppressWarnings(\"unchecked\") // child types unknowable\n    public ComposableRecordReader \n        createRecordReader(InputSplit split, TaskAttemptContext taskContext) \n        throws IOException, InterruptedException {\n      if (!(split instanceof CompositeInputSplit)) {\n        throw new IOException(\"Invalid split type:\" +\n                              split.getClass().getName());\n      }\n      final CompositeInputSplit spl = (CompositeInputSplit)split;\n      final int capacity = kids.size();\n      CompositeRecordReader ret = null;\n      try {\n        if (!rrCstrMap.containsKey(ident)) {\n          throw new IOException(\"No RecordReader for \" + ident);\n        }\n        ret = (CompositeRecordReader)rrCstrMap.get(ident).\n          newInstance(id, taskContext.getConfiguration(), capacity, cmpcl);\n      } catch (IllegalAccessException e) {\n        throw new IOException(e);\n      } catch (InstantiationException e) {\n        throw new IOException(e);\n      } catch (InvocationTargetException e) {\n        throw new IOException(e);\n      }","sourceCodeStart":448,"sourceCodeEnd":484,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/join/Parser.java#L448-L484","documentation":"Parser.CNode.createRecordReader (Parser.java:466) requires the InputSplit passed in to be a CompositeInputSplit — one assembled by CompositeInputFormat.getSplits, holding one child split per join input. Receiving any other split type (e.g. a plain FileSplit) is a programming/framework error: the composite record reader cannot extract its per-child splits.","triggerScenarios":"Calling CompositeInputFormat (or a composite node's) createRecordReader with a FileSplit or custom InputSplit instead of a CompositeInputSplit; a custom InputFormat delegating to the join framework but forwarding its own raw splits; unit tests constructing record readers directly with arbitrary splits; a scheduler/AM misrouting splits between InputFormats.","commonSituations":"Writing custom InputFormats that delegate to CompositeInputFormat; direct unit-testing of createRecordReader without building splits through getSplits(); frameworks (Hadoop Streaming, Crunch, Hive wrappers) that pass through splits of the wrong type when the join InputFormat is nested.","solutions":["Always obtain splits via CompositeInputFormat.getSplits(context) and pass the resulting CompositeInputSplit objects to createRecordReader","In delegating InputFormats, build a CompositeInputSplit(capacity) and add(childSplits) before creating the reader","In tests, construct splits via getSplits on test input rather than new FileSplit(...)","Fail fast upstream: check split instanceof CompositeInputSplit in wrapper code before delegation"],"exampleFix":"// before (test / wrapper code)\nInputSplit split = fileSplits.get(0); // FileSplit!\nRecordReader<Text, TupleWritable> rr = compositeIF.createRecordReader(split, ctx);\n\n// after\nList<InputSplit> splits = compositeIF.getSplits(job); // CompositeInputSplits\nRecordReader<Text, TupleWritable> rr = compositeIF.createRecordReader(splits.get(0), ctx);","handlingStrategy":"type-guard","validationCode":"if (!(split instanceof CompositeInputSplit)) throw new IllegalArgumentException(\"Expected CompositeInputSplit, got \" + split.getClass().getName());","typeGuard":"static boolean isCompositeSplit(InputSplit s) { return s instanceof org.apache.hadoop.mapreduce.lib.join.CompositeInputSplit; }","tryCatchPattern":"try { return cnode.createRecordReader(split, ctx); } catch (IOException e) { if (e.getMessage().startsWith(\"Invalid split type\")) throw new IllegalStateException(\"Splits must come from CompositeInputFormat.getSplits\", e); throw e; }","preventionTips":["Always pair createRecordReader with splits from getSplits on the same CompositeInputFormat","In wrappers, build CompositeInputSplit(capacity) and add() child splits before reader creation","Add instanceof assertions in delegating InputFormats to fail fast with context"],"tags":["hadoop","mapreduce","join","input-split","type-mismatch"],"backgroundTag":"wrong-input-split-type","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}