| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <!-- NewPage --> |
| <html lang="en"> |
| <head> |
| <!-- Generated by javadoc (1.8.0_161-google-v7) on Thu Oct 18 16:14:35 PDT 2018 --> |
| <title>AvroIO (Apache Beam 2.8.0-SNAPSHOT)</title> |
| <meta name="date" content="2018-10-18"> |
| <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> |
| <script type="text/javascript" src="../../../../../script.js"></script> |
| </head> |
| <body> |
| <script type="text/javascript"><!-- |
| try { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="AvroIO (Apache Beam 2.8.0-SNAPSHOT)"; |
| } |
| } |
| catch(err) { |
| } |
| //--> |
| var methods = {"i0":9,"i1":9,"i2":9,"i3":9,"i4":9,"i5":9,"i6":9,"i7":9,"i8":9,"i9":9,"i10":9,"i11":9,"i12":9,"i13":9,"i14":9,"i15":9}; |
| var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],8:["t4","Concrete Methods"]}; |
| var altColor = "altColor"; |
| var rowColor = "rowColor"; |
| var tableTab = "tableTab"; |
| var activeTableTab = "activeTableTab"; |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="topNav"><a name="navbar.top"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.top.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li>Prev Class</li> |
| <li><a href="../../../../../org/apache/beam/sdk/io/AvroIO.Parse.html" title="class in org.apache.beam.sdk.io"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../../index.html?org/apache/beam/sdk/io/AvroIO.html" target="_top">Frames</a></li> |
| <li><a href="AvroIO.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_top"> |
| <li><a href="../../../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_top"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li><a href="#nested.class.summary">Nested</a> | </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip.navbar.top"> |
| <!-- --> |
| </a></div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <div class="header"> |
| <div class="subTitle">org.apache.beam.sdk.io</div> |
| <h2 title="Class AvroIO" class="title">Class AvroIO</h2> |
| </div> |
| <div class="contentContainer"> |
| <ul class="inheritance"> |
| <li>java.lang.Object</li> |
| <li> |
| <ul class="inheritance"> |
| <li>org.apache.beam.sdk.io.AvroIO</li> |
| </ul> |
| </li> |
| </ul> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <hr> |
| <br> |
| <pre>public class <span class="typeNameLabel">AvroIO</span> |
| extends java.lang.Object</pre> |
| <div class="block"><a href="../../../../../org/apache/beam/sdk/transforms/PTransform.html" title="class in org.apache.beam.sdk.transforms"><code>PTransform</code></a>s for reading and writing Avro files. |
| |
| <h2>Reading Avro files</h2> |
| |
| <p>To read a <a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values"><code>PCollection</code></a> from one or more Avro files with the same schema known at |
| pipeline construction time, use <a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#read-java.lang.Class-"><code>read(java.lang.Class<T>)</code></a>, using <a href="../../../../../org/apache/beam/sdk/io/AvroIO.Read.html#from-org.apache.beam.sdk.options.ValueProvider-"><code>AvroIO.Read.from(org.apache.beam.sdk.options.ValueProvider<java.lang.String>)</code></a> to specify the |
| filename or filepattern to read from. If the filepatterns to be read are themselves in a <a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values"><code>PCollection</code></a>, apply <a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#readAll-java.lang.Class-"><code>readAll(java.lang.Class<T>)</code></a>. If the schema is unknown at pipeline construction time, use |
| <a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#parseGenericRecords-org.apache.beam.sdk.transforms.SerializableFunction-"><code>parseGenericRecords(org.apache.beam.sdk.transforms.SerializableFunction<org.apache.avro.generic.GenericRecord, T>)</code></a> or <a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#parseAllGenericRecords-org.apache.beam.sdk.transforms.SerializableFunction-"><code>parseAllGenericRecords(org.apache.beam.sdk.transforms.SerializableFunction<org.apache.avro.generic.GenericRecord, T>)</code></a>. |
| |
| <p>Many configuration options below apply to several or all of these transforms. |
| |
| <p>See <a href="../../../../../org/apache/beam/sdk/io/FileSystems.html" title="class in org.apache.beam.sdk.io"><code>FileSystems</code></a> for information on supported file systems and filepatterns. |
| |
| <h3>Filepattern expansion and watching</h3> |
| |
| <p>By default, <a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#read-java.lang.Class-"><code>read(java.lang.Class<T>)</code></a> prohibits filepatterns that match no files, and <a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#readAll-java.lang.Class-"><code>readAll(java.lang.Class<T>)</code></a> |
| allows them in case the filepattern contains a glob wildcard character. Use <a href="../../../../../org/apache/beam/sdk/io/AvroIO.Read.html#withEmptyMatchTreatment-org.apache.beam.sdk.io.fs.EmptyMatchTreatment-"><code>AvroIO.Read.withEmptyMatchTreatment(org.apache.beam.sdk.io.fs.EmptyMatchTreatment)</code></a> to configure this behavior. |
| |
| <p>By default, the filepatterns are expanded only once. <a href="../../../../../org/apache/beam/sdk/io/AvroIO.Read.html#watchForNewFiles-org.joda.time.Duration-org.apache.beam.sdk.transforms.Watch.Growth.TerminationCondition-"><code>AvroIO.Read.watchForNewFiles(org.joda.time.Duration, org.apache.beam.sdk.transforms.Watch.Growth.TerminationCondition<java.lang.String, ?>)</code></a> allows |
| streaming of new files matching the filepattern(s). |
| |
| <h3>Reading records of a known schema</h3> |
| |
| <p>To read specific records, such as Avro-generated classes, use <a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#read-java.lang.Class-"><code>read(Class)</code></a>. To read |
| <a href="http://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/generic/GenericRecord.html?is-external=true" title="class or interface in org.apache.avro.generic"><code>GenericRecords</code></a>, use <a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#readGenericRecords-org.apache.avro.Schema-"><code>readGenericRecords(Schema)</code></a> which takes a |
| <a href="http://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/Schema.html?is-external=true" title="class or interface in org.apache.avro"><code>Schema</code></a> object, or <a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#readGenericRecords-java.lang.String-"><code>readGenericRecords(String)</code></a> which takes an Avro schema in a |
| JSON-encoded string form. An exception will be thrown if a record doesn't match the specified |
| schema. Likewise, to read a <a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values"><code>PCollection</code></a> of filepatterns, apply <a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#readAllGenericRecords-org.apache.avro.Schema-"><code>readAllGenericRecords(org.apache.avro.Schema)</code></a>. |
| |
| <p>For example: |
| |
| <pre><code> |
| Pipeline p = ...; |
| |
| // Read Avro-generated classes from files on GCS |
| PCollection<AvroAutoGenClass> records = |
| p.apply(AvroIO.read(AvroAutoGenClass.class).from("gs://my_bucket/path/to/records-*.avro")); |
| |
| // Read GenericRecord's of the given schema from files on GCS |
| Schema schema = new Schema.Parser().parse(new File("schema.avsc")); |
| PCollection<GenericRecord> records = |
| p.apply(AvroIO.readGenericRecords(schema) |
| .from("gs://my_bucket/path/to/records-*.avro")); |
| </code></pre> |
| |
| <h3>Reading records of an unknown schema</h3> |
| |
| <p>To read records from files whose schema is unknown at pipeline construction time or differs |
| between files, use <a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#parseGenericRecords-org.apache.beam.sdk.transforms.SerializableFunction-"><code>parseGenericRecords(org.apache.beam.sdk.transforms.SerializableFunction<org.apache.avro.generic.GenericRecord, T>)</code></a> - in this case, you will need to specify a |
| parsing function for converting each <a href="http://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/generic/GenericRecord.html?is-external=true" title="class or interface in org.apache.avro.generic"><code>GenericRecord</code></a> into a value of your custom type. |
| Likewise, to read a <a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values"><code>PCollection</code></a> of filepatterns with unknown schema, use <a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#parseAllGenericRecords-org.apache.beam.sdk.transforms.SerializableFunction-"><code>parseAllGenericRecords(org.apache.beam.sdk.transforms.SerializableFunction<org.apache.avro.generic.GenericRecord, T>)</code></a>. |
| |
| <p>For example: |
| |
| <pre><code> |
| Pipeline p = ...; |
| |
| PCollection<Foo> records = |
| p.apply(AvroIO.parseGenericRecords(new SerializableFunction<GenericRecord, Foo>() { |
| public Foo apply(GenericRecord record) { |
| // If needed, access the schema of the record using record.getSchema() |
| return ...; |
| } |
| })); |
| </code></pre> |
| |
| <h3>Reading from a <a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values"><code>PCollection</code></a> of filepatterns</h3> |
| |
| <pre><code> |
| Pipeline p = ...; |
| |
| PCollection<String> filepatterns = p.apply(...); |
| PCollection<AvroAutoGenClass> records = |
| filepatterns.apply(AvroIO.read(AvroAutoGenClass.class)); |
| PCollection<GenericRecord> genericRecords = |
| filepatterns.apply(AvroIO.readGenericRecords(schema)); |
| PCollection<Foo> records = |
| filepatterns.apply(AvroIO.parseAllGenericRecords(new SerializableFunction...); |
| </code></pre> |
| |
| <h3>Streaming new files matching a filepattern</h3> |
| |
| <pre><code> |
| Pipeline p = ...; |
| |
| PCollection<AvroAutoGenClass> lines = p.apply(AvroIO |
| .read(AvroAutoGenClass.class) |
| .from("gs://my_bucket/path/to/records-*.avro") |
| .watchForNewFiles( |
| // Check for new files every minute |
| Duration.standardMinutes(1), |
| // Stop watching the filepattern if no new files appear within an hour |
| afterTimeSinceNewOutput(Duration.standardHours(1)))); |
| </code></pre> |
| |
| <h3>Reading a very large number of files</h3> |
| |
| <p>If it is known that the filepattern will match a very large number of files (e.g. tens of |
| thousands or more), use <a href="../../../../../org/apache/beam/sdk/io/AvroIO.Read.html#withHintMatchesManyFiles--"><code>AvroIO.Read.withHintMatchesManyFiles()</code></a> for better performance and |
| scalability. Note that it may decrease performance if the filepattern matches only a small number |
| of files. |
| |
| <h2>Writing Avro files</h2> |
| |
| <p>To write a <a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values"><code>PCollection</code></a> to one or more Avro files, use <a href="../../../../../org/apache/beam/sdk/io/AvroIO.Write.html" title="class in org.apache.beam.sdk.io"><code>AvroIO.Write</code></a>, using |
| <code>AvroIO.write().to(String)</code> to specify the output filename prefix. The default <a href="../../../../../org/apache/beam/sdk/io/DefaultFilenamePolicy.html" title="class in org.apache.beam.sdk.io"><code>DefaultFilenamePolicy</code></a> will use this prefix, in conjunction with a <a href="../../../../../org/apache/beam/sdk/io/ShardNameTemplate.html" title="class in org.apache.beam.sdk.io"><code>ShardNameTemplate</code></a> (set |
| via <a href="../../../../../org/apache/beam/sdk/io/AvroIO.Write.html#withShardNameTemplate-java.lang.String-"><code>AvroIO.Write.withShardNameTemplate(String)</code></a>) and optional filename suffix (set via <a href="../../../../../org/apache/beam/sdk/io/AvroIO.Write.html#withSuffix-java.lang.String-"><code>AvroIO.Write.withSuffix(String)</code></a>, to generate output filenames in a sharded way. You can override this |
| default write filename policy using <a href="../../../../../org/apache/beam/sdk/io/AvroIO.Write.html#to-org.apache.beam.sdk.io.FileBasedSink.FilenamePolicy-"><code>AvroIO.Write.to(FileBasedSink.FilenamePolicy)</code></a> to specify a |
| custom file naming policy. |
| |
| <p>By default, <a href="../../../../../org/apache/beam/sdk/io/AvroIO.Write.html" title="class in org.apache.beam.sdk.io"><code>AvroIO.Write</code></a> produces output files that are compressed using the <a href="http://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/file/Codec.html?is-external=true" title="class or interface in org.apache.avro.file"><code>CodecFactory.snappyCodec()</code></a>. This default can be changed or overridden |
| using <a href="../../../../../org/apache/beam/sdk/io/AvroIO.Write.html#withCodec-org.apache.avro.file.CodecFactory-"><code>AvroIO.Write.withCodec(org.apache.avro.file.CodecFactory)</code></a>. |
| |
| <h3>Writing specific or generic records</h3> |
| |
| <p>To write specific records, such as Avro-generated classes, use <a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#write-java.lang.Class-"><code>write(Class)</code></a>. To write |
| <a href="http://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/generic/GenericRecord.html?is-external=true" title="class or interface in org.apache.avro.generic"><code>GenericRecords</code></a>, use either <a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#writeGenericRecords-org.apache.avro.Schema-"><code>writeGenericRecords(Schema)</code></a> which takes |
| a <a href="http://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/Schema.html?is-external=true" title="class or interface in org.apache.avro"><code>Schema</code></a> object, or <a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#writeGenericRecords-java.lang.String-"><code>writeGenericRecords(String)</code></a> which takes a schema in a |
| JSON-encoded string form. An exception will be thrown if a record doesn't match the specified |
| schema. |
| |
| <p>For example: |
| |
| <pre><code> |
| // A simple Write to a local file (only runs locally): |
| PCollection<AvroAutoGenClass> records = ...; |
| records.apply(AvroIO.write(AvroAutoGenClass.class).to("/path/to/file.avro")); |
| |
| // A Write to a sharded GCS file (runs locally and using remote execution): |
| Schema schema = new Schema.Parser().parse(new File("schema.avsc")); |
| PCollection<GenericRecord> records = ...; |
| records.apply("WriteToAvro", AvroIO.writeGenericRecords(schema) |
| .to("gs://my_bucket/path/to/numbers") |
| .withSuffix(".avro")); |
| </code></pre> |
| |
| <h3>Writing windowed or unbounded data</h3> |
| |
| <p>By default, all input is put into the global window before writing. If per-window writes are |
| desired - for example, when using a streaming runner - <a href="../../../../../org/apache/beam/sdk/io/AvroIO.Write.html#withWindowedWrites--"><code>AvroIO.Write.withWindowedWrites()</code></a> |
| will cause windowing and triggering to be preserved. When producing windowed writes with a |
| streaming runner that supports triggers, the number of output shards must be set explicitly using |
| <a href="../../../../../org/apache/beam/sdk/io/AvroIO.Write.html#withNumShards-int-"><code>AvroIO.Write.withNumShards(int)</code></a>; some runners may set this for you to a runner-chosen |
| value, so you may need not set it yourself. A <a href="../../../../../org/apache/beam/sdk/io/FileBasedSink.FilenamePolicy.html" title="class in org.apache.beam.sdk.io"><code>FileBasedSink.FilenamePolicy</code></a> must be set, |
| and unique windows and triggers must produce unique filenames. |
| |
| <h3>Writing data to multiple destinations</h3> |
| |
| <p>The following shows a more-complex example of AvroIO.Write usage, generating dynamic file |
| destinations as well as a dynamic Avro schema per file. In this example, a PCollection of user |
| events (e.g. actions on a website) is written out to Avro files. Each event contains the user id |
| as an integer field. We want events for each user to go into a specific directory for that user, |
| and each user's data should be written with a specific schema for that user; a side input is |
| used, so the schema can be calculated in a different stage. |
| |
| <pre><code> |
| // This is the user class that controls dynamic destinations for this avro write. The input to |
| // AvroIO.Write will be UserEvent, and we will be writing GenericRecords to the file (in order |
| // to have dynamic schemas). Everything is per userid, so we define a dynamic destination type |
| // of Integer. |
| class UserDynamicAvroDestinations |
| extends DynamicAvroDestinations<UserEvent, Integer, GenericRecord> { |
| private final PCollectionView<Map<Integer, String>> userToSchemaMap; |
| public UserDynamicAvroDestinations( PCollectionView<Map<Integer, String>> userToSchemaMap) { |
| this.userToSchemaMap = userToSchemaMap; |
| } |
| public GenericRecord formatRecord(UserEvent record) { |
| return formatUserRecord(record, getSchema(record.getUserId())); |
| } |
| public Schema getSchema(Integer userId) { |
| return new Schema.Parser().parse(sideInput(userToSchemaMap).get(userId)); |
| } |
| public Integer getDestination(UserEvent record) { |
| return record.getUserId(); |
| } |
| public Integer getDefaultDestination() { |
| return 0; |
| } |
| public FilenamePolicy getFilenamePolicy(Integer userId) { |
| return DefaultFilenamePolicy.fromParams(new Params().withBaseFilename(baseDir + "/user-" |
| + userId + "/events")); |
| } |
| public List<PCollectionView<?>> getSideInputs() { |
| return ImmutableList.<PCollectionView<?>>of(userToSchemaMap); |
| } |
| } |
| PCollection<UserEvents> events = ...; |
| PCollectionView<Map<Integer, String>> userToSchemaMap = events.apply( |
| "ComputePerUserSchemas", new ComputePerUserSchemas()); |
| events.apply("WriteAvros", AvroIO.<Integer>writeCustomTypeToGenericRecords() |
| .to(new UserDynamicAvroDestinations(userToSchemaMap))); |
| </code></pre></div> |
| </li> |
| </ul> |
| </div> |
| <div class="summary"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ======== NESTED CLASS SUMMARY ======== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="nested.class.summary"> |
| <!-- --> |
| </a> |
| <h3>Nested Class Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Nested Class Summary table, listing nested classes, and an explanation"> |
| <caption><span>Nested Classes</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Class and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static class </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/io/AvroIO.Parse.html" title="class in org.apache.beam.sdk.io">AvroIO.Parse</a><<a href="../../../../../org/apache/beam/sdk/io/AvroIO.Parse.html" title="type parameter in AvroIO.Parse">T</a>></span></code> |
| <div class="block">Implementation of <a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#parseGenericRecords-org.apache.beam.sdk.transforms.SerializableFunction-"><code>parseGenericRecords(org.apache.beam.sdk.transforms.SerializableFunction<org.apache.avro.generic.GenericRecord, T>)</code></a>.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>static class </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/io/AvroIO.ParseAll.html" title="class in org.apache.beam.sdk.io">AvroIO.ParseAll</a><<a href="../../../../../org/apache/beam/sdk/io/AvroIO.ParseAll.html" title="type parameter in AvroIO.ParseAll">T</a>></span></code> |
| <div class="block">Implementation of <a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#parseAllGenericRecords-org.apache.beam.sdk.transforms.SerializableFunction-"><code>parseAllGenericRecords(org.apache.beam.sdk.transforms.SerializableFunction<org.apache.avro.generic.GenericRecord, T>)</code></a>.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static class </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/io/AvroIO.Read.html" title="class in org.apache.beam.sdk.io">AvroIO.Read</a><<a href="../../../../../org/apache/beam/sdk/io/AvroIO.Read.html" title="type parameter in AvroIO.Read">T</a>></span></code> |
| <div class="block">Implementation of <a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#read-java.lang.Class-"><code>read(java.lang.Class<T>)</code></a> and <a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#readGenericRecords-org.apache.avro.Schema-"><code>readGenericRecords(org.apache.avro.Schema)</code></a>.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>static class </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/io/AvroIO.ReadAll.html" title="class in org.apache.beam.sdk.io">AvroIO.ReadAll</a><<a href="../../../../../org/apache/beam/sdk/io/AvroIO.ReadAll.html" title="type parameter in AvroIO.ReadAll">T</a>></span></code> |
| <div class="block">Implementation of <a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#readAll-java.lang.Class-"><code>readAll(java.lang.Class<T>)</code></a>.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static interface </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/io/AvroIO.RecordFormatter.html" title="interface in org.apache.beam.sdk.io">AvroIO.RecordFormatter</a><<a href="../../../../../org/apache/beam/sdk/io/AvroIO.RecordFormatter.html" title="type parameter in AvroIO.RecordFormatter">ElementT</a>></span></code> |
| <div class="block">Formats an element of a user type into a record with the given schema.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>static class </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/io/AvroIO.Sink.html" title="class in org.apache.beam.sdk.io">AvroIO.Sink</a><<a href="../../../../../org/apache/beam/sdk/io/AvroIO.Sink.html" title="type parameter in AvroIO.Sink">ElementT</a>></span></code> |
| <div class="block">Implementation of <a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#sink-java.lang.Class-"><code>sink(java.lang.Class<ElementT>)</code></a> and <a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#sinkViaGenericRecords-org.apache.avro.Schema-org.apache.beam.sdk.io.AvroIO.RecordFormatter-"><code>sinkViaGenericRecords(org.apache.avro.Schema, org.apache.beam.sdk.io.AvroIO.RecordFormatter<ElementT>)</code></a>.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static class </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/io/AvroIO.TypedWrite.html" title="class in org.apache.beam.sdk.io">AvroIO.TypedWrite</a><<a href="../../../../../org/apache/beam/sdk/io/AvroIO.TypedWrite.html" title="type parameter in AvroIO.TypedWrite">UserT</a>,<a href="../../../../../org/apache/beam/sdk/io/AvroIO.TypedWrite.html" title="type parameter in AvroIO.TypedWrite">DestinationT</a>,<a href="../../../../../org/apache/beam/sdk/io/AvroIO.TypedWrite.html" title="type parameter in AvroIO.TypedWrite">OutputT</a>></span></code> |
| <div class="block">Implementation of <a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#write-java.lang.Class-"><code>write(java.lang.Class<T>)</code></a>.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>static class </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/io/AvroIO.Write.html" title="class in org.apache.beam.sdk.io">AvroIO.Write</a><<a href="../../../../../org/apache/beam/sdk/io/AvroIO.Write.html" title="type parameter in AvroIO.Write">T</a>></span></code> |
| <div class="block">This class is used as the default return value of <a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#write-java.lang.Class-"><code>write(java.lang.Class<T>)</code></a></div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method.summary"> |
| <!-- --> |
| </a> |
| <h3>Method Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> |
| <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Method and Description</th> |
| </tr> |
| <tr id="i0" class="altColor"> |
| <td class="colFirst"><code>static <UserT,OutputT><br><a href="../../../../../org/apache/beam/sdk/io/DynamicAvroDestinations.html" title="class in org.apache.beam.sdk.io">DynamicAvroDestinations</a><UserT,java.lang.Void,OutputT></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#constantDestinations-org.apache.beam.sdk.io.FileBasedSink.FilenamePolicy-org.apache.avro.Schema-java.util.Map-org.apache.avro.file.CodecFactory-org.apache.beam.sdk.transforms.SerializableFunction-">constantDestinations</a></span>(<a href="../../../../../org/apache/beam/sdk/io/FileBasedSink.FilenamePolicy.html" title="class in org.apache.beam.sdk.io">FileBasedSink.FilenamePolicy</a> filenamePolicy, |
| <a href="http://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/Schema.html?is-external=true" title="class or interface in org.apache.avro">Schema</a> schema, |
| java.util.Map<java.lang.String,java.lang.Object> metadata, |
| <a href="http://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/file/CodecFactory.html?is-external=true" title="class or interface in org.apache.avro.file">CodecFactory</a> codec, |
| <a href="../../../../../org/apache/beam/sdk/transforms/SerializableFunction.html" title="interface in org.apache.beam.sdk.transforms">SerializableFunction</a><UserT,OutputT> formatFunction)</code> |
| <div class="block">Returns a <a href="../../../../../org/apache/beam/sdk/io/DynamicAvroDestinations.html" title="class in org.apache.beam.sdk.io"><code>DynamicAvroDestinations</code></a> that always returns the same <a href="../../../../../org/apache/beam/sdk/io/FileBasedSink.FilenamePolicy.html" title="class in org.apache.beam.sdk.io"><code>FileBasedSink.FilenamePolicy</code></a>, |
| schema, metadata, and codec.</div> |
| </td> |
| </tr> |
| <tr id="i1" class="rowColor"> |
| <td class="colFirst"><code>static <T> <a href="../../../../../org/apache/beam/sdk/io/AvroIO.ParseAll.html" title="class in org.apache.beam.sdk.io">AvroIO.ParseAll</a><T></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#parseAllGenericRecords-org.apache.beam.sdk.transforms.SerializableFunction-">parseAllGenericRecords</a></span>(<a href="../../../../../org/apache/beam/sdk/transforms/SerializableFunction.html" title="interface in org.apache.beam.sdk.transforms">SerializableFunction</a><<a href="http://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/generic/GenericRecord.html?is-external=true" title="class or interface in org.apache.avro.generic">GenericRecord</a>,T> parseFn)</code> |
| <div class="block">Like <a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#parseGenericRecords-org.apache.beam.sdk.transforms.SerializableFunction-"><code>parseGenericRecords(SerializableFunction)</code></a>, but reads each filepattern in the |
| input <a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values"><code>PCollection</code></a>.</div> |
| </td> |
| </tr> |
| <tr id="i2" class="altColor"> |
| <td class="colFirst"><code>static <T> <a href="../../../../../org/apache/beam/sdk/io/AvroIO.Parse.html" title="class in org.apache.beam.sdk.io">AvroIO.Parse</a><T></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#parseGenericRecords-org.apache.beam.sdk.transforms.SerializableFunction-">parseGenericRecords</a></span>(<a href="../../../../../org/apache/beam/sdk/transforms/SerializableFunction.html" title="interface in org.apache.beam.sdk.transforms">SerializableFunction</a><<a href="http://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/generic/GenericRecord.html?is-external=true" title="class or interface in org.apache.avro.generic">GenericRecord</a>,T> parseFn)</code> |
| <div class="block">Reads Avro file(s) containing records of an unspecified schema and converting each record to a |
| custom type.</div> |
| </td> |
| </tr> |
| <tr id="i3" class="rowColor"> |
| <td class="colFirst"><code>static <T> <a href="../../../../../org/apache/beam/sdk/io/AvroIO.Read.html" title="class in org.apache.beam.sdk.io">AvroIO.Read</a><T></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#read-java.lang.Class-">read</a></span>(java.lang.Class<T> recordClass)</code> |
| <div class="block">Reads records of the given type from an Avro file (or multiple Avro files matching a pattern).</div> |
| </td> |
| </tr> |
| <tr id="i4" class="altColor"> |
| <td class="colFirst"><code>static <T> <a href="../../../../../org/apache/beam/sdk/io/AvroIO.ReadAll.html" title="class in org.apache.beam.sdk.io">AvroIO.ReadAll</a><T></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#readAll-java.lang.Class-">readAll</a></span>(java.lang.Class<T> recordClass)</code> |
| <div class="block">Like <a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#read-java.lang.Class-"><code>read(java.lang.Class<T>)</code></a>, but reads each filepattern in the input <a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values"><code>PCollection</code></a>.</div> |
| </td> |
| </tr> |
| <tr id="i5" class="rowColor"> |
| <td class="colFirst"><code>static <a href="../../../../../org/apache/beam/sdk/io/AvroIO.ReadAll.html" title="class in org.apache.beam.sdk.io">AvroIO.ReadAll</a><<a href="http://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/generic/GenericRecord.html?is-external=true" title="class or interface in org.apache.avro.generic">GenericRecord</a>></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#readAllGenericRecords-org.apache.avro.Schema-">readAllGenericRecords</a></span>(<a href="http://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/Schema.html?is-external=true" title="class or interface in org.apache.avro">Schema</a> schema)</code> |
| <div class="block">Like <a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#readGenericRecords-org.apache.avro.Schema-"><code>readGenericRecords(Schema)</code></a>, but reads each filepattern in the input <a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values"><code>PCollection</code></a>.</div> |
| </td> |
| </tr> |
| <tr id="i6" class="altColor"> |
| <td class="colFirst"><code>static <a href="../../../../../org/apache/beam/sdk/io/AvroIO.ReadAll.html" title="class in org.apache.beam.sdk.io">AvroIO.ReadAll</a><<a href="http://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/generic/GenericRecord.html?is-external=true" title="class or interface in org.apache.avro.generic">GenericRecord</a>></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#readAllGenericRecords-java.lang.String-">readAllGenericRecords</a></span>(java.lang.String schema)</code> |
| <div class="block">Like <a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#readGenericRecords-java.lang.String-"><code>readGenericRecords(String)</code></a>, but reads each filepattern in the input <a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values"><code>PCollection</code></a>.</div> |
| </td> |
| </tr> |
| <tr id="i7" class="rowColor"> |
| <td class="colFirst"><code>static <a href="../../../../../org/apache/beam/sdk/io/AvroIO.Read.html" title="class in org.apache.beam.sdk.io">AvroIO.Read</a><<a href="http://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/generic/GenericRecord.html?is-external=true" title="class or interface in org.apache.avro.generic">GenericRecord</a>></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#readGenericRecords-org.apache.avro.Schema-">readGenericRecords</a></span>(<a href="http://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/Schema.html?is-external=true" title="class or interface in org.apache.avro">Schema</a> schema)</code> |
| <div class="block">Reads Avro file(s) containing records of the specified schema.</div> |
| </td> |
| </tr> |
| <tr id="i8" class="altColor"> |
| <td class="colFirst"><code>static <a href="../../../../../org/apache/beam/sdk/io/AvroIO.Read.html" title="class in org.apache.beam.sdk.io">AvroIO.Read</a><<a href="http://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/generic/GenericRecord.html?is-external=true" title="class or interface in org.apache.avro.generic">GenericRecord</a>></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#readGenericRecords-java.lang.String-">readGenericRecords</a></span>(java.lang.String schema)</code> |
| <div class="block">Reads Avro file(s) containing records of the specified schema.</div> |
| </td> |
| </tr> |
| <tr id="i9" class="rowColor"> |
| <td class="colFirst"><code>static <ElementT> <a href="../../../../../org/apache/beam/sdk/io/AvroIO.Sink.html" title="class in org.apache.beam.sdk.io">AvroIO.Sink</a><ElementT></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#sink-java.lang.Class-">sink</a></span>(java.lang.Class<ElementT> clazz)</code> |
| <div class="block">A <a href="../../../../../org/apache/beam/sdk/io/AvroIO.Sink.html" title="class in org.apache.beam.sdk.io"><code>AvroIO.Sink</code></a> for use with <a href="../../../../../org/apache/beam/sdk/io/FileIO.html#write--"><code>FileIO.write()</code></a> and <a href="../../../../../org/apache/beam/sdk/io/FileIO.html#writeDynamic--"><code>FileIO.writeDynamic()</code></a>, writing |
| elements of the given generated class, like <a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#write-java.lang.Class-"><code>write(Class)</code></a>.</div> |
| </td> |
| </tr> |
| <tr id="i10" class="altColor"> |
| <td class="colFirst"><code>static <ElementT> <a href="../../../../../org/apache/beam/sdk/io/AvroIO.Sink.html" title="class in org.apache.beam.sdk.io">AvroIO.Sink</a><ElementT></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#sinkViaGenericRecords-org.apache.avro.Schema-org.apache.beam.sdk.io.AvroIO.RecordFormatter-">sinkViaGenericRecords</a></span>(<a href="http://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/Schema.html?is-external=true" title="class or interface in org.apache.avro">Schema</a> schema, |
| <a href="../../../../../org/apache/beam/sdk/io/AvroIO.RecordFormatter.html" title="interface in org.apache.beam.sdk.io">AvroIO.RecordFormatter</a><ElementT> formatter)</code> |
| <div class="block">A <a href="../../../../../org/apache/beam/sdk/io/AvroIO.Sink.html" title="class in org.apache.beam.sdk.io"><code>AvroIO.Sink</code></a> for use with <a href="../../../../../org/apache/beam/sdk/io/FileIO.html#write--"><code>FileIO.write()</code></a> and <a href="../../../../../org/apache/beam/sdk/io/FileIO.html#writeDynamic--"><code>FileIO.writeDynamic()</code></a>, writing |
| elements by converting each one to a <a href="http://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/generic/GenericRecord.html?is-external=true" title="class or interface in org.apache.avro.generic"><code>GenericRecord</code></a> with a given (common) schema, like |
| <a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#writeCustomTypeToGenericRecords--"><code>writeCustomTypeToGenericRecords()</code></a>.</div> |
| </td> |
| </tr> |
| <tr id="i11" class="rowColor"> |
| <td class="colFirst"><code>static <T> <a href="../../../../../org/apache/beam/sdk/io/AvroIO.Write.html" title="class in org.apache.beam.sdk.io">AvroIO.Write</a><T></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#write-java.lang.Class-">write</a></span>(java.lang.Class<T> recordClass)</code> |
| <div class="block">Writes a <a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values"><code>PCollection</code></a> to an Avro file (or multiple Avro files matching a sharding |
| pattern).</div> |
| </td> |
| </tr> |
| <tr id="i12" class="altColor"> |
| <td class="colFirst"><code>static <UserT,OutputT><br><a href="../../../../../org/apache/beam/sdk/io/AvroIO.TypedWrite.html" title="class in org.apache.beam.sdk.io">AvroIO.TypedWrite</a><UserT,java.lang.Void,OutputT></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#writeCustomType--">writeCustomType</a></span>()</code> |
| <div class="block">A <a href="../../../../../org/apache/beam/sdk/transforms/PTransform.html" title="class in org.apache.beam.sdk.transforms"><code>PTransform</code></a> that writes a <a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values"><code>PCollection</code></a> to an avro file (or multiple avro files |
| matching a sharding pattern), with each element of the input collection encoded into its own |
| record of type OutputT.</div> |
| </td> |
| </tr> |
| <tr id="i13" class="rowColor"> |
| <td class="colFirst"><code>static <UserT> <a href="../../../../../org/apache/beam/sdk/io/AvroIO.TypedWrite.html" title="class in org.apache.beam.sdk.io">AvroIO.TypedWrite</a><UserT,java.lang.Void,<a href="http://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/generic/GenericRecord.html?is-external=true" title="class or interface in org.apache.avro.generic">GenericRecord</a>></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#writeCustomTypeToGenericRecords--">writeCustomTypeToGenericRecords</a></span>()</code> |
| <div class="block">Similar to <a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#writeCustomType--"><code>writeCustomType()</code></a>, but specialized for the case where the output type is |
| <a href="http://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/generic/GenericRecord.html?is-external=true" title="class or interface in org.apache.avro.generic"><code>GenericRecord</code></a>.</div> |
| </td> |
| </tr> |
| <tr id="i14" class="altColor"> |
| <td class="colFirst"><code>static <a href="../../../../../org/apache/beam/sdk/io/AvroIO.Write.html" title="class in org.apache.beam.sdk.io">AvroIO.Write</a><<a href="http://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/generic/GenericRecord.html?is-external=true" title="class or interface in org.apache.avro.generic">GenericRecord</a>></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#writeGenericRecords-org.apache.avro.Schema-">writeGenericRecords</a></span>(<a href="http://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/Schema.html?is-external=true" title="class or interface in org.apache.avro">Schema</a> schema)</code> |
| <div class="block">Writes Avro records of the specified schema.</div> |
| </td> |
| </tr> |
| <tr id="i15" class="rowColor"> |
| <td class="colFirst"><code>static <a href="../../../../../org/apache/beam/sdk/io/AvroIO.Write.html" title="class in org.apache.beam.sdk.io">AvroIO.Write</a><<a href="http://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/generic/GenericRecord.html?is-external=true" title="class or interface in org.apache.avro.generic">GenericRecord</a>></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#writeGenericRecords-java.lang.String-">writeGenericRecords</a></span>(java.lang.String schema)</code> |
| <div class="block">Writes Avro records of the specified schema.</div> |
| </td> |
| </tr> |
| </table> |
| <ul class="blockList"> |
| <li class="blockList"><a name="methods.inherited.from.class.java.lang.Object"> |
| <!-- --> |
| </a> |
| <h3>Methods inherited from class java.lang.Object</h3> |
| <code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| <div class="details"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ============ METHOD DETAIL ========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method.detail"> |
| <!-- --> |
| </a> |
| <h3>Method Detail</h3> |
| <a name="read-java.lang.Class-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>read</h4> |
| <pre>public static <T> <a href="../../../../../org/apache/beam/sdk/io/AvroIO.Read.html" title="class in org.apache.beam.sdk.io">AvroIO.Read</a><T> read(java.lang.Class<T> recordClass)</pre> |
| <div class="block">Reads records of the given type from an Avro file (or multiple Avro files matching a pattern). |
| |
| <p>The schema must be specified using one of the <code>withSchema</code> functions.</div> |
| </li> |
| </ul> |
| <a name="readAll-java.lang.Class-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>readAll</h4> |
| <pre>public static <T> <a href="../../../../../org/apache/beam/sdk/io/AvroIO.ReadAll.html" title="class in org.apache.beam.sdk.io">AvroIO.ReadAll</a><T> readAll(java.lang.Class<T> recordClass)</pre> |
| <div class="block">Like <a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#read-java.lang.Class-"><code>read(java.lang.Class<T>)</code></a>, but reads each filepattern in the input <a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values"><code>PCollection</code></a>.</div> |
| </li> |
| </ul> |
| <a name="readGenericRecords-org.apache.avro.Schema-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>readGenericRecords</h4> |
| <pre>public static <a href="../../../../../org/apache/beam/sdk/io/AvroIO.Read.html" title="class in org.apache.beam.sdk.io">AvroIO.Read</a><<a href="http://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/generic/GenericRecord.html?is-external=true" title="class or interface in org.apache.avro.generic">GenericRecord</a>> readGenericRecords(<a href="http://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/Schema.html?is-external=true" title="class or interface in org.apache.avro">Schema</a> schema)</pre> |
| <div class="block">Reads Avro file(s) containing records of the specified schema.</div> |
| </li> |
| </ul> |
| <a name="readAllGenericRecords-org.apache.avro.Schema-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>readAllGenericRecords</h4> |
| <pre>public static <a href="../../../../../org/apache/beam/sdk/io/AvroIO.ReadAll.html" title="class in org.apache.beam.sdk.io">AvroIO.ReadAll</a><<a href="http://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/generic/GenericRecord.html?is-external=true" title="class or interface in org.apache.avro.generic">GenericRecord</a>> readAllGenericRecords(<a href="http://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/Schema.html?is-external=true" title="class or interface in org.apache.avro">Schema</a> schema)</pre> |
| <div class="block">Like <a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#readGenericRecords-org.apache.avro.Schema-"><code>readGenericRecords(Schema)</code></a>, but reads each filepattern in the input <a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values"><code>PCollection</code></a>.</div> |
| </li> |
| </ul> |
| <a name="readGenericRecords-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>readGenericRecords</h4> |
| <pre>public static <a href="../../../../../org/apache/beam/sdk/io/AvroIO.Read.html" title="class in org.apache.beam.sdk.io">AvroIO.Read</a><<a href="http://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/generic/GenericRecord.html?is-external=true" title="class or interface in org.apache.avro.generic">GenericRecord</a>> readGenericRecords(java.lang.String schema)</pre> |
| <div class="block">Reads Avro file(s) containing records of the specified schema. The schema is specified as a |
| JSON-encoded string.</div> |
| </li> |
| </ul> |
| <a name="readAllGenericRecords-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>readAllGenericRecords</h4> |
| <pre>public static <a href="../../../../../org/apache/beam/sdk/io/AvroIO.ReadAll.html" title="class in org.apache.beam.sdk.io">AvroIO.ReadAll</a><<a href="http://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/generic/GenericRecord.html?is-external=true" title="class or interface in org.apache.avro.generic">GenericRecord</a>> readAllGenericRecords(java.lang.String schema)</pre> |
| <div class="block">Like <a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#readGenericRecords-java.lang.String-"><code>readGenericRecords(String)</code></a>, but reads each filepattern in the input <a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values"><code>PCollection</code></a>.</div> |
| </li> |
| </ul> |
| <a name="parseGenericRecords-org.apache.beam.sdk.transforms.SerializableFunction-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>parseGenericRecords</h4> |
| <pre>public static <T> <a href="../../../../../org/apache/beam/sdk/io/AvroIO.Parse.html" title="class in org.apache.beam.sdk.io">AvroIO.Parse</a><T> parseGenericRecords(<a href="../../../../../org/apache/beam/sdk/transforms/SerializableFunction.html" title="interface in org.apache.beam.sdk.transforms">SerializableFunction</a><<a href="http://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/generic/GenericRecord.html?is-external=true" title="class or interface in org.apache.avro.generic">GenericRecord</a>,T> parseFn)</pre> |
| <div class="block">Reads Avro file(s) containing records of an unspecified schema and converting each record to a |
| custom type.</div> |
| </li> |
| </ul> |
| <a name="parseAllGenericRecords-org.apache.beam.sdk.transforms.SerializableFunction-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>parseAllGenericRecords</h4> |
| <pre>public static <T> <a href="../../../../../org/apache/beam/sdk/io/AvroIO.ParseAll.html" title="class in org.apache.beam.sdk.io">AvroIO.ParseAll</a><T> parseAllGenericRecords(<a href="../../../../../org/apache/beam/sdk/transforms/SerializableFunction.html" title="interface in org.apache.beam.sdk.transforms">SerializableFunction</a><<a href="http://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/generic/GenericRecord.html?is-external=true" title="class or interface in org.apache.avro.generic">GenericRecord</a>,T> parseFn)</pre> |
| <div class="block">Like <a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#parseGenericRecords-org.apache.beam.sdk.transforms.SerializableFunction-"><code>parseGenericRecords(SerializableFunction)</code></a>, but reads each filepattern in the |
| input <a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values"><code>PCollection</code></a>.</div> |
| </li> |
| </ul> |
| <a name="write-java.lang.Class-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>write</h4> |
| <pre>public static <T> <a href="../../../../../org/apache/beam/sdk/io/AvroIO.Write.html" title="class in org.apache.beam.sdk.io">AvroIO.Write</a><T> write(java.lang.Class<T> recordClass)</pre> |
| <div class="block">Writes a <a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values"><code>PCollection</code></a> to an Avro file (or multiple Avro files matching a sharding |
| pattern).</div> |
| </li> |
| </ul> |
| <a name="writeGenericRecords-org.apache.avro.Schema-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>writeGenericRecords</h4> |
| <pre>public static <a href="../../../../../org/apache/beam/sdk/io/AvroIO.Write.html" title="class in org.apache.beam.sdk.io">AvroIO.Write</a><<a href="http://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/generic/GenericRecord.html?is-external=true" title="class or interface in org.apache.avro.generic">GenericRecord</a>> writeGenericRecords(<a href="http://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/Schema.html?is-external=true" title="class or interface in org.apache.avro">Schema</a> schema)</pre> |
| <div class="block">Writes Avro records of the specified schema.</div> |
| </li> |
| </ul> |
| <a name="writeCustomType--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>writeCustomType</h4> |
| <pre>public static <UserT,OutputT> <a href="../../../../../org/apache/beam/sdk/io/AvroIO.TypedWrite.html" title="class in org.apache.beam.sdk.io">AvroIO.TypedWrite</a><UserT,java.lang.Void,OutputT> writeCustomType()</pre> |
| <div class="block">A <a href="../../../../../org/apache/beam/sdk/transforms/PTransform.html" title="class in org.apache.beam.sdk.transforms"><code>PTransform</code></a> that writes a <a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values"><code>PCollection</code></a> to an avro file (or multiple avro files |
| matching a sharding pattern), with each element of the input collection encoded into its own |
| record of type OutputT. |
| |
| <p>This version allows you to apply <a href="../../../../../org/apache/beam/sdk/io/AvroIO.html" title="class in org.apache.beam.sdk.io"><code>AvroIO</code></a> writes to a PCollection of a custom type |
| <code>UserT</code>. A format mechanism that converts the input type <code>UserT</code> to the output type |
| that will be written to the file must be specified. If using a custom <a href="../../../../../org/apache/beam/sdk/io/DynamicAvroDestinations.html" title="class in org.apache.beam.sdk.io"><code>DynamicAvroDestinations</code></a> object this is done using <a href="../../../../../org/apache/beam/sdk/io/FileBasedSink.DynamicDestinations.html#formatRecord-UserT-"><code>FileBasedSink.DynamicDestinations.formatRecord(UserT)</code></a>, otherwise the <a href="../../../../../org/apache/beam/sdk/io/AvroIO.TypedWrite.html#withFormatFunction-org.apache.beam.sdk.transforms.SerializableFunction-"><code>AvroIO.TypedWrite.withFormatFunction(org.apache.beam.sdk.transforms.SerializableFunction<UserT, OutputT>)</code></a> can be used to specify a format function. |
| |
| <p>The advantage of using a custom type is that is it allows a user-provided <a href="../../../../../org/apache/beam/sdk/io/DynamicAvroDestinations.html" title="class in org.apache.beam.sdk.io"><code>DynamicAvroDestinations</code></a> object, set via <a href="../../../../../org/apache/beam/sdk/io/AvroIO.Write.html#to-org.apache.beam.sdk.io.DynamicAvroDestinations-"><code>AvroIO.Write.to(DynamicAvroDestinations)</code></a> to |
| examine the custom type when choosing a destination. |
| |
| <p>If the output type is <a href="http://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/generic/GenericRecord.html?is-external=true" title="class or interface in org.apache.avro.generic"><code>GenericRecord</code></a> use <a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#writeCustomTypeToGenericRecords--"><code>writeCustomTypeToGenericRecords()</code></a> |
| instead.</div> |
| </li> |
| </ul> |
| <a name="writeCustomTypeToGenericRecords--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>writeCustomTypeToGenericRecords</h4> |
| <pre>public static <UserT> <a href="../../../../../org/apache/beam/sdk/io/AvroIO.TypedWrite.html" title="class in org.apache.beam.sdk.io">AvroIO.TypedWrite</a><UserT,java.lang.Void,<a href="http://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/generic/GenericRecord.html?is-external=true" title="class or interface in org.apache.avro.generic">GenericRecord</a>> writeCustomTypeToGenericRecords()</pre> |
| <div class="block">Similar to <a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#writeCustomType--"><code>writeCustomType()</code></a>, but specialized for the case where the output type is |
| <a href="http://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/generic/GenericRecord.html?is-external=true" title="class or interface in org.apache.avro.generic"><code>GenericRecord</code></a>. A schema must be specified either in <a href="../../../../../org/apache/beam/sdk/io/DynamicAvroDestinations.html#getSchema-DestinationT-"><code>DynamicAvroDestinations.getSchema(DestinationT)</code></a> or if not using dynamic destinations, by using <a href="../../../../../org/apache/beam/sdk/io/AvroIO.TypedWrite.html#withSchema-org.apache.avro.Schema-"><code>AvroIO.TypedWrite.withSchema(Schema)</code></a>.</div> |
| </li> |
| </ul> |
| <a name="writeGenericRecords-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>writeGenericRecords</h4> |
| <pre>public static <a href="../../../../../org/apache/beam/sdk/io/AvroIO.Write.html" title="class in org.apache.beam.sdk.io">AvroIO.Write</a><<a href="http://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/generic/GenericRecord.html?is-external=true" title="class or interface in org.apache.avro.generic">GenericRecord</a>> writeGenericRecords(java.lang.String schema)</pre> |
| <div class="block">Writes Avro records of the specified schema. The schema is specified as a JSON-encoded string.</div> |
| </li> |
| </ul> |
| <a name="constantDestinations-org.apache.beam.sdk.io.FileBasedSink.FilenamePolicy-org.apache.avro.Schema-java.util.Map-org.apache.avro.file.CodecFactory-org.apache.beam.sdk.transforms.SerializableFunction-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>constantDestinations</h4> |
| <pre>public static <UserT,OutputT> <a href="../../../../../org/apache/beam/sdk/io/DynamicAvroDestinations.html" title="class in org.apache.beam.sdk.io">DynamicAvroDestinations</a><UserT,java.lang.Void,OutputT> constantDestinations(<a href="../../../../../org/apache/beam/sdk/io/FileBasedSink.FilenamePolicy.html" title="class in org.apache.beam.sdk.io">FileBasedSink.FilenamePolicy</a> filenamePolicy, |
| <a href="http://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/Schema.html?is-external=true" title="class or interface in org.apache.avro">Schema</a> schema, |
| java.util.Map<java.lang.String,java.lang.Object> metadata, |
| <a href="http://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/file/CodecFactory.html?is-external=true" title="class or interface in org.apache.avro.file">CodecFactory</a> codec, |
| <a href="../../../../../org/apache/beam/sdk/transforms/SerializableFunction.html" title="interface in org.apache.beam.sdk.transforms">SerializableFunction</a><UserT,OutputT> formatFunction)</pre> |
| <div class="block">Returns a <a href="../../../../../org/apache/beam/sdk/io/DynamicAvroDestinations.html" title="class in org.apache.beam.sdk.io"><code>DynamicAvroDestinations</code></a> that always returns the same <a href="../../../../../org/apache/beam/sdk/io/FileBasedSink.FilenamePolicy.html" title="class in org.apache.beam.sdk.io"><code>FileBasedSink.FilenamePolicy</code></a>, |
| schema, metadata, and codec.</div> |
| </li> |
| </ul> |
| <a name="sink-java.lang.Class-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>sink</h4> |
| <pre>public static <ElementT> <a href="../../../../../org/apache/beam/sdk/io/AvroIO.Sink.html" title="class in org.apache.beam.sdk.io">AvroIO.Sink</a><ElementT> sink(java.lang.Class<ElementT> clazz)</pre> |
| <div class="block">A <a href="../../../../../org/apache/beam/sdk/io/AvroIO.Sink.html" title="class in org.apache.beam.sdk.io"><code>AvroIO.Sink</code></a> for use with <a href="../../../../../org/apache/beam/sdk/io/FileIO.html#write--"><code>FileIO.write()</code></a> and <a href="../../../../../org/apache/beam/sdk/io/FileIO.html#writeDynamic--"><code>FileIO.writeDynamic()</code></a>, writing |
| elements of the given generated class, like <a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#write-java.lang.Class-"><code>write(Class)</code></a>.</div> |
| </li> |
| </ul> |
| <a name="sinkViaGenericRecords-org.apache.avro.Schema-org.apache.beam.sdk.io.AvroIO.RecordFormatter-"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>sinkViaGenericRecords</h4> |
| <pre>public static <ElementT> <a href="../../../../../org/apache/beam/sdk/io/AvroIO.Sink.html" title="class in org.apache.beam.sdk.io">AvroIO.Sink</a><ElementT> sinkViaGenericRecords(<a href="http://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/Schema.html?is-external=true" title="class or interface in org.apache.avro">Schema</a> schema, |
| <a href="../../../../../org/apache/beam/sdk/io/AvroIO.RecordFormatter.html" title="interface in org.apache.beam.sdk.io">AvroIO.RecordFormatter</a><ElementT> formatter)</pre> |
| <div class="block">A <a href="../../../../../org/apache/beam/sdk/io/AvroIO.Sink.html" title="class in org.apache.beam.sdk.io"><code>AvroIO.Sink</code></a> for use with <a href="../../../../../org/apache/beam/sdk/io/FileIO.html#write--"><code>FileIO.write()</code></a> and <a href="../../../../../org/apache/beam/sdk/io/FileIO.html#writeDynamic--"><code>FileIO.writeDynamic()</code></a>, writing |
| elements by converting each one to a <a href="http://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/generic/GenericRecord.html?is-external=true" title="class or interface in org.apache.avro.generic"><code>GenericRecord</code></a> with a given (common) schema, like |
| <a href="../../../../../org/apache/beam/sdk/io/AvroIO.html#writeCustomTypeToGenericRecords--"><code>writeCustomTypeToGenericRecords()</code></a>.</div> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| </div> |
| <!-- ========= END OF CLASS DATA ========= --> |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <div class="bottomNav"><a name="navbar.bottom"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.bottom.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li>Prev Class</li> |
| <li><a href="../../../../../org/apache/beam/sdk/io/AvroIO.Parse.html" title="class in org.apache.beam.sdk.io"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../../index.html?org/apache/beam/sdk/io/AvroIO.html" target="_top">Frames</a></li> |
| <li><a href="AvroIO.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_bottom"> |
| <li><a href="../../../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_bottom"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li><a href="#nested.class.summary">Nested</a> | </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip.navbar.bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| </body> |
| </html> |