Skip to main content
Version: 1.3.1

OceanBase Catalog

Introduction​

Apache Gravitino provides the ability to manage OceanBase metadata.

caution
  1. Gravitino saves some system information in schema and table comment, like (From Gravitino, DO NOT EDIT: gravitino.v1.uid1078334182909406185), do not change or remove this message.
  2. OceanBase catalog is not included in standard Gravitino distribution, but you can still build it from source if you need it. Check build from source for more details.

Catalog​

Catalog Capabilities​

  • Gravitino catalog corresponds to the OceanBase instance.
  • Supports metadata management of OceanBase (4.x).
  • Supports DDL operation for OceanBase databases and tables.
  • Supports table index.
  • Supports column default value and auto-increment.

Catalog Properties​

Pass to a OceanBase data source any property that isn't defined by Gravitino by adding gravitino.bypass. prefix as a catalog property. For example, catalog property gravitino.bypass.maxWaitMillis will pass maxWaitMillis to the data source property.

Check the relevant data source configuration in data source properties

If you use a JDBC catalog, you must provide jdbc-url, jdbc-driver, jdbc-user and jdbc-password to catalog properties. Besides the common catalog properties, the OceanBase catalog has the following properties:

Configuration itemDescriptionDefault valueRequired
jdbc-urlJDBC URL for connecting to the database. For example, jdbc:mysql://localhost:2881 or jdbc:oceanbase://localhost:2881(none)Yes
jdbc-driverThe driver of the JDBC connection. For example, com.mysql.jdbc.Driver or com.mysql.cj.jdbc.Driver or com.oceanbase.jdbc.Driver.(none)Yes
jdbc-userThe JDBC user name.(none)Yes
jdbc-passwordThe JDBC password.(none)Yes
jdbc.pool.min-sizeThe minimum number of connections in the pool. 2 by default.2No
jdbc.pool.max-sizeThe maximum number of connections in the pool. 10 by default.10No
jdbc.pool.max-wait-msThe maximum Duration that the pool will wait for a connection to be returned. 30000 by default.30000No
caution

Gravitino does not package the OceanBase JDBC driver due to licensing, so you must supply it yourself. OceanBase speaks the MySQL wire protocol, so either driver works: OceanBase Connector/J (com.oceanbase:oceanbase-client, 2.4.18 or later; the com.oceanbase.jdbc.Driver class) or MySQL Connector/J (com.mysql:mysql-connector-j, 8.0.16 or later; the com.mysql.cj.jdbc.Driver class). Download it from Maven Central (OceanBase, MySQL) and place the JAR in the catalogs/jdbc-oceanbase/libs directory.

For container or Kubernetes deployments where you cannot copy into that directory directly, supply the driver through your deployment's mechanism for adding catalog libraries. The catalog fails fast at creation time with a clear message if the driver is absent.

Driver Version Compatibility​

The OceanBase catalog includes driver version compatibility checks for datetime precision calculation:

  • MySQL Connector/J versions >= 8.0.16: Full support for datetime precision calculation
  • MySQL Connector/J versions < 8.0.16: Limited support - datetime precision calculation returns null with a warning log

This limitation affects the following datetime types:

  • TIME(p) - time precision
  • TIMESTAMP(p) - timestamp precision
  • DATETIME(p) - datetime precision

When using an unsupported driver version, the system will:

  1. Continue to work normally with default precision (0)
  2. Log a warning message indicating the driver version limitation
  3. Return null for precision calculations to avoid incorrect results

Example warning log:

WARN: MySQL driver version mysql-connector-java-8.0.11 is below 8.0.16, 
columnSize may not be accurate for precision calculation.
Returning null for TIMESTAMP type precision. Driver version: mysql-connector-java-8.0.11

Recommended driver versions:

  • mysql-connector-java-8.0.16 or higher
  • com.oceanbase.jdbc.Driver (OceanBase official driver)

Catalog Operations​

Refer to Manage Catalogs and Schemas for more details.

note

Sensitive catalog properties such as jdbc-user and jdbc-password are hidden from the load catalog response. Use the credential vending API to retrieve them at runtime.

Schema​

Schema Capabilities​

  • Gravitino's schema concept corresponds to the OceanBase database.
  • Supports creating schema, but does not support setting comment.
  • Supports dropping schema.
  • Supports cascade dropping schema.

Schema Properties​

  • Doesn't support any schema property settings.

Schema Operations​

Refer to Manage Catalogs and Schemas for more details.

Table​

Table Capabilities​

  • Gravitino's table concept corresponds to the OceanBase table.
  • Supports DDL operation for OceanBase tables.
  • Supports index.
  • Supports column default value and auto-increment..

Table Properties​

  • Doesn't support table properties.

Table Column Types​

Gravitino TypeOceanBase Type
ByteTinyint
Byte(false)Tinyint Unsigned
ShortSmallint
Short(false)Smallint Unsigned
IntegerInt
Integer(false)Int Unsigned
LongBigint
Long(false)Bigint Unsigned
FloatFloat
DoubleDouble
StringText
DateDate
Time[(p)]Time[(p)]
Timestamp_tz[(p)]Timestamp[(p)]
Timestamp[(p)]Datetime[(p)]
DecimalDecimal
VarCharVarChar
FixedCharFixedChar
BinaryBinary
info

OceanBase doesn't support Gravitino Boolean Fixed Struct List Map IntervalDay IntervalYear Union UUID type. Meanwhile, the data types other than listed above are mapped to Gravitino External Type that represents an unresolvable data type.

Table Column Auto-Increment​

note

OceanBase setting an auto-increment column requires simultaneously setting a unique index; otherwise, an error will occur.

{
"columns": [
{
"name": "id",
"type": "integer",
"comment": "id column comment",
"nullable": false,
"autoIncrement": true
},
{
"name": "name",
"type": "varchar(500)",
"comment": "name column comment",
"nullable": true,
"autoIncrement": false
}
],
"indexes": [
{
"indexType": "primary_key",
"name": "PRIMARY",
"fieldNames": [["id"]]
}
]
}

Table Indexes​

  • Supports PRIMARY_KEY and UNIQUE_KEY.
{
"indexes": [
{
"indexType": "primary_key",
"name": "PRIMARY",
"fieldNames": [["id"]]
},
{
"indexType": "unique_key",
"name": "id_name_uk",
"fieldNames": [["id"] ,["name"]]
}
]
}

Table Operations​

note

The OceanBase catalog does not support creating partitioned tables in the current version.

Refer to Manage Relational Metadata Using Gravitino for more details.

Alter Table Operations​

Gravitino supports these table alteration operations:

  • RenameTable
  • UpdateComment
  • AddColumn
  • DeleteColumn
  • RenameColumn
  • UpdateColumnType
  • UpdateColumnPosition
  • UpdateColumnNullability
  • UpdateColumnComment
  • UpdateColumnDefaultValue
  • SetProperty
info
  • You cannot submit the RenameTable operation at the same time as other operations.
  • If you update a nullability column to non-nullability, there may be compatibility issues.