Hadoop Common
  1. Hadoop Common
  2. HADOOP-5816

ArrayIndexOutOfBoundsException when using KeyFieldBasedComparator

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 0.19.1
    • Fix Version/s: 0.19.2
    • Component/s: None
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

        
         if (!key.numeric) {
            compareResult = compareBytes(first, start1, end1, second, start2, end2);
          }
      

      those lines above, compare two byte arrays in a wrong way, it will cause an ArrayIndexOutOfBoundsException, that should be

        
         if (!key.numeric) {
            compareResult = compareBytes(first, start1, end1-start1, second, start2, end2-start2);
          }
      

        Activity

        Hide
        Devaraj Das added a comment -

        I just committed this. Thanks, He!

        Show
        Devaraj Das added a comment - I just committed this. Thanks, He!
        Hide
        He Yongqiang added a comment -

        Talked with Min about this bug two weeks ago. This is an obvious bug. However, in most situations when used in MapReduce jobs like TestKeyFieldBasedComparator does, this bug will not trigger IndexOutofBoundException but will misbehave, that is because the byte array in MapOutBuffer is large enough. So i inclued in TestKeyFieldBasedComparator a test without running mapreduce job.

        Show
        He Yongqiang added a comment - Talked with Min about this bug two weeks ago. This is an obvious bug. However, in most situations when used in MapReduce jobs like TestKeyFieldBasedComparator does, this bug will not trigger IndexOutofBoundException but will misbehave, that is because the byte array in MapOutBuffer is large enough. So i inclued in TestKeyFieldBasedComparator a test without running mapreduce job.

          People

          • Assignee:
            He Yongqiang
            Reporter:
            Min Zhou
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development