支持的协议缓冲区和 Arrow 数据类型
本文档介绍了每种 BigQuery 数据类型支持的协议缓冲区和 Arrow 数据类型。在阅读本文档之前,请先阅读 BigQuery Storage Write API 概览。
支持的协议缓冲区数据类型
下表显示了协议缓冲区中支持的数据类型以及 BigQuery 中对应的输入格式:
| BigQuery 数据类型 | 支持的协议缓冲区类型 |
|---|---|
BOOL |
bool、int32、int64、uint32、uint64、google.protobuf.BoolValue |
BYTES |
bytes、string、google.protobuf.BytesValue |
DATE |
int32(首选)、int64、string
该值是自 Unix 纪元(1970-01-01)开始计算的天数。有效范围在 |
DATETIME、TIME |
string
|
int64
使用 |
|
FLOAT |
double、float、google.protobuf.DoubleValue、google.protobuf.FloatValue |
GEOGRAPHY |
string
该值是 WKT 或 GeoJson 格式的几何图形。 |
INTEGER |
int32、int64、uint32、enum、google.protobuf.Int32Value、google.protobuf.Int64Value、google.protobuf.UInt32Value |
JSON |
string |
NUMERIC、BIGNUMERIC |
int32、int64、uint32、uint64、double、float、string |
bytes、google.protobuf.BytesValue使用 |
|
STRING |
string、enum、google.protobuf.StringValue |
TIME |
string
该值必须是 |
TIMESTAMP |
int64(首选)、int32、uint32、google.protobuf.Timestamp该值是自 Unix 计时原点(1970-01-01)开始计算的毫秒数。 |
INTERVAL |
string, google.protobuf.Duration
字符串值必须是 |
RANGE<T> |
message
proto 中包含两个字段( |
REPEATED FIELD |
array
proto 中的数组类型对应于 BigQuery 中的重复字段。 |
RECORD |
message
proto 中的嵌套消息类型对应于 BigQuery 中的记录字段。 |
支持的 Apache Arrow 数据类型
下表显示了 Apache Arrow 中支持的数据类型以及 BigQuery 中对应的输入格式。
| BigQuery 数据类型 | 支持的 Apache Arrow 类型 | 支持的类型参数 |
|---|---|---|
BOOL |
Boolean |
|
BYTES |
Binary |
|
DATE |
Date |
unit = Day |
String、int32 |
||
DATETIME |
Timestamp |
unit = MICROSECONDS
timezone 为空 |
FLOAT |
FloatingPoint |
{SINGLE, DOUBLE} 中的精度 |
GEOGRAPHY |
Utf8
该值是 WKT 或 GeoJson 格式的几何图形。 |
|
INTEGER |
int |
{8, 16, 32, 64} 中的位宽度
is_signed = false |
JSON |
Utf8 |
|
NUMERIC |
Decimal128 |
您可以提供具有小于 BigQuery 支持的范围的任何精度或标度的 NUMERIC。 |
BIGNUMERIC |
Decimal256 |
您可以提供具有小于 BigQuery 支持的范围的任何精度或标度的 BIGNUMERIC。 |
STRING |
Utf8 |
|
TIMESTAMP |
Timestamp |
unit = MICROSECONDS
timezone = UTC |
INTERVAL |
Interval |
{YEAR_MONTH, DAY_TIME, MONTH_DAY_NANO} 中的单位 |
Utf8 |
||
RANGE<T> |
Struct
Arrow 结构体必须具有两个名为 对于 对于 对于 任何 |
|
REPEATED FIELD |
List |
NULL 值必须以空列表来表示。 |
RECORD |
Struct |