{"record":{"id":"efa0e8858363c44b","repo":"apache/hadoop","slug":"invalid-split-type","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/mapred/join/Parser.java","lineNumber":405,"sourceCode":"        }\n        splits[i] = tmp;\n      }\n      final int size = splits[0].length;\n      CompositeInputSplit[] ret = new CompositeInputSplit[size];\n      for (int i = 0; i < size; ++i) {\n        ret[i] = new CompositeInputSplit(splits.length);\n        for (int j = 0; j < splits.length; ++j) {\n          ret[i].add(splits[j][i]);\n        }\n      }\n      return ret;\n    }\n\n    @SuppressWarnings(\"unchecked\") // child types unknowable\n    public ComposableRecordReader getRecordReader(\n        InputSplit split, JobConf job, Reporter reporter) throws IOException {\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)\n          rrCstrMap.get(ident).newInstance(id, job, capacity, cmpcl);\n      } catch (IllegalAccessException e) {\n        throw (IOException)new IOException().initCause(e);\n      } catch (InstantiationException e) {\n        throw (IOException)new IOException().initCause(e);\n      } catch (InvocationTargetException e) {\n        throw (IOException)new IOException().initCause(e);\n      }","sourceCodeStart":387,"sourceCodeEnd":423,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/join/Parser.java#L387-L423","documentation":"CNode.getRecordReader expects the split produced by its own getSplits — a CompositeInputSplit bundling one child split per source — and throws IOException(\"Invalid split type:<class>\") for anything else. It means a foreign split (typically a plain FileSplit from a file-based InputFormat) reached a composite join node, i.e. getSplits and getRecordReader are being served by different InputFormats or the split tree is hand-assembled.","triggerScenarios":"Custom code calling a composite node's getRecordReader with splits from a different InputFormat; a job whose InputFormat is not CompositeInputFormat but whose reader path routes into the join framework; feeding child splits directly to a composite node instead of its own zipped splits.","commonSituations":"Framework extensions and tests that mix splits from different formats; misconfigured jobs where the split producer and reader consumer disagree.","solutions":["Use CompositeInputFormat end-to-end so splits passed to the node come from the same node's getSplits","Pass child splits only to child nodes (spl.get(i)) and CompositeInputSplit only to CNode","Type-check split instanceof CompositeInputSplit before calling getRecordReader in custom drivers"],"exampleFix":"// before\nif (split instanceof FileSplit) {\n  cnode.getRecordReader(split, job, reporter); // Invalid split type: FileSplit\n}\n\n// after\nif (split instanceof CompositeInputSplit) {\n  cnode.getRecordReader(split, job, reporter);\n} else {\n  throw new IOException(\"expected CompositeInputSplit, got \" + split.getClass());\n}","handlingStrategy":"type-guard","validationCode":"if (!(split instanceof CompositeInputSplit)) {\n  throw new IOException(\"expected CompositeInputSplit from CompositeInputFormat.getSplits, got \"\n      + split.getClass().getName());\n}","typeGuard":"static boolean isCompositeSplit(InputSplit s) {\n  return s instanceof CompositeInputSplit;\n}","tryCatchPattern":"try {\n  return cnode.getRecordReader(split, job, reporter);\n} catch (IOException e) {\n  throw new IOException(\"splits must come from the same CompositeInputFormat \"\n      + \"that provides the record reader\", e);\n}","preventionTips":["Pair getSplits and getRecordReader from the same InputFormat instance/config","Feed child splits (spl.get(i)) to child nodes, composite splits to composite nodes","Type-check the split in custom drivers before dispatching"],"tags":["hadoop","mapreduce","join","inputsplit","type-mismatch"],"backgroundTag":"type-mismatch","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}