Uploaded image for project: 'Apache Avro'
  1. Apache Avro
  2. AVRO-2802

Pre-Size List in AvroInputFormat Avro File Lookup

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 1.10.0
    • None
    • None

    Description

          if (job.getBoolean(IGNORE_FILES_WITHOUT_EXTENSION_KEY, IGNORE_INPUTS_WITHOUT_EXTENSION_DEFAULT)) {
            List<FileStatus> result = new ArrayList<>();
            for (FileStatus file : super.listStatus(job))
              if (file.getPath().getName().endsWith(AvroOutputFormat.EXT))
                result.add(file);
            return result.toArray(new FileStatus[0]);
          } else {
            return super.listStatus(job);
          }
      

      When a user runs an Avro MR job against a directory, it silently filters out files without an avro file extension. Fair enough. However, anecdotally, this is the primary use scenario, so this code probably does not filter out many files.

      I suggest that this ArrayList be pre-sized. If there are a lot of files, and all of them have the avro file extension (base case), this ArrayList will had to be expanded multiple times (time and GC). If there is a large list and it gets filtered down a lot, a few hundred bytes are wasted.

      Attachments

        Issue Links

          Activity

            People

              belugabehr David Mollitor
              belugabehr David Mollitor
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: