Data type mappings for OSS foreign tables

更新时间:
复制 MD 格式

When creating OSS foreign tables in AnalyticDB for PostgreSQL, declare the column data type that corresponds to each field in your source file. This page lists the supported mappings for ORC, Parquet, and Avro formats.

If a source field uses an unsupported type, the import fails and returns an error.

ORC

ORC typeAnalyticDB for PostgreSQL typeNotes
BOOLEANbool
SHORTint2
INTint4
LONGint8
FLOATfloat4
DOUBLEfloat8
DECIMALnumeric
CHARchar
STRINGtext
BINARYbytea
TIMESTAMPtimestamp
DATEdate
LIST(SHORT)int2[]One-dimensional arrays only.
LIST(INT)int4[]One-dimensional arrays only.
LIST(LONG)int8[]One-dimensional arrays only.
LIST(FLOAT)float4[]One-dimensional arrays only.
LIST(DOUBLE)float8[]One-dimensional arrays only.

Parquet

Basic types

The following mappings apply when the Parquet field has no logical type annotation.

Parquet physical typeAnalyticDB for PostgreSQL type
BOOLEANbool
INT32int4
INT64int8
INT96timestamp
FLOATfloat4
DOUBLEfloat8
BYTE_ARRAYbytea
FIXED_LEN_BYTE_ARRAYbytea

Logical types

The following mappings apply when the Parquet field carries a logical type annotation.

Parquet logical typeAnalyticDB for PostgreSQL typeNotes
STRINGtext
DATEdate
TIMESTAMPtimestamp
TIMEtime
INTERVALinterval
DECIMALnumeric
INT(8) and INT(16)int2
INT(32)int4
INT(64)int8
UINT(8/16/32/64)int8
JSONjson
BSONjsonb
UUIDuuid
ENUMtext

Complex types

Parquet complex typeAnalyticDB for PostgreSQL typeNotes
LIST\<T\>T[]T must be a basic type. For example, LIST\<DATE\> maps to date[]. Nesting LIST with LIST, MAP, or STRUCT is not supported.
MAPNot supported
STRUCTNot supported

During the data import process, the system automatically performs type conversion. If unsupported types are encountered, the import operation will fail and return an error message.

Note

Use basic data types where possible for better query performance.

Avro

Avro data types map to column data types in AnalyticDB for PostgreSQL. The Avro RECORD type maps to a data table.

Only the types listed in this table are supported.

Avro type (main type, logical type, and element type)AnalyticDB for PostgreSQL typeNotes
BOOLEANbool
INTint4 and int2
INT + DATEdate
LONGint8
LONG + TIMESTAMPtimestamp and timestamptz
LONG + TIMEtime
FLOATfloat
DOUBLEfloat8
BYTESbytea
BYTES + DECIMAL (precision, scale)numeric (precision, scale)
STRINGchar, varchar, text, and numeric (without specifying precision or scale)
ARRAY + INTint4[] and int2[]One-dimensional arrays only.
ARRAY + LONGint8[]One-dimensional arrays only.
ARRAY + FLOATfloat[]One-dimensional arrays only.
ARRAY + DOUBLEfloat8[]One-dimensional arrays only.