Uploaded image for project: 'Pig'
  1. Pig
  2. PIG-3160

GFCross uses unnecessary loop

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.10.0
    • 0.12.0
    • internal-udfs
    • None

    Description

      The GFCross UDF contains the following code:

      int[] digits = new int[numInputs];
      for (int i=0; i<numInputs; i++){
        if (i == myNumber){
          digits[i] = r.nextInt(numGroupsPerInput);
        }else{
          digits[i] = 0;
       }
      }
      

      As int arrays are initialized with all 0s already, this is equivalent to just settings digits[myNumber] and leaving the rest alone.

      Attachments

        1. PIG-3610.patch
          0.8 kB
          Sandy Ryza

        Activity

          People

            sandyr Sandy Ryza
            sandyr Sandy Ryza
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: