You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by fo...@apache.org on 2020/05/04 20:04:12 UTC
[avro] branch master updated: AVRO-2802: Pre-Size List in
AvroInputFormat Avro File Lookup (#857)
This is an automated email from the ASF dual-hosted git repository.
fokko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/avro.git
The following commit(s) were added to refs/heads/master by this push:
new 5f7b068 AVRO-2802: Pre-Size List in AvroInputFormat Avro File Lookup (#857)
5f7b068 is described below
commit 5f7b068663671bb1d4a810c35e3a4a55815bc1ef
Author: belugabehr <12...@users.noreply.github.com>
AuthorDate: Mon May 4 16:04:04 2020 -0400
AVRO-2802: Pre-Size List in AvroInputFormat Avro File Lookup (#857)
Co-authored-by: David Mollitor <dm...@apache.org>
---
.../src/main/java/org/apache/avro/mapred/AvroInputFormat.java | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroInputFormat.java b/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroInputFormat.java
index 4ae0ca4..f3ca09b 100644
--- a/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroInputFormat.java
+++ b/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroInputFormat.java
@@ -51,15 +51,15 @@ public class AvroInputFormat<T> extends FileInputFormat<AvroWrapper<T>, NullWrit
@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<>();
- for (FileStatus file : super.listStatus(job))
+ List<FileStatus> result = new ArrayList<>(status.length);
+ for (FileStatus file : status)
if (file.getPath().getName().endsWith(AvroOutputFormat.EXT))
result.add(file);
- return result.toArray(new FileStatus[0]);
- } else {
- return super.listStatus(job);
+ status = result.toArray(new FileStatus[0]);
}
+ return status;
}
@Override