Skip to main content
Beta feature Advice on use of Beta features A unified catalog is a type of external catalog that is provided by the database from v3.2 onwards to handle tables from Apache Hive™, Apache Iceberg, Apache Hudi, Delta Lake, and Apache Kudu data sources as a unified data source without ingestion. With unified catalogs, you can:
  • Directly query data stored in Hive, Iceberg, Hudi, Delta Lake, Paimon, and Kudu without the need to manually create tables.
  • Use INSERT INTO or asynchronous materialized views (which are supported from v2.5 onwards) to process data stored in Hive, Iceberg, Hudi, Delta Lake, Paimon, and Kudu and load the data into the database.
  • Perform operations on the database to create or drop Hive and Iceberg databases and tables.
To ensure successful SQL workloads on your unified data source, your cluster must be able to access the storage system and metastore of your unified data source. The database supports the following storage systems and metastores:
  • Distributed file system (HDFS) or object storage like AWS S3, Microsoft Azure Storage, Google GCS, or other S3-compatible storage system (for example, MinIO)
  • Metastore like Hive metastore or AWS Glue
    NOTE If you choose AWS S3 as storage, you can use HMS or AWS Glue as metastore. If you choose any other storage system, you can only use HMS as metastore.

Limits

One unified catalog supports integrations with only a single storage system and a single metastore service. Therefore, make sure all the data sources you want to integrate as a unified data source with the database use the same storage system and metastore service.

Usage notes

Integration preparations

Before you create a unified catalog, make sure your cluster can integrate with the storage system and metastore of your unified data source.

AWS IAM

If you use AWS S3 as storage or AWS Glue as metastore, choose your suitable authentication method and make the required preparations to ensure that your cluster can access the related AWS cloud resources. For more information, see Authenticate to AWS resources - Preparations.

HDFS

If you choose HDFS as storage, configure your cluster as follows:
  • (Optional) Set the username that is used to access your HDFS cluster and Hive metastore. By default, the database uses the username of the FE and BE or CN processes to access your HDFS cluster and Hive metastore. You can also set the username by adding export HADOOP_USER_NAME="<user_name>" at the beginning of the fe/conf/hadoop_env.sh file of each FE and at the beginning of the be/conf/hadoop_env.sh file of each BE or the cn/conf/hadoop_env.sh file of each CN. After you set the username in these files, restart each FE and each BE or CN to make the parameter settings take effect. You can set only one username for each cluster.
  • When you query data, the FEs and BEs or CNs of your cluster use the HDFS client to access your HDFS cluster. In most cases, you do not need to configure your cluster to achieve that purpose, and the database starts the HDFS client using the default configurations. You need to configure your cluster only in the following situations:
    • High availability (HA) is enabled for your HDFS cluster: Add the hdfs-site.xml file of your HDFS cluster to the FEHOME/conf∗∗pathofeachFEandtothe∗∗FE_HOME/conf** path of each FE and to the **BE_HOME/conf path of each BE or the $CN_HOME/conf path of each CN.
    • View File System (ViewFs) is enabled for your HDFS cluster: Add the core-site.xml file of your HDFS cluster to the FEHOME/conf∗∗pathofeachFEandtothe∗∗FE_HOME/conf** path of each FE and to the **BE_HOME/conf path of each BE or the $CN_HOME/conf path of each CN.
NOTE If an error indicating an unknown host is returned when you send a query, you must add the mapping between the host names and IP addresses of your HDFS cluster nodes to the /etc/hosts path.

Kerberos authentication

If Kerberos authentication is enabled for your HDFS cluster or Hive metastore, configure your cluster as follows:
  • Run the kinit -kt keytab_path principal command on each FE and each BE or CN to obtain Ticket Granting Ticket (TGT) from Key Distribution Center (KDC). To run this command, you must have the permissions to access your HDFS cluster and Hive metastore. Note that accessing KDC with this command is time-sensitive. Therefore, you need to use cron to run this command periodically.
  • Add JAVA_OPTS="-Djava.security.krb5.conf=/etc/krb5.conf" to the FEHOME/conf/fe.conf∗∗fileofeachFEandtothe∗∗FE_HOME/conf/fe.conf** file of each FE and to the **BE_HOME/conf/be.conf file of each BE or the $CN_HOME/conf/cn.conf file of each CN. In this example, /etc/krb5.conf is the save path of the krb5.conf file. You can modify the path based on your needs.

Create a unified catalog

Syntax

Parameters

catalog_name

The name of the unified catalog. The naming conventions are as follows:
  • The name can contain letters, digits (0-9), and underscores (_). It must start with a letter.
  • The name is case-sensitive and cannot exceed 1023 characters in length.

comment

The description of the unified catalog. This parameter is optional.

type

The type of your data source. Set the value to unified.

MetastoreParams

A set of parameters about how the database integrates with your metastore.
Hive metastore
If you choose Hive metastore as the metastore of your unified data source, configure MetastoreParams as follows:
NOTE Before querying data, you must add the mapping between the host names and IP addresses of your Hive metastore nodes to the /etc/hosts path. Otherwise, the database may fail to access your Hive metastore when you start a query.
The following table describes the parameters you need to configure in MetastoreParams.
AWS Glue
If you choose AWS Glue as the metastore of your data source, which is supported only when you choose AWS S3 as storage, take one of the following actions:
  • To choose the instance profile-based authentication method, configure MetastoreParams as follows:
  • To choose the assumed role-based authentication method, configure MetastoreParams as follows:
  • To choose the IAM user-based authentication method, configure MetastoreParams as follows:
The following table describes the parameters you need to configure in MetastoreParams. For information about how to choose an authentication method for accessing AWS Glue and how to configure an access control policy in the AWS IAM Console, see Authentication parameters for accessing AWS Glue.

StorageCredentialParams

A set of parameters about how the database integrates with your storage system. This parameter set is optional. If you use HDFS as storage, you do not need to configure StorageCredentialParams. If you use AWS S3, other S3-compatible storage system, Microsoft Azure Storage, or Google GCS as storage, you must configure StorageCredentialParams.
AWS S3
If you choose AWS S3 as storage, take one of the following actions:
  • To choose the instance profile-based authentication method, configure StorageCredentialParams as follows:
  • To choose the assumed role-based authentication method, configure StorageCredentialParams as follows:
  • To choose the IAM user-based authentication method, configure StorageCredentialParams as follows:
The following table describes the parameters you need to configure in StorageCredentialParams. For information about how to choose an authentication method for accessing AWS S3 and how to configure an access control policy in AWS IAM Console, see Authentication parameters for accessing AWS S3.
S3-compatible storage system
If you choose an S3-compatible storage system, such as MinIO, as storage, configure StorageCredentialParams as follows to ensure a successful integration:
The following table describes the parameters you need to configure in StorageCredentialParams.
Microsoft Azure Storage
Azure Blob Storage
If you choose Blob Storage as storage, take one of the following actions:
  • To choose the Shared Key authentication method, configure StorageCredentialParams as follows:
    The following table describes the parameters you need to configure in StorageCredentialParams.
  • To choose the SAS Token authentication method, configure StorageCredentialParams as follows:
    The following table describes the parameters you need to configure in StorageCredentialParams.
Azure Data Lake Storage Gen2
If you choose Data Lake Storage Gen2 as storage, take one of the following actions:
  • To choose the Managed Identity authentication method, configure StorageCredentialParams as follows:
    The following table describes the parameters you need to configure in StorageCredentialParams.
  • To choose the Shared Key authentication method, configure StorageCredentialParams as follows:
    The following table describes the parameters you need to configure in StorageCredentialParams.
  • To choose the Service Principal authentication method, configure StorageCredentialParams as follows:
    The following table describes the parameters you need to configure in StorageCredentialParams.
  • To choose the Workload Identity authentication method, configure StorageCredentialParams as follows:
    The following table describes the parameters you need to configure in StorageCredentialParams.
