Class Row

java.lang.Object
org.apache.beam.sdk.values.Row
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
RowWithGetters, RowWithStorage

public abstract class Row extends Object implements Serializable
Row is an immutable tuple-like schema to represent one element in a PCollection. The fields are described with a Schema.

Schema contains the names and types for each field.

There are several ways to build a new Row object. To build a row from scratch using a schema object, withSchema(org.apache.beam.sdk.schemas.Schema) can be used. Schema fields can be specified by name, and nested fields can be specified using the field selection syntax. For example:


 Row row = Row.withSchema(schema)
              .withFieldValue("userId", "user1)
              .withFieldValue("location.city", "seattle")
              .withFieldValue("location.state", "wa")
              .build();
 

The fromRow(org.apache.beam.sdk.values.Row) builder can be used to base a row off of another row. The builder can be used to specify values for specific fields, and all the remaining values will be taken from the original row. For example, the following produces a row identical to the above row except for the location.city field.


 Row modifiedRow =
     Row.fromRow(row)
        .withFieldValue("location.city", "tacoma")
        .build();
 
See Also: