You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hama.apache.org by ed...@apache.org on 2008/08/12 09:28:00 UTC

svn commit: r685071 - in /incubator/hama/trunk/src: java/org/apache/hama/ java/org/apache/hama/mapred/ test/org/apache/hama/ test/org/apache/hama/mapred/

Author: edwardyoon
Date: Tue Aug 12 00:27:59 2008
New Revision: 685071

URL: http://svn.apache.org/viewvc?rev=685071&view=rev
Log:
Replace Matrix(HamaConfiguration, Text) to Matrix(HamaConfiguration, String)

Removed:
    incubator/hama/trunk/src/test/org/apache/hama/Benchmarks.java
Modified:
    incubator/hama/trunk/src/java/org/apache/hama/AbstractMatrix.java
    incubator/hama/trunk/src/java/org/apache/hama/mapred/MatrixMap.java
    incubator/hama/trunk/src/test/org/apache/hama/HamaTestCase.java
    incubator/hama/trunk/src/test/org/apache/hama/TestVector.java
    incubator/hama/trunk/src/test/org/apache/hama/mapred/TestMatrixMapReduce.java

Modified: incubator/hama/trunk/src/java/org/apache/hama/AbstractMatrix.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/java/org/apache/hama/AbstractMatrix.java?rev=685071&r1=685070&r2=685071&view=diff
==============================================================================
--- incubator/hama/trunk/src/java/org/apache/hama/AbstractMatrix.java (original)
+++ incubator/hama/trunk/src/java/org/apache/hama/AbstractMatrix.java Tue Aug 12 00:27:59 2008
@@ -58,9 +58,9 @@
   public void setConfiguration(HamaConfiguration conf) {
     config = (HamaConfiguration) conf;
     try {
-      admin = new HBaseAdmin(config);
+        admin = new HBaseAdmin(config);
     } catch (MasterNotRunningException e) {
-      LOG.info(e);
+      LOG.error(e, e);
     }
   }
 

Modified: incubator/hama/trunk/src/java/org/apache/hama/mapred/MatrixMap.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/java/org/apache/hama/mapred/MatrixMap.java?rev=685071&r1=685070&r2=685071&view=diff
==============================================================================
--- incubator/hama/trunk/src/java/org/apache/hama/mapred/MatrixMap.java (original)
+++ incubator/hama/trunk/src/java/org/apache/hama/mapred/MatrixMap.java Tue Aug 12 00:27:59 2008
@@ -3,7 +3,6 @@
 import java.io.IOException;
 
 import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
-import org.apache.hadoop.io.Text;
 import org.apache.hadoop.io.Writable;
 import org.apache.hadoop.io.WritableComparable;
 import org.apache.hadoop.mapred.FileInputFormat;
@@ -34,7 +33,7 @@
     job.setMapperClass(mapper);
     FileInputFormat.addInputPaths(job, matrixA);
 
-    B = new Matrix(new HamaConfiguration(), new Text(matrixB));
+    B = new Matrix(new HamaConfiguration(), matrixB);
     job.set(MatrixInputFormat.COLUMN_LIST, Constants.COLUMN);
   }
 

Modified: incubator/hama/trunk/src/test/org/apache/hama/HamaTestCase.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/test/org/apache/hama/HamaTestCase.java?rev=685071&r1=685070&r2=685071&view=diff
==============================================================================
--- incubator/hama/trunk/src/test/org/apache/hama/HamaTestCase.java (original)
+++ incubator/hama/trunk/src/test/org/apache/hama/HamaTestCase.java Tue Aug 12 00:27:59 2008
@@ -27,8 +27,6 @@
  */
 public class HamaTestCase extends HBaseClusterTestCase {
   static final Logger LOG = Logger.getLogger(HamaTestCase.class);
-  protected Matrix matrixA;
-  protected Matrix matrixB;
   protected int SIZE = 5;
   protected HamaConfiguration conf = new HamaConfiguration();
   

Modified: incubator/hama/trunk/src/test/org/apache/hama/TestVector.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/test/org/apache/hama/TestVector.java?rev=685071&r1=685070&r2=685071&view=diff
==============================================================================
--- incubator/hama/trunk/src/test/org/apache/hama/TestVector.java (original)
+++ incubator/hama/trunk/src/test/org/apache/hama/TestVector.java Tue Aug 12 00:27:59 2008
@@ -19,8 +19,6 @@
  */
 package org.apache.hama;
 
-import org.apache.hadoop.io.Text;
-
 public class TestVector extends HamaTestCase {
 
   /**
@@ -28,7 +26,7 @@
    */
   public void testCosine() {
     final double result = 0.6978227007909176;
-    Matrix m1 = new Matrix(conf, new Text("cosine"));
+    Matrix m1 = new Matrix(conf, "dotTest");
 
     m1.set(0, 0, 2);
     m1.set(0, 1, 5);
@@ -40,9 +38,6 @@
     m1.set(1, 2, 3);
     m1.set(1, 3, 3);
 
-    LOG.info("get test : " + m1.get(0, 0));
-    LOG.info("get test : " + m1.get(0, 1));
-
     Vector v1 = m1.getRow(0);
     Vector v2 = m1.getRow(1);
 

Modified: incubator/hama/trunk/src/test/org/apache/hama/mapred/TestMatrixMapReduce.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/test/org/apache/hama/mapred/TestMatrixMapReduce.java?rev=685071&r1=685070&r2=685071&view=diff
==============================================================================
--- incubator/hama/trunk/src/test/org/apache/hama/mapred/TestMatrixMapReduce.java (original)
+++ incubator/hama/trunk/src/test/org/apache/hama/mapred/TestMatrixMapReduce.java Tue Aug 12 00:27:59 2008
@@ -22,7 +22,6 @@
 import java.io.IOException;
 
 import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
-import org.apache.hadoop.io.Text;
 import org.apache.hadoop.mapred.JobClient;
 import org.apache.hadoop.mapred.JobConf;
 import org.apache.hama.HamaTestCase;
@@ -37,6 +36,9 @@
  */
 public class TestMatrixMapReduce extends HamaTestCase {
   static final Logger LOG = Logger.getLogger(TestMatrixMapReduce.class);
+  private String A = "matrixA";
+  private String B = "matrixB";
+  private String output = "output";
 
   /** constructor */
   public TestMatrixMapReduce() {
@@ -44,27 +46,26 @@
   }
 
   public void testMatrixMapReduce() throws IOException {
-    matrixA = new Matrix(conf, new Text("MatrixA"));
+    Matrix matrixA = new Matrix(conf, A);
     matrixA.set(0, 0, 1);
     matrixA.set(0, 1, 0);
-    
 
-    matrixA = new Matrix(conf, new Text("MatrixB"));
-    matrixA.set(0, 0, 1);
-    matrixA.set(0, 1, 1);
-    
+    Matrix matrixB = new Matrix(conf, B);
+    matrixB.set(0, 0, 1);
+    matrixB.set(0, 1, 1);
+
     miniMRJob();
   }
 
   public void miniMRJob() throws IOException {
-    Matrix c = new Matrix(conf, new Text("xanadu"));
+    Matrix c = new Matrix(conf, output);
 
     JobConf jobConf = new JobConf(conf, TestMatrixMapReduce.class);
     jobConf.setJobName("test MR job");
 
-    MatrixMap.initJob("MatrixA", "MatrixB", AdditionMap.class,
-        ImmutableBytesWritable.class, Vector.class, jobConf);
-    MatrixReduce.initJob("xanadu", AdditionReduce.class, jobConf);
+    MatrixMap.initJob(A, B, AdditionMap.class, ImmutableBytesWritable.class,
+        Vector.class, jobConf);
+    MatrixReduce.initJob(output, AdditionReduce.class, jobConf);
 
     jobConf.setNumMapTasks(1);
     jobConf.setNumReduceTasks(1);