Row (Spark 4.2.0 JavaDoc)
size
int size()
Number of elements in the Row.
length
int length()
Number of elements in the Row.
schema
Schema for the row.
- Returns:
- (undocumented)
apply
Returns the value at position i. If the value is null, null is returned. The following is a mapping between Spark SQL types and return types:
BooleanType -> java.lang.Boolean
ByteType -> java.lang.Byte
ShortType -> java.lang.Short
IntegerType -> java.lang.Integer
LongType -> java.lang.Long
FloatType -> java.lang.Float
DoubleType -> java.lang.Double
StringType -> String
DecimalType -> java.math.BigDecimal
DateType -> java.sql.Date if spark.sql.datetime.java8API.enabled is false
DateType -> java.time.LocalDate if spark.sql.datetime.java8API.enabled is true
TimestampType -> java.sql.Timestamp if spark.sql.datetime.java8API.enabled is false
TimestampType -> java.time.Instant if spark.sql.datetime.java8API.enabled is true
BinaryType -> byte array
ArrayType -> scala.collection.Seq (use getList for java.util.List)
MapType -> scala.collection.Map (use getJavaMap for java.util.Map)
StructType -> org.apache.spark.sql.Row
- Parameters:
i- (undocumented)- Returns:
- (undocumented)
get
Returns the value at position i. If the value is null, null is returned. The following is a mapping between Spark SQL types and return types:
BooleanType -> java.lang.Boolean
ByteType -> java.lang.Byte
ShortType -> java.lang.Short
IntegerType -> java.lang.Integer
LongType -> java.lang.Long
FloatType -> java.lang.Float
DoubleType -> java.lang.Double
StringType -> String
DecimalType -> java.math.BigDecimal
DateType -> java.sql.Date if spark.sql.datetime.java8API.enabled is false
DateType -> java.time.LocalDate if spark.sql.datetime.java8API.enabled is true
TimestampType -> java.sql.Timestamp if spark.sql.datetime.java8API.enabled is false
TimestampType -> java.time.Instant if spark.sql.datetime.java8API.enabled is true
BinaryType -> byte array
ArrayType -> scala.collection.Seq (use getList for java.util.List)
MapType -> scala.collection.Map (use getJavaMap for java.util.Map)
StructType -> org.apache.spark.sql.Row
- Parameters:
i- (undocumented)- Returns:
- (undocumented)
isNullAt
boolean isNullAt
Checks whether the value at position i is null.
getBoolean
boolean getBoolean
Returns the value at position i as a primitive boolean.
- Parameters:
i- (undocumented)- Returns:
- (undocumented)
- Throws:
ClassCastException- when data type does not match.org.apache.spark.SparkRuntimeException- when value is null.
getByte
byte getByte
Returns the value at position i as a primitive byte.
- Parameters:
i- (undocumented)- Returns:
- (undocumented)
- Throws:
ClassCastException- when data type does not match.org.apache.spark.SparkRuntimeException- when value is null.
getShort
short getShort
Returns the value at position i as a primitive short.
- Parameters:
i- (undocumented)- Returns:
- (undocumented)
- Throws:
ClassCastException- when data type does not match.org.apache.spark.SparkRuntimeException- when value is null.
getInt
int getInt
Returns the value at position i as a primitive int.
- Parameters:
i- (undocumented)- Returns:
- (undocumented)
- Throws:
ClassCastException- when data type does not match.org.apache.spark.SparkRuntimeException- when value is null.
getLong
long getLong
Returns the value at position i as a primitive long.
- Parameters:
i- (undocumented)- Returns:
- (undocumented)
- Throws:
ClassCastException- when data type does not match.org.apache.spark.SparkRuntimeException- when value is null.
getFloat
float getFloat
Returns the value at position i as a primitive float. Throws an exception if the type mismatches or if the value is null.
- Parameters:
i- (undocumented)- Returns:
- (undocumented)
- Throws:
ClassCastException- when data type does not match.org.apache.spark.SparkRuntimeException- when value is null.
getDouble
double getDouble
Returns the value at position i as a primitive double.
- Parameters:
i- (undocumented)- Returns:
- (undocumented)
- Throws:
ClassCastException- when data type does not match.org.apache.spark.SparkRuntimeException- when value is null.
getString
Returns the value at position i as a String object.
- Parameters:
i- (undocumented)- Returns:
- (undocumented)
- Throws:
ClassCastException- when data type does not match.
getDecimal
Returns the value at position i of decimal type as java.math.BigDecimal.
- Parameters:
i- (undocumented)- Returns:
- (undocumented)
- Throws:
ClassCastException- when data type does not match.
getGeometry
Returns the value at position i of date type as org.apache.spark.sql.types.Geometry.
- Parameters:
i- (undocumented)- Returns:
- (undocumented)
- Throws:
ClassCastException- when data type does not match.
getGeography
Returns the value at position i of date type as org.apache.spark.sql.types.Geography.
- Parameters:
i- (undocumented)- Returns:
- (undocumented)
- Throws:
ClassCastException- when data type does not match.
getDate
Date getDate
Returns the value at position i of date type as java.sql.Date.
- Parameters:
i- (undocumented)- Returns:
- (undocumented)
- Throws:
ClassCastException- when data type does not match.
getLocalDate
Returns the value at position i of date type as java.time.LocalDate.
- Parameters:
i- (undocumented)- Returns:
- (undocumented)
- Throws:
ClassCastException- when data type does not match.
getTimestamp
Returns the value at position i of date type as java.sql.Timestamp.
- Parameters:
i- (undocumented)- Returns:
- (undocumented)
- Throws:
ClassCastException- when data type does not match.
getInstant
Returns the value at position i of date type as java.time.Instant.
- Parameters:
i- (undocumented)- Returns:
- (undocumented)
- Throws:
ClassCastException- when data type does not match.
getSeq
<T> scala.collection.immutable.Seq<T> getSeq
Returns the value at position i of array type as a Scala Seq.
- Parameters:
i- (undocumented)- Returns:
- (undocumented)
- Throws:
ClassCastException- when data type does not match.
getList
<T> List<T> getList
Returns the value at position i of array type as java.util.List.
- Parameters:
i- (undocumented)- Returns:
- (undocumented)
- Throws:
ClassCastException- when data type does not match.
getMap
<K,
Returns the value at position i of map type as a Scala Map.
- Parameters:
i- (undocumented)- Returns:
- (undocumented)
- Throws:
ClassCastException- when data type does not match.
getJavaMap
<K,
Returns the value at position i of array type as a java.util.Map.
- Parameters:
i- (undocumented)- Returns:
- (undocumented)
- Throws:
ClassCastException- when data type does not match.
getStruct
Row getStruct
Returns the value at position i of struct type as a Row object.
- Parameters:
i- (undocumented)- Returns:
- (undocumented)
- Throws:
ClassCastException- when data type does not match.
getAs
<T> T getAs
Returns the value at position i. For primitive types if value is null it returns 'zero value' specific for primitive i.e. 0 for Int - use isNullAt to ensure that value is not null
- Parameters:
i- (undocumented)- Returns:
- (undocumented)
- Throws:
ClassCastException- when data type does not match.
getAs
<T> T getAs
Returns the value of a given fieldName. For primitive types if value is null it returns 'zero value' specific for primitive i.e. 0 for Int - use isNullAt to ensure that value is not null
- Parameters:
fieldName- (undocumented)- Returns:
- (undocumented)
- Throws:
UnsupportedOperationException- when schema is not defined.IllegalArgumentException- when fieldName do not exist.ClassCastException- when data type does not match.
fieldIndex
int fieldIndex
Returns the index of a given field name.
- Parameters:
name- (undocumented)- Returns:
- (undocumented)
- Throws:
UnsupportedOperationException- when schema is not defined.IllegalArgumentException- when a fieldnamedoes not exist.
getValuesMap
<T> scala.collection.immutable.Map<String,
Returns a Map consisting of names and values for the requested fieldNames For primitive types if value is null it returns 'zero value' specific for primitive i.e. 0 for Int - use isNullAt to ensure that value is not null
- Parameters:
fieldNames- (undocumented)- Returns:
- (undocumented)
- Throws:
UnsupportedOperationException- when schema is not defined.IllegalArgumentException- when fieldName do not exist.ClassCastException- when data type does not match.
toString
copy
Make a copy of the current Row object.
- Returns:
- (undocumented)
anyNull
boolean anyNull()
Returns true if there are any NULL values in this row.
equals
hashCode
int hashCode()
toSeq
scala.collection.immutable.Seq<Object> toSeq()
Return a Scala Seq representing the row. Elements are placed in the same order in the Seq.
- Returns:
- (undocumented)
mkString
Displays all elements of this sequence in a string (without a separator).
mkString
Displays all elements of this sequence in a string using a separator string.
mkString
Displays all elements of this traversable or iterator in a string using start, end, and separator strings.
- Parameters:
start- (undocumented)sep- (undocumented)end- (undocumented)- Returns:
- (undocumented)
getAnyValAs
<T> T getAnyValAs
Returns the value at position i.
- Parameters:
i- (undocumented)- Returns:
- (undocumented)
- Throws:
UnsupportedOperationException- when schema is not defined.ClassCastException- when data type does not match.org.apache.spark.SparkRuntimeException- when value is null.
json
The compact JSON representation of this row.
- Returns:
- (undocumented)
- Since:
- 3.0
prettyJson
The pretty (i.e. indented) JSON representation of this row.
- Returns:
- (undocumented)
- Since:
- 3.0
jsonValue
org.json4s.JValue jsonValue()
JSON representation of the row.
Note that this only supports the data types that are also supported by
RowEncoder.
- Returns:
- the JSON representation of the row.