跳到主要内容

MaxCompute 类型映射

MaxCompute 类型与 Java 类型映射关系

ODPS 类型Java 类型
TINYINTjava.lang.Byte
SMALLINTjava.lang.Short
INTjava.lang.Integer
BIGINTjava.lang.Long
BINARYcom.aliyun.odps.data.Binary
FLOATjava.lang.Float
DOUBLEjava.lang.Double
DECIMAL(precision, scale)java.math.BigDecimal
VARCHAR(n)com.aliyun.odps.data.Varchar
CHAR(n)com.aliyun.odps.data.Char
STRINGjava.lang.String
DATEjava.time.LocalDate
DATETIMEjava.time.ZonedDateTime
TIMESTAMPjava.time.Instant
BOOLEANjava.lang.Boolean
TIMESTAMP_NTZjava.time.LocalDateTime
ARRAY<T>java.util.List<T>
MAP<K, V>java.util.Map<K, V>
STRUCT<f1:T1, ...>com.aliyun.odps.data.Struct
JSONcom.aliyun.odps.data.JsonValue

MaxCompute Type 到 Arrow Type 映射表

MaxCompute TypeArrow Type (ValueVector)备注 (Notes)
基础类型
BOOLEANBitVector
TINYINTTinyIntVector
SMALLINTSmallIntVector
INTIntVector
BIGINTBigIntVector
FLOATFloat4Vector
DOUBLEFloat8Vector
DECIMALDecimalVectorisExtension 模式下,,为支持更高精度,可能映射到 FixedSizeBinaryVector
字符串与二进制类型
STRINGVarCharVector
VARCHARVarCharVector
CHARVarCharVector
JSONVarCharVectorJSON 类型在 Arrow 层面被当作字符串处理。
BINARYVarBinaryVector
日期与时间类型
DATEDateDayVector表示自 epoch 以来的天数。
DATETIMETimeStampVector
TIMESTAMPTimeStampVectorisExtension 模式下,为支持更高精度,会映射到 StructVector
TIMESTAMP_NTZTimeStampVectorisExtension 模式下,为支持更高精度,会映射到 StructVector
复杂类型
ARRAYListVector
MAPMapVector
STRUCTStructVector

注:isExtension 仅在 preview 接口中被使用