You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by bo...@apache.org on 2015/05/08 18:57:36 UTC

hadoop git commit: HADOOP-6842. "hadoop fs -text" does not give a useful text representation of MapWritable objects

Repository: hadoop
Updated Branches:
  refs/heads/trunk 5d708a472 -> cc17c8358


HADOOP-6842. "hadoop fs -text" does not give a useful text representation of MapWritable objects


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/cc17c835
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/cc17c835
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/cc17c835

Branch: refs/heads/trunk
Commit: cc17c83585f581d56e7c42b91464cd7a99e8cf90
Parents: 5d708a4
Author: Robert (Bobby) Evans <ev...@yahoo-inc.com>
Authored: Fri May 8 11:56:59 2015 -0500
Committer: Robert (Bobby) Evans <ev...@yahoo-inc.com>
Committed: Fri May 8 11:57:14 2015 -0500

----------------------------------------------------------------------
 hadoop-common-project/hadoop-common/CHANGES.txt          |  3 +++
 .../src/main/java/org/apache/hadoop/io/MapWritable.java  |  5 +++++
 .../test/java/org/apache/hadoop/io/TestMapWritable.java  | 11 ++++++++++-
 3 files changed, 18 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/cc17c835/hadoop-common-project/hadoop-common/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt
index f4b9246..432c6b6 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -479,6 +479,9 @@ Release 2.8.0 - UNRELEASED
 
   IMPROVEMENTS
 
+    HADOOP-6842. "hadoop fs -text" does not give a useful text representation
+    of MapWritable objects (Akira Ajisaka via bobby)
+
     HADOOP-11719. [Fsshell] Remove bin/hadoop reference from
     GenericOptionsParser default help text.
     (Brahma Reddy Battula via harsh)

http://git-wip-us.apache.org/repos/asf/hadoop/blob/cc17c835/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/MapWritable.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/MapWritable.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/MapWritable.java
index fec168b..0379ec2 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/MapWritable.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/MapWritable.java
@@ -189,4 +189,9 @@ public class MapWritable extends AbstractMapWritable
       instance.put(key, value);
     }
   }
+
+  @Override
+  public String toString() {
+    return instance.toString();
+  }
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/cc17c835/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/TestMapWritable.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/TestMapWritable.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/TestMapWritable.java
index 9284949..4597b90 100644
--- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/TestMapWritable.java
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/TestMapWritable.java
@@ -148,5 +148,14 @@ public class TestMapWritable extends TestCase {
 
     assertEquals(map1.hashCode(), map2.hashCode());
     assertFalse(map1.hashCode() == map3.hashCode());
-}
+  }
+
+  /** Verify text command outputs a useful representation for MapWritable. */
+  public void testToString() {
+    MapWritable map = new MapWritable();
+    final IntWritable key = new IntWritable(5);
+    final Text value = new Text("value");
+    map.put(key, value);
+    assertEquals("{5=value}", map.toString());
+  }
 }