parquet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject incubator-parquet-mr git commit: Revert "PARQUET-220: Remove unnecessary warnings initializing ParquetRecordReader"
Date Mon, 06 Apr 2015 22:49:51 GMT
Repository: incubator-parquet-mr
Updated Branches:
  refs/heads/master bfb314505 -> ff7a48631


Revert "PARQUET-220: Remove unnecessary warnings initializing ParquetRecordReader"

This reverts commit bfb314505469afcd5ea7b5bd15121acd50425318.


Project: http://git-wip-us.apache.org/repos/asf/incubator-parquet-mr/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-parquet-mr/commit/ff7a4863
Tree: http://git-wip-us.apache.org/repos/asf/incubator-parquet-mr/tree/ff7a4863
Diff: http://git-wip-us.apache.org/repos/asf/incubator-parquet-mr/diff/ff7a4863

Branch: refs/heads/master
Commit: ff7a4863152a4d3873ea038af73024e9999426ac
Parents: bfb3145
Author: Ryan Blue <blue@apache.org>
Authored: Mon Apr 6 15:49:39 2015 -0700
Committer: Ryan Blue <blue@apache.org>
Committed: Mon Apr 6 15:49:39 2015 -0700

----------------------------------------------------------------------
 .../java/parquet/hadoop/ParquetRecordReader.java     | 10 +++++++++-
 .../main/java/parquet/hadoop/util/ContextUtil.java   |  3 ++-
 .../hadoop/util/counters/BenchmarkCounter.java       | 15 +--------------
 .../counters/mapreduce/MapReduceCounterLoader.java   | 15 +--------------
 pom.xml                                              |  1 -
 5 files changed, 13 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-parquet-mr/blob/ff7a4863/parquet-hadoop/src/main/java/parquet/hadoop/ParquetRecordReader.java
----------------------------------------------------------------------
diff --git a/parquet-hadoop/src/main/java/parquet/hadoop/ParquetRecordReader.java b/parquet-hadoop/src/main/java/parquet/hadoop/ParquetRecordReader.java
index 12318f3..abf65c1 100644
--- a/parquet-hadoop/src/main/java/parquet/hadoop/ParquetRecordReader.java
+++ b/parquet-hadoop/src/main/java/parquet/hadoop/ParquetRecordReader.java
@@ -38,8 +38,10 @@ import org.apache.hadoop.mapred.Reporter;
 import org.apache.hadoop.mapreduce.InputSplit;
 import org.apache.hadoop.mapreduce.RecordReader;
 import org.apache.hadoop.mapreduce.TaskAttemptContext;
+import org.apache.hadoop.mapreduce.TaskInputOutputContext;
 
 import org.apache.hadoop.mapreduce.lib.input.FileSplit;
+import parquet.Log;
 import parquet.filter.UnboundRecordFilter;
 import parquet.filter2.compat.FilterCompat;
 import parquet.filter2.compat.FilterCompat.Filter;
@@ -61,6 +63,7 @@ import parquet.schema.MessageType;
  */
 public class ParquetRecordReader<T> extends RecordReader<Void, T> {
 
+  private static final Log LOG = Log.getLog(ParquetRecordReader.class);
   private final InternalParquetRecordReader<T> internalReader;
 
   /**
@@ -127,7 +130,12 @@ public class ParquetRecordReader<T> extends RecordReader<Void,
T> {
   @Override
   public void initialize(InputSplit inputSplit, TaskAttemptContext context)
       throws IOException, InterruptedException {
-    BenchmarkCounter.initCounterFromContext(context);
+    if (context instanceof TaskInputOutputContext<?, ?, ?, ?>) {
+      BenchmarkCounter.initCounterFromContext((TaskInputOutputContext<?, ?, ?, ?>)
context);
+    } else {
+      LOG.error("Can not initialize counter due to context is not a instance of TaskInputOutputContext,
but is "
+              + context.getClass().getCanonicalName());
+    }
 
     initializeInternalReader(toParquetSplit(inputSplit), ContextUtil.getConfiguration(context));
   }

http://git-wip-us.apache.org/repos/asf/incubator-parquet-mr/blob/ff7a4863/parquet-hadoop/src/main/java/parquet/hadoop/util/ContextUtil.java
----------------------------------------------------------------------
diff --git a/parquet-hadoop/src/main/java/parquet/hadoop/util/ContextUtil.java b/parquet-hadoop/src/main/java/parquet/hadoop/util/ContextUtil.java
index 2e25093..bb344ad 100644
--- a/parquet-hadoop/src/main/java/parquet/hadoop/util/ContextUtil.java
+++ b/parquet-hadoop/src/main/java/parquet/hadoop/util/ContextUtil.java
@@ -35,6 +35,7 @@ import org.apache.hadoop.mapreduce.RecordWriter;
 import org.apache.hadoop.mapreduce.StatusReporter;
 import org.apache.hadoop.mapreduce.TaskAttemptContext;
 import org.apache.hadoop.mapreduce.TaskAttemptID;
+import org.apache.hadoop.mapreduce.TaskInputOutputContext;
 
 /*
  * This is based on ContextFactory.java from hadoop-2.0.x sources.
@@ -250,7 +251,7 @@ public class ContextUtil {
     }
   }
 
-  public static Counter getCounter(TaskAttemptContext context,
+  public static Counter getCounter(TaskInputOutputContext context,
                                    String groupName, String counterName) {
     return (Counter) invoke(GET_COUNTER_METHOD, context, groupName, counterName);
   }

http://git-wip-us.apache.org/repos/asf/incubator-parquet-mr/blob/ff7a4863/parquet-hadoop/src/main/java/parquet/hadoop/util/counters/BenchmarkCounter.java
----------------------------------------------------------------------
diff --git a/parquet-hadoop/src/main/java/parquet/hadoop/util/counters/BenchmarkCounter.java
b/parquet-hadoop/src/main/java/parquet/hadoop/util/counters/BenchmarkCounter.java
index 250c5c0..c388d5b 100644
--- a/parquet-hadoop/src/main/java/parquet/hadoop/util/counters/BenchmarkCounter.java
+++ b/parquet-hadoop/src/main/java/parquet/hadoop/util/counters/BenchmarkCounter.java
@@ -20,7 +20,6 @@ package parquet.hadoop.util.counters;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.mapred.Reporter;
-import org.apache.hadoop.mapreduce.TaskAttemptContext;
 import org.apache.hadoop.mapreduce.TaskInputOutputContext;
 import parquet.hadoop.util.counters.mapred.MapRedCounterLoader;
 import parquet.hadoop.util.counters.mapreduce.MapReduceCounterLoader;
@@ -45,23 +44,11 @@ public class BenchmarkCounter {
   private static CounterLoader counterLoader;
 
   /**
-   * This method is for backward compatibility.
-   *
-   * @deprecated
-   *          will be removed in 2.0.0; use
-   *          {@link #initCounterFromContext(TaskAttemptContext)} instead.
-   */
-  @Deprecated
-  public static void initCounterFromContext(TaskInputOutputContext<?, ?, ?, ?> context)
{
-    initCounterFromContext((TaskAttemptContext) context);
-  }
-
-  /**
    * Init counters in hadoop's mapreduce API, support both 1.x and 2.x
    *
    * @param context
    */
-  public static void initCounterFromContext(TaskAttemptContext context) {
+  public static void initCounterFromContext(TaskInputOutputContext<?, ?, ?, ?> context)
{
     counterLoader = new MapReduceCounterLoader(context);
     loadCounters();
   }

http://git-wip-us.apache.org/repos/asf/incubator-parquet-mr/blob/ff7a4863/parquet-hadoop/src/main/java/parquet/hadoop/util/counters/mapreduce/MapReduceCounterLoader.java
----------------------------------------------------------------------
diff --git a/parquet-hadoop/src/main/java/parquet/hadoop/util/counters/mapreduce/MapReduceCounterLoader.java
b/parquet-hadoop/src/main/java/parquet/hadoop/util/counters/mapreduce/MapReduceCounterLoader.java
index c446c0d..75ec1a2 100644
--- a/parquet-hadoop/src/main/java/parquet/hadoop/util/counters/mapreduce/MapReduceCounterLoader.java
+++ b/parquet-hadoop/src/main/java/parquet/hadoop/util/counters/mapreduce/MapReduceCounterLoader.java
@@ -18,7 +18,6 @@
  */
 package parquet.hadoop.util.counters.mapreduce;
 
-import org.apache.hadoop.mapreduce.TaskAttemptContext;
 import org.apache.hadoop.mapreduce.TaskInputOutputContext;
 import parquet.hadoop.util.ContextUtil;
 import parquet.hadoop.util.counters.BenchmarkCounter;
@@ -31,21 +30,9 @@ import parquet.hadoop.util.counters.ICounter;
  * @author Tianshuo Deng
  */
 public class MapReduceCounterLoader implements CounterLoader {
-  private TaskAttemptContext context;
+  private TaskInputOutputContext<?, ?, ?, ?> context;
 
-  /**
-   * This is for backward-compatibility.
-   *
-   * @deprecated
-   *          will be removed in 2.0.0; use
-   *          {@link MapReduceCounterLoader(TaskAttemptContext)} instead.
-   */
-  @Deprecated
   public MapReduceCounterLoader(TaskInputOutputContext<?, ?, ?, ?> context) {
-    this((TaskAttemptContext) context);
-  }
-
-  public MapReduceCounterLoader(TaskAttemptContext context) {
     this.context = context;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-parquet-mr/blob/ff7a4863/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 26ca916..1354983 100644
--- a/pom.xml
+++ b/pom.xml
@@ -237,7 +237,6 @@
                      <exclude>parquet/org/**</exclude>
                      <exclude>parquet/column/**</exclude>
                      <exclude>parquet/hadoop/ParquetInputSplit</exclude>
-                     <exclude>parquet/hadoop/util/ContextUtil</exclude>
                    </excludes>
                  </requireBackwardCompatibility>
                </rules>


Mime
View raw message