A Hudi catalog is an external catalog that lets you query Hudi tables from an E-MapReduce (EMR) StarRocks cluster. This topic explains how to create a Hudi catalog and query Hudi tables.
Prerequisites
Before you begin, ensure that you have:
-
A cluster with the Hudi service, such as a DataLake cluster or a custom cluster. For more information, see Create a cluster
-
A cluster with the StarRocks service, such as an online analytical processing (OLAP) cluster or a custom cluster, and you have logged on to the cluster. For more information, see Create a cluster and Getting started
Limitations
Both clusters must be deployed in the same virtual private cloud (VPC) and zone.
Create a Hudi catalog
Syntax
CREATE EXTERNAL CATALOG <catalog_name>
PROPERTIES
(
"key" = "value",
...
);
Parameters
`catalog_name` (required)
The name of the Hudi catalog. The name must meet the following requirements:
-
Contains only letters, digits, and underscores (
_), and starts with a letter. -
Is 1 to 64 characters in length.
`PROPERTIES` (required)
The properties of the Hudi catalog. The required properties depend on the metadata service used by your Hudi data source.
Hive Metastore
| Property | Required | Description |
|---|---|---|
type |
Yes | The type of the data source. Set the value to hudi. |
hive.metastore.uris |
Yes | The URI of the Hive Metastore service, in the format thrift://<IP address>:<port number>. The default port number is 9083. This parameter can be left empty if you use Data Lake Formation (DLF) to store metadata. |
hive.metastore.type |
No | The type of the metastore. Defaults to Hive Metastore when left blank. Set to dlf to use Data Lake Formation (DLF) as the metadata service instead. |
dlf.catalog.id |
No | The ID of the DLF catalog to read from. Required only when hive.metastore.type is set to dlf. If not specified, the default DLF catalog ID is used. |
Data Lake Formation (DLF)
To use DLF as the metadata service, see Access external tables whose metadata is stored in DLF.
Example
The following statement creates a Hudi catalog named hudi_catalog using Hive Metastore:
CREATE EXTERNAL CATALOG hudi_catalog
PROPERTIES
(
"type" = "hudi",
"hive.metastore.uris" = "thrift://xx.xx.xx.xx:9083"
);
Query data in a Hudi table
After creating a Hudi catalog, run a SELECT statement to query a specific table:
SELECT * FROM <catalog_name>.<database_name>.<table_name>;
What's next
For background information on Hudi, see Overview.