Skip to content

DataType

Defined in: types/data-type.ts:30

Mirrors Spark’s DataType hierarchy for type-safe schema operations.

Spark types live in org.apache.spark.sql.types. The main mapping constraint in JavaScript is that number is IEEE-754 float64, so it cannot represent every Spark integer value exactly.

Spark type Size JavaScript representation
ByteType 1 byte number
ShortType 2 bytes number
IntegerType 4 bytes number
LongType 8 bytes bigint
FloatType 4 bytes number
DoubleType 8 bytes number
DecimalType variable string-like decimal encoding
StringType variable string
BooleanType 1 bit boolean
BinaryType variable Uint8Array
TimestampType 8 bytes Date with microsecond precision loss
DateType 4 bytes Date

Arrow’s type system is close enough to Spark’s SQL types that it can carry result batches efficiently with very little translation on the client side.

Array: "array";

Defined in: types/data-type.ts:43


Binary: "binary";

Defined in: types/data-type.ts:40


Boolean: "boolean";

Defined in: types/data-type.ts:31


Byte: "byte";

Defined in: types/data-type.ts:32


Date: "date";

Defined in: types/data-type.ts:42


Decimal: "decimal";

Defined in: types/data-type.ts:38


Double: "double";

Defined in: types/data-type.ts:37


Float: "float";

Defined in: types/data-type.ts:36


Integer: "integer";

Defined in: types/data-type.ts:34


Long: "long";

Defined in: types/data-type.ts:35


Map: "map";

Defined in: types/data-type.ts:44


Null: "null";

Defined in: types/data-type.ts:46


Short: "short";

Defined in: types/data-type.ts:33


String: "string";

Defined in: types/data-type.ts:39


Struct: "struct";

Defined in: types/data-type.ts:45


Timestamp: "timestamp";

Defined in: types/data-type.ts:41