Skip to main content
Last updated on

OceanBase Data Type Mapping

OceanBase CDC continuous load supports only MySQL compatibility mode and uses the MySQL type conversion path. The following table shows how OceanBase column types map to Doris column types during automatic table creation.

Experimental feature

OceanBase CDC continuous load is available as an experimental feature starting from Doris 4.1.4.

JDBC URL Parameter Normalization​

When you create an OceanBase Streaming Job, Doris automatically appends the following parameters to jdbc_url unless you set them explicitly:

ParameterInjected ValueEffect
tinyInt1isBitfalseReads TINYINT(1) as TINYINT (1 / 0) instead of BOOLEAN (true / false).
yearIsDateTypefalseReads YEAR as an integer year instead of a date.
useUnicodetrueUses Unicode encoding.
characterEncodingutf-8Uses UTF-8 as the character set.

If any of these parameters is set explicitly in jdbc_url, Doris keeps the configured value.

OceanBase to Doris​

OceanBase Type (MySQL compatibility mode)Doris TypeNotes
BOOLEAN / TINYINT(1)TINYINTValues are 1 / 0 by default. Set tinyInt1isBit=true to change the JDBC read behavior.
TINYINTTINYINTUNSIGNED → SMALLINT
SMALLINTSMALLINTUNSIGNED → INT
MEDIUMINTINTUNSIGNED → INT
INTINTUNSIGNED → BIGINT
BIGINTBIGINTUNSIGNED → LARGEINT
YEARSMALLINTRead as an integer year; zero year (0000) is preserved as 0.
FLOATFLOAT
DOUBLEDOUBLE
DECIMAL(p,s)DECIMAL(p,s)Very high precision falls back to STRING.
DATEDATE
DATETIMEDATETIME(s)Preserves microsecond scale from 0 to 6.
TIMESTAMPDATETIME(s)Normalized to the server time zone.
TIMESTRINGStored as a string, for example, 12:34:56.000000.
CHARCHAR
VARCHARVARCHAR
TINYTEXT / TEXT / MEDIUMTEXT / LONGTEXTSTRING
BINARY / VARBINARY / TINYBLOB / BLOB / MEDIUMBLOB / LONGBLOBSTRINGBase64-encoded string.
BIT(1)BOOLEAN
BIT(n>1)STRINGBase64-encoded string.
JSONSTRINGStored as JSON text.
ENUMSTRINGResolved to the label value.
SETSTRINGResolved to comma-separated labels.
Spatial types (GEOMETRY, POINT, and others) and other typesNot supportedAutomatic table creation fails for a table containing such a column. Exclude a non-key column with table.<table_name>.exclude_columns.

Considerations​

  • Type mapping is based on metadata returned by OceanBase through MySQL Connector/J.
  • Unsupported types do not fall back to an arbitrary Doris type. Verify the target table schema before creating a production job.
  • TIMESTAMP is affected by the source time zone and the serverTimezone JDBC URL parameter. Set and verify the time zone explicitly for cross-time-zone deployments.
  • Primary key columns cannot be excluded through table.<table_name>.exclude_columns.