Azure Data Lake Storage Gen1
If you choose Data Lake Storage Gen1 as storage, take one of the following actions:
  • To choose the Managed Service Identity authentication method, configure StorageCredentialParams as follows:
    The following table describes the parameters you need to configure in StorageCredentialParams.
  • To choose the Service Principal authentication method, configure StorageCredentialParams as follows:
    The following table describes the parameters you need to configure in StorageCredentialParams.
Google GCS
If you choose Google GCS as storage, take one of the following actions:
  • To choose the VM-based authentication method, configure StorageCredentialParams as follows:
    The following table describes the parameters you need to configure in StorageCredentialParams.
  • To choose the service account-based authentication method, configure StorageCredentialParams as follows:
    The following table describes the parameters you need to configure in StorageCredentialParams.
  • To choose the impersonation-based authentication method, configure StorageCredentialParams as follows:
    • Make a VM instance impersonate a service account:
      The following table describes the parameters you need to configure in StorageCredentialParams.
    • Make a service account (temporarily named as meta service account) impersonate another service account (temporarily named as data service account):
      The following table describes the parameters you need to configure in StorageCredentialParams.

MetadataUpdateParams

A set of parameters about how the database updates the cached metadata of Hive, Hudi, and Delta Lake. This parameter set is optional. For more information about the policies for updating cached metadata from Hive, Hudi, and Delta Lake, see Hive catalog, Hudi catalog, and Delta Lake catalog. In most cases, you can ignore MetadataUpdateParams and do not need to tune the policy parameters in it, because the default values of these parameters already provide you with an out-of-the-box performance. However, if the frequency of data updates in Hive, Hudi, or Delta Lake is high, you can tune these parameters to further optimize the performance of automatic asynchronous updates.

PaimonCatalogParams

A set of parameters about how to connect Paimon Catalog. This parameter set is optional.

KuduCatalogParams

A set of parameters about how to connect Kudu Catalog. This parameter set is optional.

Examples

The following examples create a unified catalog named unified_catalog_hms or unified_catalog_glue, depending on the type of metastore you use, to query data from your unified data source.

HDFS

If you use HDFS as storage, run a command like below:

AWS S3

Instance profile-based authentication
  • If you use Hive metastore, run a command like below:
  • If you use AWS Glue with Amazon EMR, run a command like below:
Assumed role-based authentication
  • If you use Hive metastore, run a command like below:
  • If you use AWS Glue with Amazon EMR, run a command like below:
IAM user-based authentication
  • If you use Hive metastore, run a command like below:
  • If you use AWS Glue with Amazon EMR, run a command like below:

S3-compatible storage system

Use MinIO as an example. Run a command like below:

Microsoft Azure Storage

Azure Blob Storage
  • If you choose the Shared Key authentication method, run a command like below:
  • If you choose the SAS Token authentication method, run a command like below:
Azure Data Lake Storage Gen1
  • If you choose the Managed Service Identity authentication method, run a command like below:
  • If you choose the Service Principal authentication method, run a command like below:
Azure Data Lake Storage Gen2
  • If you choose the Managed Identity authentication method, run a command like below:
  • If you choose the Shared Key authentication method, run a command like below:
  • If you choose the Service Principal authentication method, run a command like below:
  • If you choose the Workload Identity authentication method, run a command like below:

Google GCS

  • If you choose the VM-based authentication method, run a command like below:
  • If you choose the service account-based authentication method, run a command like below:
  • If you choose the impersonation-based authentication method:
    • If you make a VM instance impersonate a service account, run a command like below:
    • If you make a service account impersonate another service account, run a command like below:

View unified catalogs

You can use SHOW CATALOGS to query all catalogs in the current cluster:
You can also use SHOW CREATE CATALOG to query the creation statement of an external catalog. The following example queries the creation statement of a unified catalog named unified_catalog_glue:

Switch to a Unified Catalog and a database in it

You can use one of the following methods to switch to a unified catalog and a database in it:
  • Use SET CATALOG to specify a unified catalog in the current session, and then use USE to specify an active database:
  • Directly use USE to switch to a unified catalog and a database in it:

Drop a unified catalog

You can use DROP CATALOG to drop an external catalog. The following example drops a unified catalog named unified_catalog_glue:

View the schema of a table from a unified catalog

