From bc043d55221f863cfc71cdb70683848b23f3096b Mon Sep 17 00:00:00 2001 From: Cheng Lian Date: Wed, 30 Jul 2014 12:59:30 +0800 Subject: [PATCH 1/2] Leveraged footersCache to pass FileStatus objects without side effects --- .../parquet/hadoop/ParquetInputFormat.java | 117 +++++++++++------- .../java/parquet/hadoop/TestInputFormat.java | 12 +- 2 files changed, 76 insertions(+), 53 deletions(-) diff --git a/parquet-hadoop/src/main/java/parquet/hadoop/ParquetInputFormat.java b/parquet-hadoop/src/main/java/parquet/hadoop/ParquetInputFormat.java index 0231ccd720..b364a97365 100644 --- a/parquet-hadoop/src/main/java/parquet/hadoop/ParquetInputFormat.java +++ b/parquet-hadoop/src/main/java/parquet/hadoop/ParquetInputFormat.java @@ -89,7 +89,7 @@ public class ParquetInputFormat extends FileInputFormat { * key to configure the filter */ public static final String UNBOUND_RECORD_FILTER = "parquet.read.filter"; - + /** * key to configure type checking for conflicting schemas (default: true) */ @@ -102,7 +102,7 @@ public class ParquetInputFormat extends FileInputFormat { private static final int MIN_FOOTER_CACHE_SIZE = 100; - private LruCache footersCache; + private LruCache footersCache; private Class readSupportClass; @@ -414,23 +414,21 @@ private static void checkSorted(List rowGroupBlocks) { @Override public List getSplits(JobContext jobContext) throws IOException { List splits = new ArrayList(); - splits.addAll(getSplits(ContextUtil.getConfiguration(jobContext), getFooters(jobContext))); + splits.addAll(getSplitsWithCachedFooters(ContextUtil.getConfiguration(jobContext), getCachedFooters(jobContext))); return splits; } - /** - * @param configuration the configuration to connect to the file system - * @param footers the footers of the files to read - * @return the splits for the footers - * @throws IOException - */ - public List getSplits(Configuration configuration, List