You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@giraph.apache.org by ma...@apache.org on 2013/03/06 19:33:14 UTC
git commit: GIRAPH-553: Cleanup HCatalogVertexOutputFormat
(majakabiljo)
Updated Branches:
refs/heads/trunk 831e9eaad -> 8cdcf541e
GIRAPH-553: Cleanup HCatalogVertexOutputFormat (majakabiljo)
Project: http://git-wip-us.apache.org/repos/asf/giraph/repo
Commit: http://git-wip-us.apache.org/repos/asf/giraph/commit/8cdcf541
Tree: http://git-wip-us.apache.org/repos/asf/giraph/tree/8cdcf541
Diff: http://git-wip-us.apache.org/repos/asf/giraph/diff/8cdcf541
Branch: refs/heads/trunk
Commit: 8cdcf541e095bdede5fd01bdb94f575a4d38a42f
Parents: 831e9ea
Author: Maja Kabiljo <ma...@maja-mbp.local>
Authored: Wed Mar 6 10:32:20 2013 -0800
Committer: Maja Kabiljo <ma...@maja-mbp.local>
Committed: Wed Mar 6 10:32:20 2013 -0800
----------------------------------------------------------------------
CHANGELOG | 2 +
.../io/hcatalog/HCatalogVertexOutputFormat.java | 68 +++++++++------
2 files changed, 43 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/giraph/blob/8cdcf541/CHANGELOG
----------------------------------------------------------------------
diff --git a/CHANGELOG b/CHANGELOG
index 4cd66b1..d93bf55 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,8 @@
Giraph Change Log
Release 0.2.0 - unreleased
+ GIRAPH-553: Cleanup HCatalogVertexOutputFormat (majakabiljo)
+
GIRAPH-545: Improve Facebook Hadoop dependency (nitay)
GIRAPH-541: Log before observers (nitay)
http://git-wip-us.apache.org/repos/asf/giraph/blob/8cdcf541/giraph-hcatalog/src/main/java/org/apache/giraph/io/hcatalog/HCatalogVertexOutputFormat.java
----------------------------------------------------------------------
diff --git a/giraph-hcatalog/src/main/java/org/apache/giraph/io/hcatalog/HCatalogVertexOutputFormat.java b/giraph-hcatalog/src/main/java/org/apache/giraph/io/hcatalog/HCatalogVertexOutputFormat.java
index 4bab7dd..070644f 100644
--- a/giraph-hcatalog/src/main/java/org/apache/giraph/io/hcatalog/HCatalogVertexOutputFormat.java
+++ b/giraph-hcatalog/src/main/java/org/apache/giraph/io/hcatalog/HCatalogVertexOutputFormat.java
@@ -74,14 +74,21 @@ public abstract class HCatalogVertexOutputFormat<
}
/**
- * Abstract class that users should
- * subclass based on their specific vertex
- * output. Users should implement
- * writeVertex to create a HCatRecord that is
- * valid to for writing by HCatalogRecordWriter.
+ * Abstract class that users should
+ * subclass based on their specific vertex
+ * output. Users should implement
+ * writeVertex to create a HCatRecord that is
+ * valid to for writing by HCatalogRecordWriter.
+ *
+ * @param <I> Vertex id
+ * @param <V> Vertex value
+ * @param <E> Edge value
*/
- protected abstract class HCatalogVertexWriter implements
- VertexWriter<I, V, E> {
+ protected abstract static class HCatalogVertexWriter<
+ I extends WritableComparable,
+ V extends Writable,
+ E extends Writable>
+ implements VertexWriter<I, V, E> {
/** Internal HCatRecordWriter */
private RecordWriter<WritableComparable<?>, HCatRecord> hCatRecordWriter;
@@ -93,7 +100,7 @@ public abstract class HCatalogVertexOutputFormat<
* @param hCatRecordWriter
* Internal writer
*/
- private void initialize(
+ protected void initialize(
RecordWriter<WritableComparable<?>,
HCatRecord> hCatRecordWriter) {
this.hCatRecordWriter = hCatRecordWriter;
@@ -134,22 +141,29 @@ public abstract class HCatalogVertexOutputFormat<
* create vertex writer.
* @return HCatalogVertexWriter
*/
- protected abstract HCatalogVertexWriter createVertexWriter();
+ protected abstract HCatalogVertexWriter<I, V, E> createVertexWriter();
@Override
public final VertexWriter<I, V, E> createVertexWriter(
TaskAttemptContext context) throws IOException,
InterruptedException {
- HCatalogVertexWriter writer = createVertexWriter();
+ HCatalogVertexWriter<I, V, E> writer = createVertexWriter();
writer.initialize(hCatOutputFormat.getRecordWriter(context));
return writer;
}
/**
- * HCatalogVertexWriter to write each vertex in each row.
- */
- protected abstract class SingleRowHCatalogVertexWriter extends
- HCatalogVertexWriter {
+ * HCatalogVertexWriter to write each vertex in each row.
+ *
+ * @param <I> Vertex id
+ * @param <V> Vertex value
+ * @param <E> Edge value
+ */
+ protected abstract static class SingleRowHCatalogVertexWriter<
+ I extends WritableComparable,
+ V extends Writable,
+ E extends Writable>
+ extends HCatalogVertexWriter<I, V, E> {
/**
* get num columns
* @return intcolumns
@@ -176,12 +190,7 @@ public abstract class HCatalogVertexOutputFormat<
}
@Override
- // XXX It is important not to put generic type signature <I,V,E,?> after
- // Vertex. Otherwise, any class that extends this will not compile
- // because of not implementing the VertexWriter#writeVertex. Mystery of
- // Java Generics :(
- @SuppressWarnings("unchecked")
- public final void writeVertex(Vertex vertex) throws IOException,
+ public final void writeVertex(Vertex<I, V, E, ?> vertex) throws IOException,
InterruptedException {
getRecordWriter().write(null, createRecord(vertex));
}
@@ -189,10 +198,17 @@ public abstract class HCatalogVertexOutputFormat<
}
/**
- * HCatalogVertexWriter to write each vertex in multiple rows.
- */
- public abstract class MultiRowHCatalogVertexWriter extends
- HCatalogVertexWriter {
+ * HCatalogVertexWriter to write each vertex in multiple rows.
+ *
+ * @param <I> Vertex id
+ * @param <V> Vertex value
+ * @param <E> Edge value
+ */
+ public abstract static class MultiRowHCatalogVertexWriter<
+ I extends WritableComparable,
+ V extends Writable,
+ E extends Writable>
+ extends HCatalogVertexWriter<I, V, E> {
/**
* create records
* @param vertex to populate records
@@ -202,9 +218,7 @@ public abstract class HCatalogVertexOutputFormat<
Vertex<I, V, E, ?> vertex);
@Override
- // XXX Same thing here. No Generics for Vertex here.
- @SuppressWarnings("unchecked")
- public final void writeVertex(Vertex vertex) throws IOException,
+ public final void writeVertex(Vertex<I, V, E, ?> vertex) throws IOException,
InterruptedException {
Iterable<HCatRecord> records = createRecords(vertex);
for (HCatRecord record : records) {