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

Optimize when mapreduce.input.fileinputformat.input.dir.recursive set to true

    Details

    • Type: Bug
    • Status: Patch Available
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 0.18.0
    • Component/s: None
    • Labels:

      Description

      Many of our classes extending InputFormat have

      /*
           * This is to support multi-level/recursive directory listing until
           * MAPREDUCE-1577 is fixed.
           */
          @Override
          protected List<FileStatus> listStatus(JobContext job) throws IOException {       
              return MapRedUtil.getAllFileRecursively(super.listStatus(job),
                      job.getConfiguration());            
          }
      

      Now that we have dropped Hadoop 1.x, it can be optimized to

      if (getInputDirRecursive(job)) {
                  return super.listStatus(job);
              } else {
                  /*
                   *  mapreduce.input.fileinputformat.input.dir.recursive is not true
                   *  by default for backward compatibility reasons.
                   */
                  return MapRedUtil.getAllFileRecursively(super.listStatus(job), 
                      job.getConfiguration());     
              }
      

      That would avoid one extra iteration when mapreduce.input.fileinputformat.input.dir.recursive is set to true by users.

        Attachments

        1. PIG-5106-0.patch
          4 kB
          Artem Ervits
        2. PIG-5106-1.patch
          5 kB
          Artem Ervits

          Activity

            People

            • Assignee:
              dbist13 Artem Ervits
              Reporter:
              rohini Rohini Palaniswamy
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: