{"record":{"id":"de6fdd7212470df2","repo":"apache/hadoop","slug":"exception-in-compare","errorCode":null,"errorMessage":"exception in compare","messagePattern":"exception in compare","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/JobSubmitter.java","lineNumber":379,"sourceCode":"        jobSubmitDir.getFileSystem(job), splits);\n    return splits.length;\n  }\n  \n  private static class SplitComparator implements Comparator<InputSplit> {\n    @Override\n    public int compare(InputSplit o1, InputSplit o2) {\n      try {\n        long len1 = o1.getLength();\n        long len2 = o2.getLength();\n        if (len1 < len2) {\n          return 1;\n        } else if (len1 == len2) {\n          return 0;\n        } else {\n          return -1;\n        }\n      } catch (IOException ie) {\n        throw new RuntimeException(\"exception in compare\", ie);\n      } catch (InterruptedException ie) {\n        throw new RuntimeException(\"exception in compare\", ie);\n      }\n    }\n  }\n  \n  @SuppressWarnings(\"unchecked\")\n  private void readTokensFromFiles(Configuration conf, Credentials credentials)\n  throws IOException {\n    // add tokens and secrets coming from a token storage file\n    String binaryTokenFilename =\n      conf.get(MRJobConfig.MAPREDUCE_JOB_CREDENTIALS_BINARY);\n    if (binaryTokenFilename != null) {\n      Credentials binary = Credentials.readTokenStorageFile(\n          FileSystem.getLocal(conf).makeQualified(\n              new Path(binaryTokenFilename)),\n          conf);\n      credentials.addAll(binary);","sourceCodeStart":361,"sourceCodeEnd":397,"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/JobSubmitter.java#L361-L397","documentation":"Error \"exception in compare\" thrown in apache/hadoop.","triggerScenarios":"Thrown at hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/JobSubmitter.java:379 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the comparator/serialization used to sort input splits so comparisons do not throw; see the wrapped exception for details."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}