crunch-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwi...@apache.org
Subject svn commit: r1635029 - /crunch/site/trunk/content/user-guide.mdtext
Date Wed, 29 Oct 2014 03:06:51 GMT
Author: jwills
Date: Wed Oct 29 03:06:51 2014
New Revision: 1635029

URL: http://svn.apache.org/r1635029
Log:
Core PTypes generics fixes

Modified:
    crunch/site/trunk/content/user-guide.mdtext

Modified: crunch/site/trunk/content/user-guide.mdtext
URL: http://svn.apache.org/viewvc/crunch/site/trunk/content/user-guide.mdtext?rev=1635029&r1=1635028&r2=1635029&view=diff
==============================================================================
--- crunch/site/trunk/content/user-guide.mdtext (original)
+++ crunch/site/trunk/content/user-guide.mdtext Wed Oct 29 03:06:51 2014
@@ -500,32 +500,32 @@ import java.util.Map;
 public class MyPipeline {
 
   // Common primitive types
-  PType<Integer> intType = ints();
-  PType<Long> longType = longs();
-  PType<Double> doubleType = doubles();
+  PType&lt;Integer&gt; intType = ints();
+  PType&lt;Long&gt; longType = longs();
+  PType&lt;Double&gt; doubleType = doubles();
   // Bytes are represented by java.nio.ByteBuffer
-  PType<ByteBuffer> bytesType = bytes();
+  PType&lt;ByteBuffer&gt; bytesType = bytes();
 
   // A PTableType: using tableOf will return a PTable instead of a
   // PCollection from a parallelDo call.
-  PTableType<String, Boolean> tableType = tableOf(strings(), booleans());
+  PTableType&lt;String, Boolean&gt; tableType = tableOf(strings(), booleans());
  
   // Pair types: 
-  PType<Pair<String, Boolean>> pairType = pairs(strings(), booleans()); 
-  PType<Pair<String, Pair<Long, Long>> nestedPairType = pairs(strings(), pairs(longs(),
longs()));
+  PType&lt;Pair&lt;String, Boolean&gt;&gt; pairType = pairs(strings(), booleans());

+  PType&lt;Pair&lt;String, Pair&lt;Long, Long&gt;&gt; nestedPairType
= pairs(strings(), pairs(longs(), longs()));
 
   // A triple
-  PType<Tuple3<Long, Float, Float>> tripType = trips(longs(), floats(), floats());
+  PType&lt;Tuple3&lt;Long, Float, Float&gt;&gt; tripType = trips(longs(),
floats(), floats());
   // An arbitrary length tuple-- note that we lose the generic type information
-  PType<TupleN> tupleType = tupleN(ints(), ints(), floats(), strings(), strings(),
ints());
+  PType&lt;TupleN&gt; tupleType = tupleN(ints(), ints(), floats(), strings(), strings(),
ints());
 
   // A Collection type
-  PType<Collection<Long>> longsType = collections(longs());
+  PType&lt;Collection&lt;Long&gt;&gt; longsType = collections(longs());
   // A Map Type-- note that the keys are always strings, we only specify the value.
-  PType<Map<String, Boolean>> mapType = maps(booleans());
+  PType&lt;Map&lt;String, Boolean&gt;&gt; mapType = maps(booleans());
 
   // A Pair of collections
-  PType<Pair<Collection<String>, Collection<Long>>> pairColType =
pairs(
+  PType&lt;Pair&lt;Collection&lt;String&gt;, Collection&lt;Long&gt;&gt;&gt;
pairColType = pairs(
       collections(strings()),
       collections(longs()));
 }
@@ -537,17 +537,17 @@ interface, and for the AvroTypeFamily, t
 includes both Avro generic and specific records:
 
 <pre>
-  PType<FooWritable> fwType1 = Writables.records(FooWritable.class);
+  PType&lt;FooWritable&gt; fwType1 = Writables.records(FooWritable.class);
   // The more obvious "writables" method also works.
-  PType<FooWritable> fwType = Writables.writables(FooWritable.class);
+  PType&lt;FooWritable&gt; fwType = Writables.writables(FooWritable.class);
 
   // For a generated Avro class, this works:
-  PType<Person> personType1 = Avros.records(Person.class);
+  PType&lt;Person&gt; personType1 = Avros.records(Person.class);
   // As does this:
-  PType<Person> personType2 = Avros.containers(Person.class); 
+  PType&lt;Person&gt; personType2 = Avros.containers(Person.class); 
   // If you only have a schema, you can create a generic type, like this:
   org.apache.avro.Schema schema = ...;
-  PType<Record> avroGenericType = Avros.generics(schema);
+  PType&lt;Record&gt; avroGenericType = Avros.generics(schema);
 </pre>
 
 The [Avros](apidocs/0.10.0/org/apache/crunch/types/avro/Avros.html) class also has a `reflects`
method for creating PTypes
@@ -575,8 +575,8 @@ the POJO:
     }
   }
 
-  PType<UrlData> urlDataType = Avros.reflects(UrlData.class);
-  PTableType<String, UrlData> pageRankType = Avros.tableOf(Avros.strings(), urlDataType);
+  PType&lt;UrlData&gt; urlDataType = Avros.reflects(UrlData.class);
+  PTableType&lt;String, UrlData&gt; pageRankType = Avros.tableOf(Avros.strings(),
urlDataType);
 </pre>
 
 Avro reflection is a great way to define intermediate types for your Crunch pipelines; not
only is your logic clear
@@ -597,12 +597,12 @@ A common pattern in MapReduce programs i
 easy to work with the POJO directly in your DoFns, while still taking advantage of the custom
serialization of your Writable implementation:
 
 <pre>
-  PType<Foo> fooType = Writables.derived(
+  PType&lt;Foo&gt; fooType = Writables.derived(
       Foo.class,
-      new MapFn<FooWritable, Foo>() {
+      new MapFn&lt;FooWritable, Foo&gt;() {
         public Foo map(FooWritable fw) { return fw.get(); }
       },
-      new MapFn<Foo, FooWritable>() {
+      new MapFn&lt;Foo, FooWritable&gt;() {
         public FooWritable map(Foo foo) { return new FooWritable(foo); }
       },
       Writables.writable(FooWritable.class));



Mime
View raw message