@Override
  protected FileStatus[] listStatus(JobConf job) throws IOException {
    FileStatus[] status = super.listStatus(job);
    if (job.getBoolean(IGNORE_FILES_WITHOUT_EXTENSION_KEY, IGNORE_INPUTS_WITHOUT_EXTENSION_DEFAULT)) {
      List<FileStatus> result = new ArrayList<>(status.length);
      for (FileStatus file : status)
        if (file.getPath().getName().endsWith(AvroOutputFormat.EXT))
          result.add(file);
      status = result.toArray(new FileStatus[0]);
    }
    return status;
  }
@SuppressWarnings("rawtypes")
  @Test
  void ignoreFilesWithoutExtension() throws Exception {
    fs.mkdirs(inputDir);
    Path avroFile = new Path(inputDir, "somefile.avro");
    Path textFile = new Path(inputDir, "someotherfile.txt");
    fs.create(avroFile).close();
    fs.create(textFile).close();

    FileInputFormat.setInputPaths(conf, inputDir);

    AvroInputFormat inputFormat = new AvroInputFormat();
    FileStatus[] statuses = inputFormat.listStatus(conf);
    assertEquals(1, statuses.length);
    assertEquals("somefile.avro", statuses[0].getPath().getName());

    conf.setBoolean(AvroInputFormat.IGNORE_FILES_WITHOUT_EXTENSION_KEY, false);
    statuses = inputFormat.listStatus(conf);
    assertEquals(2, statuses.length);
    Set<String> names = new HashSet<>();
    names.add(statuses[0].getPath().getName());
    names.add(statuses[1].getPath().getName());
    assertTrue(names.contains("somefile.avro"));
    assertTrue(names.contains("someotherfile.txt"));
  }