本頁提供 Databricks 上可用的 PySpark 資料型態清單,並連結至相應的參考文件。
| 數據類型 | Description |
|---|---|
ArrayType(elementType[, containsNull]) |
陣列資料型別 |
BinaryType() |
二進位(位元組陣列)資料型別 |
BooleanType() |
布林值資料類型 |
ByteType() |
位元組資料型別,代表有符號的 8 位元整數 |
CalendarIntervalType() |
曆法間隔 |
CharType(length) |
Char 資料型別 |
DataType() |
資料型態的基底類別 |
DateType() |
Date (datetime.date) 資料類型 |
DayTimeIntervalType([startField, endField]) |
DayTimeIntervalType(datetime.timedelta) |
DecimalType([precision, scale]) |
十進位(decimal.Decimal)資料型別 |
DoubleType() |
雙重資料型別,代表雙精度浮點數 |
FileType() |
檔案資料型別,代表對非結構化檔案的參考(Beta) |
FloatType() |
浮點數資料型態,代表單精度浮點數 |
GeographyType |
地理資料類型 |
GeometryType |
Geometry 資料類型 |
IntegerType() |
整數資料型別,代表有符號的 32 位元整數 |
LongType() |
長資料型態,代表有符號的 64 位元整數 |
MapType(keyType, valueType[, valueContainsNull]) |
地圖資料型態 |
NullType() |
Null 類型 |
ShortType() |
短資料型態,代表有符號的16位元整數 |
StringType([collation]) |
字串資料型別 |
StructField(name, dataType[, nullable, metadata]) |
StructType 中的一個欄位 |
StructType([fields]) |
結構類型,包含 StructField 的清單 |
TimeType(precision) |
time(datetime.time)資料型別 |
TimestampType() |
Timestamp (datetime.datetime) 資料類型 |
TimestampNTZType() |
時間戳記(datetime.datetime)資料型別,但不含時區資訊 |
VarcharType(length) |
Varchar 資料型別 |
VariantType() |
變體資料型態,代表半結構化值 |
YearMonthIntervalType([startField, endField]) |
YearMonthIntervalType 代表 SQL 標準的年月區間 |