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 typeSizeJavaScript representation
ByteType1 bytenumber
ShortType2 bytesnumber
IntegerType4 bytesnumber
LongType8 bytesbigint when precision matters
FloatType4 bytesnumber
DoubleType8 bytesnumber
DecimalTypevariablestring-like decimal encoding
StringTypevariablestring
BooleanType1 bitboolean
BinaryTypevariableUint8Array
TimestampType8 bytesDate with microsecond precision loss
DateType4 bytesDate

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