row
const row: { getBinary: Uint8Array<ArrayBufferLike> | null; getBoolean: boolean | null; getDate: Date | null; getDouble: number | null; getInt: number | null; getLong: bigint | null; getString: string | null;};Defined in: types/row.ts:74
Typed runtime accessors for Row values. Each getter checks the
column exists and the value matches the expected JavaScript type. Returns
null when the value is null. Throws InvalidInputError on a
type mismatch or missing column.
Use when the schema isn’t known at compile time. The alternative,
df.as<Schema>().collect(), gives full compile-time typing instead.
Matches the Scala Row.getInt, getLong, and getAs[T] pattern.
Type Declaration
Section titled “Type Declaration”getBinary()
Section titled “getBinary()”getBinary(r, col): Uint8Array<ArrayBufferLike> | null;Spark BinaryType.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
r |
Row |
col |
string |
Returns
Section titled “Returns”Uint8Array<ArrayBufferLike> | null
getBoolean()
Section titled “getBoolean()”getBoolean(r, col): boolean | null;Spark BooleanType.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
r |
Row |
col |
string |
Returns
Section titled “Returns”boolean | null
getDate()
Section titled “getDate()”getDate(r, col): Date | null;Spark DateType / TimestampType.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
r |
Row |
col |
string |
Returns
Section titled “Returns”Date | null
getDouble()
Section titled “getDouble()”getDouble(r, col): number | null;Spark DoubleType / FloatType.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
r |
Row |
col |
string |
Returns
Section titled “Returns”number | null
getInt()
Section titled “getInt()”getInt(r, col): number | null;Spark IntegerType / ShortType / ByteType.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
r |
Row |
col |
string |
Returns
Section titled “Returns”number | null
getLong()
Section titled “getLong()”getLong(r, col): bigint | null;Spark LongType (decoded as bigint to preserve 64-bit precision).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
r |
Row |
col |
string |
Returns
Section titled “Returns”bigint | null
getString()
Section titled “getString()”getString(r, col): string | null;Spark StringType. Also covers DecimalType (decoded as string).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
r |
Row |
col |
string |
Returns
Section titled “Returns”string | null
Example
Section titled “Example”import { row } from "@spark-connect-js/core";
const [stats] = await df.collect(); const total = row.getLong(stats, "count"); // bigint | null const mean = row.getDouble(stats, "average"); // number | null