public interface Tuple
extends java.io.Serializable
It is invalid to use the native primitive interface to retrieve a value that is null, instead a user must check `isNullAt` before attempting to retrieve a value that might be null.
| Modifier and Type | Method and Description |
|---|---|
default boolean |
anyNull()
Returns true if there are any NULL values in this tuple.
|
default java.lang.Object |
apply(int i)
Returns the value at position i.
|
default java.lang.Object |
apply(java.lang.String field)
Returns the value by field name.
|
default int |
fieldIndex(java.lang.String name)
Returns the index of a given field name.
|
java.lang.Object |
get(int i)
Returns the value at position i.
|
default java.lang.Object |
get(java.lang.String field)
Returns the value by field name.
|
default <T> T[] |
getArray(int i)
Returns the value at position i of array type.
|
default <T> T[] |
getArray(java.lang.String field)
Returns the field value of array type.
|
default <T> T |
getAs(int i)
Returns the value at position i.
|
default <T> T |
getAs(java.lang.String fieldName)
Returns the value of a given fieldName.
|
default boolean |
getBoolean(int i)
Returns the value at position i as a primitive boolean.
|
default boolean |
getBoolean(java.lang.String field)
Returns the field value as a primitive boolean.
|
default byte |
getByte(int i)
Returns the value at position i as a primitive byte.
|
default byte |
getByte(java.lang.String field)
Returns the field value as a primitive byte.
|
default char |
getChar(int i)
Returns the value at position i as a primitive byte.
|
default char |
getChar(java.lang.String field)
Returns the field value as a primitive byte.
|
default java.time.LocalDate |
getDate(int i)
Returns the value at position i of date type as java.time.LocalDate.
|
default java.time.LocalDate |
getDate(java.lang.String field)
Returns the field value of date type as java.time.LocalDate.
|
default java.time.LocalDateTime |
getDateTime(int i)
Returns the value at position i of date type as java.time.LocalDateTime.
|
default java.time.LocalDateTime |
getDateTime(java.lang.String field)
Returns the field value of date type as java.time.LocalDateTime.
|
default java.math.BigDecimal |
getDecimal(int i)
Returns the value at position i of decimal type as java.math.BigDecimal.
|
default java.math.BigDecimal |
getDecimal(java.lang.String field)
Returns the field value of decimal type as java.math.BigDecimal.
|
default double |
getDouble(int i)
Returns the value at position i as a primitive double.
|
default double |
getDouble(java.lang.String field)
Returns the field value as a primitive double.
|
default float |
getFloat(int i)
Returns the value at position i as a primitive float.
|
default float |
getFloat(java.lang.String field)
Returns the field value as a primitive float.
|
default int |
getInt(int i)
Returns the value at position i as a primitive int.
|
default int |
getInt(java.lang.String field)
Returns the field value as a primitive int.
|
default long |
getLong(int i)
Returns the value at position i as a primitive long.
|
default long |
getLong(java.lang.String field)
Returns the field value as a primitive long.
|
default java.lang.String |
getScale(int i)
Returns the value at position i of NominalScale or OrdinalScale.
|
default java.lang.String |
getScale(java.lang.String field)
Returns the field value of NominalScale or OrdinalScale.
|
default short |
getShort(int i)
Returns the value at position i as a primitive short.
|
default short |
getShort(java.lang.String field)
Returns the field value as a primitive short.
|
default java.lang.String |
getString(int i)
Returns the value at position i as a String object.
|
default java.lang.String |
getString(java.lang.String field)
Returns the field value as a String object.
|
default Tuple |
getStruct(int i)
Returns the value at position i of struct type.
|
default Tuple |
getStruct(java.lang.String field)
Returns the field value of struct type.
|
default java.time.LocalTime |
getTime(int i)
Returns the value at position i of date type as java.time.LocalTime.
|
default java.time.LocalTime |
getTime(java.lang.String field)
Returns the field value of date type as java.time.LocalTime.
|
default boolean |
hasNull()
Returns true if the tuple has null/missing values.
|
default boolean |
isNullAt(int i)
Checks whether the value at position i is null.
|
default boolean |
isNullAt(java.lang.String field)
Checks whether the field value is null.
|
default int |
length()
Number of elements in the Tuple.
|
static Tuple |
of(double[] row,
StructType schema)
Returns a double array based tuple.
|
static Tuple |
of(java.lang.Object[] row,
StructType schema)
Returns an object array based tuple.
|
static Tuple |
of(java.sql.ResultSet rs,
StructType schema)
Returns the current row of a JDBC ResultSet as a tuple.
|
StructType |
schema()
Returns the schema of tuple.
|
default double[] |
toArray()
Returns the tuple as an array of doubles.
|
default double[] |
toArray(boolean bias,
CategoricalEncoder encoder)
Return an array obtained by converting all the variables
in a data frame to numeric mode.
|
default java.lang.String |
toString(int i)
Returns the string representation of the value at position i.
|
default java.lang.String |
toString(java.lang.String field)
Returns the string representation of the field value.
|
StructType schema()
default int length()
default double[] toArray()
default double[] toArray(boolean bias,
CategoricalEncoder encoder)
bias - if true, add the first column of all 1's.encoder - the categorical variable encoder.default java.lang.Object apply(int i)
default java.lang.Object apply(java.lang.String field)
java.lang.Object get(int i)
default java.lang.Object get(java.lang.String field)
default boolean isNullAt(int i)
default boolean isNullAt(java.lang.String field)
default boolean hasNull()
default boolean getBoolean(int i)
java.lang.ClassCastException - when data type does not match.java.lang.NullPointerException - when value is null.default boolean getBoolean(java.lang.String field)
java.lang.ClassCastException - when data type does not match.java.lang.NullPointerException - when value is null.default char getChar(int i)
java.lang.ClassCastException - when data type does not match.java.lang.NullPointerException - when value is null.default char getChar(java.lang.String field)
java.lang.ClassCastException - when data type does not match.java.lang.NullPointerException - when value is null.default byte getByte(int i)
java.lang.ClassCastException - when data type does not match.java.lang.NullPointerException - when value is null.default byte getByte(java.lang.String field)
java.lang.ClassCastException - when data type does not match.java.lang.NullPointerException - when value is null.default short getShort(int i)
java.lang.ClassCastException - when data type does not match.java.lang.NullPointerException - when value is null.default short getShort(java.lang.String field)
java.lang.ClassCastException - when data type does not match.java.lang.NullPointerException - when value is null.default int getInt(int i)
java.lang.ClassCastException - when data type does not match.java.lang.NullPointerException - when value is null.default int getInt(java.lang.String field)
java.lang.ClassCastException - when data type does not match.java.lang.NullPointerException - when value is null.default long getLong(int i)
java.lang.ClassCastException - when data type does not match.java.lang.NullPointerException - when value is null.default long getLong(java.lang.String field)
java.lang.ClassCastException - when data type does not match.java.lang.NullPointerException - when value is null.default float getFloat(int i)
java.lang.ClassCastException - when data type does not match.java.lang.NullPointerException - when value is null.default float getFloat(java.lang.String field)
java.lang.ClassCastException - when data type does not match.java.lang.NullPointerException - when value is null.default double getDouble(int i)
java.lang.ClassCastException - when data type does not match.java.lang.NullPointerException - when value is null.default double getDouble(java.lang.String field)
java.lang.ClassCastException - when data type does not match.java.lang.NullPointerException - when value is null.default java.lang.String getString(int i)
java.lang.ClassCastException - when data type does not match.default java.lang.String getString(java.lang.String field)
java.lang.ClassCastException - when data type does not match.default java.lang.String toString(int i)
default java.lang.String toString(java.lang.String field)
default java.math.BigDecimal getDecimal(int i)
java.lang.ClassCastException - when data type does not match.default java.math.BigDecimal getDecimal(java.lang.String field)
java.lang.ClassCastException - when data type does not match.default java.time.LocalDate getDate(int i)
java.lang.ClassCastException - when data type does not match.default java.time.LocalDate getDate(java.lang.String field)
java.lang.ClassCastException - when data type does not match.default java.time.LocalTime getTime(int i)
java.lang.ClassCastException - when data type does not match.default java.time.LocalTime getTime(java.lang.String field)
java.lang.ClassCastException - when data type does not match.default java.time.LocalDateTime getDateTime(int i)
java.lang.ClassCastException - when data type does not match.default java.time.LocalDateTime getDateTime(java.lang.String field)
java.lang.ClassCastException - when data type does not match.default java.lang.String getScale(int i)
default java.lang.String getScale(java.lang.String field)
java.lang.ClassCastException - when the data is not nominal or ordinal.default <T> T[] getArray(int i)
java.lang.ClassCastException - when data type does not match.default <T> T[] getArray(java.lang.String field)
java.lang.ClassCastException - when data type does not match.default Tuple getStruct(int i)
java.lang.ClassCastException - when data type does not match.default Tuple getStruct(java.lang.String field)
java.lang.ClassCastException - when data type does not match.default <T> T getAs(int i)
java.lang.ClassCastException - when data type does not match.default <T> T getAs(java.lang.String fieldName)
java.lang.UnsupportedOperationException - when schema is not defined.java.lang.IllegalArgumentException - when fieldName do not exist.java.lang.ClassCastException - when data type does not match.default int fieldIndex(java.lang.String name)
java.lang.IllegalArgumentException - when a field `name` does not exist.default boolean anyNull()
static Tuple of(java.lang.Object[] row, StructType schema)
static Tuple of(double[] row, StructType schema)
static Tuple of(java.sql.ResultSet rs, StructType schema) throws java.sql.SQLException
java.sql.SQLException