Skip to main content
Version: 0.4.0

Gravitino supported Catalogs

The catalogs currently supported by the Gravitino connector are as follows:

Create catalog

Trino itself does not support creating catalogs. Users can create catalogs through the Gravitino connector and then load them into Trino. The Gravitino connector provides the following stored procedures to create and delete catalogs.

Create catalog:

create_catalog(CATALOG varchar, PROVIDER varchar, PROPERTIES MAP(VARCHAR, VARCHAR), IGNORE_EXIST boolean);
  • CATALOG: The catalog name to be created.
  • PROVIDER: The catalog provider, currently only supports hive, lakehouse-iceberg, jdbc-mysql, jdbc-postgresql.
  • PROPERTIES: The properties of the catalog.
  • IGNORE_EXIST: The flag to ignore the error if the catalog already exists. It's optional, the default value is false.

The type of catalog properties reference:

Drop catalog:

drop_catalog(CATALOG varchar, IGNORE_NOT_EXIST boolean);
  • CATALOG: The catalog name to be created.
  • IGNORE_NOT_EXIST: The flag to ignore the error if the catalog does not exist. It's optional, the default value is false.

The two stored procedures are under the gravitino connector, and the system schema. So you need to use the following SQL to call them in the trino-cli:

Example: You can run the following SQL to create a catalog named mysql with jdbc-mysql provider.

-- Call stored procedures with position.
call gravitino.system.create_catalog(
'mysql',
'jdbc-mysql',
Map(
Array('jdbc-url', 'jdbc-user', 'jdbc-password', 'jdbc-driver'),
Array('jdbc:mysql:192.168.164.4:3306?useSSL=false', 'trino', 'ds123', 'com.mysql.cj.jdbc.Driver')
)
)
call gravitino.system.drop_datalog('mysql');

-- Call stored procedures with name.
call gravitino.system.create_catalog(
catalog =>'mysql',
provider => 'jdbc-mysql',
properties => Map(
Array('jdbc-url', 'jdbc-user', 'jdbc-password', 'jdbc-driver'),
Array('jdbc:mysql:192.168.164.4:3306?useSSL=false', 'trino', 'ds123', 'com.mysql.cj.jdbc.Driver')
),
ignore_exist => true
)

call gravitino.system.drop_datalog(
catalog => 'mysql'
ignore_not_exist => true
);

if you need more information about catalog, please refer to: Create a Catalog.

Data type mapping between Trino and Gravitino

Gravitino connector supports the following data type conversions between Trino and Gravitino currently. Depending on the detailed catalog, Gravitino may not support some data types conversion for this specific catalog, for example, Hive does not support TIME data type.

Gravitino TypeTrino Type
BooleanTypeBOOLEAN
ByteTypeTINYINT
ShortTypeSMALLINT
IntegerTypeINTEGER
LongTypeBIGINT
FloatTypeREAL
DoubleTypeDOUBLE
DecimalTypeDECIMAL
StringTypeVARCHAR
VarcharTypeVARCHAR
BinaryTypeVARBINARY
DateTypeDATE
TimeTypeTIME
TimestampTypeTIMESTAMP
ArrayTypeARRAY
MapTypeMAP
StructTypeROW

For more about Trino data types, please refer to Trino data types and Gravitino data types, please refer to Gravitino data types.