You can use one of the following syntaxes to view the schema of a table from a unified catalog:
  • View schema
  • View schema and location from the CREATE statement

Query data from a unified catalog

To query data from a unified catalog, follow these steps:
  1. Use SHOW DATABASES to view the databases in your unified data source with which the unified catalog is associated:
  2. Switch to a Hive Catalog and a database in it.
  3. Use SELECT to query the destination table in the specified database:

Load data from Hive, Iceberg, Hudi, Delta Lake, or Kudu

You can use INSERT INTO to load the data of a Hive, Iceberg, Hudi, Delta Lake, or Kudu table into a table created within a unified catalog. The following example loads the data of the Hive table hive_table into the table test_tbl created in the database test_database that belongs to the unified catalog unified_catalog:

Create a database in a unified catalog

Similar to the internal catalog of the database, if you have the CREATE DATABASE privilege on a unified catalog, you can use the CREATE DATABASE statement to create a database in that catalog.
NOTE You can grant and revoke privileges by using GRANT and REVOKE.
The database supports creating only Hive and Iceberg databases in unified catalogs. Switch to a unified catalog, and then use the following statement to create a database in that catalog:
The location parameter specifies the file path in which you want to create the database, which can be in either HDFS or cloud storage.
  • When you use Hive metastore as the metastore of your data source, the location parameter defaults to <warehouse_location>/<database_name.db>, which is supported by Hive metastore if you do not specify that parameter at database creation.
  • When you use AWS Glue as the metastore of your data source, the location parameter does not have a default value, and therefore you must specify that parameter at database creation.
The prefix varies based on the storage system you use:

Drop a database from a unified catalog

Similar to the internal databases of the database, if you have the DROP privilege on a database created within a unified catalog, you can use the DROP DATABASE statement to drop that database. You can only drop empty databases.
NOTE You can grant and revoke privileges by using GRANT and REVOKE.
The database supports dropping only Hive and Iceberg databases from unified catalogs. When you drop a database from a unified catalog, the database’s file path on your HDFS cluster or cloud storage will not be dropped along with the database. Switch to a unified catalog, and then use the following statement to drop a database in that catalog:

Create a table in a unified catalog

Similar to the internal databases of the database, if you have the CREATE TABLE privilege on a database created within a unified catalog, you can use the CREATE TABLE or [CREATE TABLE AS SELECT ../../sql-reference/sql-statements/table_bucket_part_index/CREATE_TABLE_AS_SELECT.mdELECT.md) statement to create a table in that database.
NOTE You can grant and revoke privileges by using GRANT and REVOKE.
The database supports creating only Hive and Iceberg tables in unified catalogs. Switch to a Hive Catalog and a database in it. Then, use CREATE TABLE to create a Hive or Iceberg table in that database:
For more information, see Create a Hive table and Create an Iceberg table. The following example creates a Hive table named hive_table. The table consists of three columns action, id, and dt, of which id and dtare partition columns.

Sink data to a table in a unified catalog

Similar to the internal tables of the database, if you have the INSERT privilege on a table created within a unified catalog, you can use the INSERT statement to sink the data of a table to that Unified Catalog table (currently only Parquet-formatted Unified Catalog tables are supported).
NOTE You can grant and revoke privileges by using GRANT and REVOKE.
The database supports sinking data only to Hive and Iceberg tables in unified catalogs. Switch to a Hive Catalog and a database in it. Then, use INSERT INTO to insert data into a Hive or Iceberg table in that database:
For more information, see Sink data to a Hive table and Sink data to an Iceberg table. The following example inserts three data rows to a Hive table named hive_table:

Drop a table from a unified catalog

Similar to the internal tables of the database, if you have the DROP privilege on a table created within a unified catalog, you can use the DROP TABLE statement to drop that table.
NOTE You can grant and revoke privileges by using GRANT and REVOKE.
The database supports dropping only Hive and Iceberg tables from unified catalogs. Switch to a Hive Catalog and a database in it. Then, use DROP TABLE to drop a Hive or Iceberg table in that database:
For more information, see Drop a Hive table and Drop an Iceberg table. The following example drops a Hive table named hive_table: