@Experimental(value=SCHEMAS) public abstract class Row extends java.lang.Object implements java.io.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 for each field and the coder for the whole record,
{see @link Schema#getRowCoder()}.
Modifier and Type | Class and Description |
---|---|
static class |
Row.Builder
Builder for
Row . |
static class |
Row.Equals |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
<T> java.util.Collection<T> |
getArray(int idx)
Get an array value by field index,
IllegalStateException is thrown if schema doesn't
match. |
<T> java.util.Collection<T> |
getArray(java.lang.String fieldName)
Get an array value by field name,
IllegalStateException is thrown if schema doesn't
match. |
java.lang.Boolean |
getBoolean(int idx)
Get a
Boolean value by field index, ClassCastException is thrown if schema
doesn't match. |
java.lang.Boolean |
getBoolean(java.lang.String fieldName)
Get a
Schema.TypeName.BOOLEAN value by field name, IllegalStateException is thrown if
schema doesn't match. |
java.lang.Byte |
getByte(int idx)
Get a
Schema.TypeName.BYTE value by field index, ClassCastException is thrown if
schema doesn't match. |
java.lang.Byte |
getByte(java.lang.String fieldName)
Get a
Schema.TypeName.BYTE value by field name, IllegalStateException is thrown if
schema doesn't match. |
byte[] |
getBytes(int idx)
Get a
Schema.TypeName.BYTES value by field index, ClassCastException is thrown if
schema doesn't match. |
byte[] |
getBytes(java.lang.String fieldName)
Get a
Schema.TypeName.BYTES value by field name, IllegalStateException is thrown if
schema doesn't match. |
ReadableDateTime |
getDateTime(int idx)
Get a
Schema.TypeName.DATETIME value by field index, IllegalStateException is thrown
if schema doesn't match. |
ReadableDateTime |
getDateTime(java.lang.String fieldName)
Get a
Schema.TypeName.DATETIME value by field name, IllegalStateException is thrown if
schema doesn't match. |
java.math.BigDecimal |
getDecimal(int idx)
Get a
BigDecimal value by field index, ClassCastException is thrown if schema
doesn't match. |
java.math.BigDecimal |
getDecimal(java.lang.String fieldName)
Get a
Schema.TypeName.DECIMAL value by field name, IllegalStateException is thrown if
schema doesn't match. |
java.lang.Double |
getDouble(int idx)
Get a
Schema.TypeName.DOUBLE value by field index, ClassCastException is thrown if
schema doesn't match. |
java.lang.Double |
getDouble(java.lang.String fieldName)
Get a
Schema.TypeName.DOUBLE value by field name, IllegalStateException is thrown if
schema doesn't match. |
abstract int |
getFieldCount()
Return the size of data fields.
|
java.lang.Float |
getFloat(int idx)
Get a
Schema.TypeName.FLOAT value by field index, ClassCastException is thrown if
schema doesn't match. |
java.lang.Float |
getFloat(java.lang.String fieldName)
Get a
Schema.TypeName.FLOAT value by field name, IllegalStateException is thrown if
schema doesn't match. |
java.lang.Short |
getInt16(int idx)
Get a
Schema.TypeName.INT16 value by field index, ClassCastException is thrown if
schema doesn't match. |
java.lang.Short |
getInt16(java.lang.String fieldName)
Get a
Schema.TypeName.INT16 value by field name, IllegalStateException is thrown if
schema doesn't match. |
java.lang.Integer |
getInt32(int idx)
Get a
Schema.TypeName.INT32 value by field index, ClassCastException is thrown if
schema doesn't match. |
java.lang.Integer |
getInt32(java.lang.String fieldName)
Get a
Schema.TypeName.INT32 value by field name, IllegalStateException is thrown if
schema doesn't match. |
java.lang.Long |
getInt64(int idx)
Get a
Schema.TypeName.INT64 value by field index, ClassCastException is thrown if
schema doesn't match. |
java.lang.Long |
getInt64(java.lang.String fieldName)
Get a
Schema.TypeName.INT64 value by field name, IllegalStateException is thrown if
schema doesn't match. |
<T> java.lang.Iterable<T> |
getIterable(int idx)
Get an iterable value by field index,
IllegalStateException is thrown if schema doesn't
match. |
<T> java.lang.Iterable<T> |
getIterable(java.lang.String fieldName)
Get an iterable value by field name,
IllegalStateException is thrown if schema doesn't
match. |
<T> T |
getLogicalTypeValue(int idx,
java.lang.Class<T> clazz)
Returns the Logical Type input type for this field.
|
<T> T |
getLogicalTypeValue(java.lang.String fieldName,
java.lang.Class<T> clazz)
Returns the Logical Type input type for this field.
|
<T1,T2> java.util.Map<T1,T2> |
getMap(int idx)
Get a MAP value by field index,
IllegalStateException is thrown if schema doesn't
match. |
<T1,T2> java.util.Map<T1,T2> |
getMap(java.lang.String fieldName)
Get a MAP value by field name,
IllegalStateException is thrown if schema doesn't match. |
Row |
getRow(int idx)
Get a
Row value by field index, IllegalStateException is thrown if schema
doesn't match. |
Row |
getRow(java.lang.String fieldName)
Get a
Schema.TypeName.ROW value by field name, IllegalStateException is thrown if
schema doesn't match. |
Schema |
getSchema()
Return
Schema which describes the fields. |
java.lang.String |
getString(int idx)
Get a
String value by field index, ClassCastException is thrown if schema
doesn't match. |
java.lang.String |
getString(java.lang.String fieldName)
Get a
Schema.TypeName.STRING value by field name, IllegalStateException is thrown if
schema doesn't match. |
abstract <T> T |
getValue(int fieldIdx)
Get value by field index,
ClassCastException is thrown if schema doesn't match. |
<T> T |
getValue(java.lang.String fieldName)
Get value by field name,
ClassCastException is thrown if type doesn't match. |
abstract java.util.List<java.lang.Object> |
getValues()
Return the list of data values.
|
int |
hashCode() |
static Row |
nullRow(Schema schema)
Creates a new record filled with nulls.
|
static <T> java.util.stream.Collector<T,java.util.List<java.lang.Object>,Row> |
toRow(Schema schema)
Creates a
Row from the list of values and getSchema() . |
java.lang.String |
toString() |
static Row.Builder |
withSchema(Schema schema)
Creates a record builder with specified
getSchema() . |
@Nullable public abstract <T> T getValue(int fieldIdx)
ClassCastException
is thrown if schema doesn't match.public abstract int getFieldCount()
public abstract java.util.List<java.lang.Object> getValues()
@Nullable public <T> T getValue(java.lang.String fieldName)
ClassCastException
is thrown if type doesn't match.@Nullable public java.lang.Byte getByte(java.lang.String fieldName)
Schema.TypeName.BYTE
value by field name, IllegalStateException
is thrown if
schema doesn't match.@Nullable public byte[] getBytes(java.lang.String fieldName)
Schema.TypeName.BYTES
value by field name, IllegalStateException
is thrown if
schema doesn't match.@Nullable public java.lang.Short getInt16(java.lang.String fieldName)
Schema.TypeName.INT16
value by field name, IllegalStateException
is thrown if
schema doesn't match.@Nullable public java.lang.Integer getInt32(java.lang.String fieldName)
Schema.TypeName.INT32
value by field name, IllegalStateException
is thrown if
schema doesn't match.@Nullable public java.lang.Long getInt64(java.lang.String fieldName)
Schema.TypeName.INT64
value by field name, IllegalStateException
is thrown if
schema doesn't match.@Nullable public java.math.BigDecimal getDecimal(java.lang.String fieldName)
Schema.TypeName.DECIMAL
value by field name, IllegalStateException
is thrown if
schema doesn't match.@Nullable public java.lang.Float getFloat(java.lang.String fieldName)
Schema.TypeName.FLOAT
value by field name, IllegalStateException
is thrown if
schema doesn't match.@Nullable public java.lang.Double getDouble(java.lang.String fieldName)
Schema.TypeName.DOUBLE
value by field name, IllegalStateException
is thrown if
schema doesn't match.@Nullable public java.lang.String getString(java.lang.String fieldName)
Schema.TypeName.STRING
value by field name, IllegalStateException
is thrown if
schema doesn't match.@Nullable public ReadableDateTime getDateTime(java.lang.String fieldName)
Schema.TypeName.DATETIME
value by field name, IllegalStateException
is thrown if
schema doesn't match.@Nullable public java.lang.Boolean getBoolean(java.lang.String fieldName)
Schema.TypeName.BOOLEAN
value by field name, IllegalStateException
is thrown if
schema doesn't match.@Nullable public <T> java.util.Collection<T> getArray(java.lang.String fieldName)
IllegalStateException
is thrown if schema doesn't
match.@Nullable public <T> java.lang.Iterable<T> getIterable(java.lang.String fieldName)
IllegalStateException
is thrown if schema doesn't
match.@Nullable public <T1,T2> java.util.Map<T1,T2> getMap(java.lang.String fieldName)
IllegalStateException
is thrown if schema doesn't match.@Nullable public <T> T getLogicalTypeValue(java.lang.String fieldName, java.lang.Class<T> clazz)
IllegalStateException
is thrown if
schema doesn't match.@Nullable public Row getRow(java.lang.String fieldName)
Schema.TypeName.ROW
value by field name, IllegalStateException
is thrown if
schema doesn't match.@Nullable public java.lang.Byte getByte(int idx)
Schema.TypeName.BYTE
value by field index, ClassCastException
is thrown if
schema doesn't match.@Nullable public byte[] getBytes(int idx)
Schema.TypeName.BYTES
value by field index, ClassCastException
is thrown if
schema doesn't match.@Nullable public java.lang.Short getInt16(int idx)
Schema.TypeName.INT16
value by field index, ClassCastException
is thrown if
schema doesn't match.@Nullable public java.lang.Integer getInt32(int idx)
Schema.TypeName.INT32
value by field index, ClassCastException
is thrown if
schema doesn't match.@Nullable public java.lang.Float getFloat(int idx)
Schema.TypeName.FLOAT
value by field index, ClassCastException
is thrown if
schema doesn't match.@Nullable public java.lang.Double getDouble(int idx)
Schema.TypeName.DOUBLE
value by field index, ClassCastException
is thrown if
schema doesn't match.@Nullable public java.lang.Long getInt64(int idx)
Schema.TypeName.INT64
value by field index, ClassCastException
is thrown if
schema doesn't match.@Nullable public java.lang.String getString(int idx)
String
value by field index, ClassCastException
is thrown if schema
doesn't match.@Nullable public ReadableDateTime getDateTime(int idx)
Schema.TypeName.DATETIME
value by field index, IllegalStateException
is thrown
if schema doesn't match.@Nullable public java.math.BigDecimal getDecimal(int idx)
BigDecimal
value by field index, ClassCastException
is thrown if schema
doesn't match.@Nullable public java.lang.Boolean getBoolean(int idx)
Boolean
value by field index, ClassCastException
is thrown if schema
doesn't match.@Nullable public <T> java.util.Collection<T> getArray(int idx)
IllegalStateException
is thrown if schema doesn't
match.@Nullable public <T> java.lang.Iterable<T> getIterable(int idx)
IllegalStateException
is thrown if schema doesn't
match.@Nullable public <T1,T2> java.util.Map<T1,T2> getMap(int idx)
IllegalStateException
is thrown if schema doesn't
match.@Nullable public <T> T getLogicalTypeValue(int idx, java.lang.Class<T> clazz)
IllegalStateException
is thrown if
schema doesn't match.@Nullable public Row getRow(int idx)
Row
value by field index, IllegalStateException
is thrown if schema
doesn't match.public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public static Row.Builder withSchema(Schema schema)
getSchema()
. Row.Builder.build()
will
throw an IllegalArgumentException
if number of fields in getSchema()
does not
match the number of fields specified.public static <T> java.util.stream.Collector<T,java.util.List<java.lang.Object>,Row> toRow(Schema schema)
Row
from the list of values and getSchema()
.