A data catalog registers an external metadata service, such as DLF, Hive Metastore (HMS), StarRocks, or Hologres, with an EMR Serverless Spark workspace. After registration, you can view the databases, tables, and columns in the console, and access the data by catalog name in SQL, interactive sessions, and Spark jobs. Data catalogs are useful for scenarios that require metadata isolation or analysis across data sources.
Catalog overview
EMR Serverless Spark provides a flexible catalog management system that supports various types of catalogs, such as Paimon, Iceberg, and StarRocks. In addition to the standard data catalog type, the system also supports a built-in catalog and custom catalogs. This section describes the catalog types in EMR Serverless Spark and how to configure and use them.
|
Catalog type |
Supported data sources |
How to add |
Description |
Usage |
|
Data catalog |
|
Manually add a catalog on the Catalog page. |
After you add a catalog, you must restart any running sessions for the changes to take effect. |
|
|
Custom catalog |
Paimon, Iceberg, and others |
Edit a session and add the required parameters on the Spark Configuration tab. |
This type requires manual parameter configuration and can be extended to support various data sources. For more information, see Use Iceberg and Paimon User Guide. |
|
Add data catalog
-
Go to the Data Catalogs page.
-
Log on to the EMR console.
-
In the left-side navigation pane, choose EMR Serverless > Spark.
-
On the Spark page, click the name of the target workspace.
-
On the EMR Serverless Spark page, click Catalog in the left-side navigation pane.
NoteThe Data Catalogs page displays the databases and tables from the Data Lake Formation data catalog that you selected when you created the workspace.
-
-
Click Add Catalog.
-
In the Add Catalog dialog box, select a catalog type, configure the required parameters, and click Add. The following catalog types are supported.
DLF data catalog
DLF Catalog is a service for managing and querying metadata in a data lake. By selecting an existing DLF data catalog or creating a new one, you can quickly access the metadata in your data lake.
To create a new DLF data catalog, click Create Catalog to go to the Data Lake Formation console. For more information, see Manage metadata.
When you use a DLF data catalog, only the following engine versions are supported: esr-4.3.0 or later, esr-3.3.0 or later, and esr-2.7.0 or later.
Hive Metastore (HMS) data catalog
External Hive Metastore is an independent metadata service typically used to manage metadata for Hive tables. You can configure this service to integrate metadata from an external Hive Metastore into your current environment.
Ensure that a network connection exists between EMR Serverless Spark and the VPC where the external Hive Metastore is located.
|
Parameter |
Description |
|
Network Connection |
The network connection to the VPC where the external Hive Metastore is located. Select an existing network connection from the drop-down list. For more information, see Step 1: Add a network connection. Note
|
|
Metastore service address |
The service address of the external Hive Metastore, in the format Where:
|
|
Kerberos authentication |
If Kerberos authentication is enabled for your external Hive Metastore, specify the keytab file path and the principal name.
|
To add an external Hive Metastore, see Connect to an external Hive Metastore.
StarRocks data catalog
StarRocks is a high-performance analytical database. Adding a StarRocks data catalog registers the metadata of a StarRocks instance in EMR Serverless Spark. After the catalog is added, you can read from and write to StarRocks data directly from your jobs and sessions without configuring connection parameters for each task. Ensure that a network connection exists between EMR Serverless Spark and the VPC where the StarRocks instance is located.
After you add the catalog, you can use a three-part identifier in SQL to read from and write to data in StarRocks. For example: SELECT * FROM <catalogName>.<dbName>.<tableName>;
StarRocks data catalogs are supported only on the following engine versions: esr-4.8.0 or later and esr-5.2.0 or later.
|
Parameter |
Description |
|
Catalog Name |
The name for the StarRocks data catalog. This name, which must be unique within the workspace, is used to reference the catalog in SQL. |
|
Normal Network Connection |
The network connection to the VPC where the StarRocks instance is located. Select an existing network connection from the drop-down list. For more information, see Step 1: Add a network connection. Note
|
|
Endpoint |
The frontend (FE) access address for StarRocks, such as |
|
Query Port |
The FE query port for StarRocks. Typically, this is 9030. |
|
Username |
The username for accessing StarRocks. Spark jobs use this username for authentication when reading from or writing to StarRocks data. |
|
Password |
The password for the specified username. |
To learn how to read from and write to StarRocks data in your tasks, see Read from and write to StarRocks.
Hologres data catalog
Hologres is a real-time data warehouse that supports high-throughput real-time writes and real-time analytics on large-scale data. Adding a Hologres data catalog registers the metadata of a Hologres instance in EMR Serverless Spark. After the catalog is added, you can read from and write to Hologres data directly from your jobs and sessions without configuring connection parameters for each task. Ensure that a network connection exists between EMR Serverless Spark and the VPC where the Hologres instance is located.
After you add the catalog, you can use a three-part identifier in SQL to read from and write to data in Hologres. Each catalog is strictly bound to one Hologres database, and cross-database access is not supported. In other words, you cannot use a single catalog to access multiple Hologres databases. The logical structure of the catalog is consistent with Hologres:
|
Spark concept |
Hologres concept |
Description |
|
Catalog |
Database |
For example, |
|
Namespace |
Schema |
For example, |
|
Table |
Table |
You must explicitly specify the table as |
Hologres data catalogs are supported only on the following engine versions: esr-4.9.0 or later.
|
Parameter |
Description |
|
Catalog Name |
The name for the Hologres data catalog. This name, which must be unique within the workspace, is used to reference the catalog in SQL. |
|
Normal Network Connection |
The network connection to the VPC where the Hologres instance is located. Select an existing network connection from the drop-down list. For more information, see Step 1: Add a network connection. Note
|
|
Endpoint |
The access address for the Hologres instance. You can find this on the instance details page in the Hologres console. |
|
Query Port |
The port for the Hologres instance. Typically, this is 80. |
|
Username |
The username for accessing Hologres. Spark jobs use this username for authentication when reading from or writing to Hologres data.
|
|
Password |
The password for the specified username.
|
To learn how to read from and write to Hologres data in your tasks, see Read from and write to Hologres.
View databases and tables
-
On the Catalog page, click a data catalog ID.
All databases in the data catalog are displayed.
-
In the Actions column, click Table.
All tables in the selected database are displayed.
-
In the Actions column, click Field.
The schema and column details for the selected table are displayed.
Use a data catalog in SQL
After you add a data catalog, you can access its databases and tables by catalog name in SQL development and interactive sessions, without specifying connection information in each task.
Switch the default catalog and database
After you switch, subsequent statements can reference tables by name instead of a full three-part identifier.
-- Switch the default catalog
USE <catalogName>;
-- Switch the default catalog and database
USE <catalogName>.<dbName>;
Query by using a three-part identifier
If you do not switch the default catalog, reference the table directly as catalogName.dbName.tableName.
SELECT * FROM <catalogName>.<dbName>.<tableName>;
For a Hologres data catalog, the second part of the identifier is a schema rather than a database. Each Hologres data catalog is bound to one database, and the default schema is public.
-- Hologres: the second part is a schema. The default schema is public.
SELECT * FROM <hologresCatalog>.public.<tableName>;
-- You can also switch the catalog and schema first, and then reference the table by name.
USE <hologresCatalog>;
USE public;
SELECT * FROM <tableName>;
Join data across catalogs
A single statement can reference tables from different data catalogs by using three-part identifiers. The following example joins a user dimension table in DLF with an order table in Hologres.
SELECT
d.user_id,
d.user_name,
o.order_id,
o.amount
FROM dlf_catalog.user_db.dim_user AS d
JOIN hologres_catalog.public.orders AS o
ON d.user_id = o.user_id;
Before you run the statement, make sure that all referenced data catalogs are added, the networks are reachable, and your identity has permissions on the corresponding databases and tables.
Use a data catalog in PySpark
In PySpark, use three-part identifiers to read from and write to tables in a data catalog.
# Read a table
df = spark.table("<catalogName>.<dbName>.<tableName>")
# Write to a table
(
df.write
.mode("append")
.saveAsTable("<catalogName>.<dbName>.<tableName>")
)
You can also read tables from different data catalogs and then join them.
dim_user = spark.table("dlf_catalog.user_db.dim_user")
orders = spark.table("hologres_catalog.public.orders")
result = orders.join(dim_user, on="user_id", how="inner")
result.show()
Before you write data, make sure that the target data source supports the write mode and that your account has write permissions.
Delete a data catalog
-
On the Catalog page, find the data catalog that you want to delete.
-
Click Delete in the Actions column and confirm the operation as prompted.
Deleting a data catalog removes only its registration from the current workspace. The databases, tables, and data in DLF, HMS, StarRocks, or Hologres are not deleted.
After the deletion, running sessions may still use the previous configuration. Restart the sessions and verify that the catalog is no longer accessible.
FAQ
A catalog is reported as not found in SQL after it is added
Running interactive sessions do not automatically reload data catalog configurations. Restart the session and verify that the catalog name in your SQL matches the name shown on the data catalog page. Sessions and jobs that start later load the latest configuration at startup.
Adding a data catalog or the connectivity test fails
Check the following items in order:
-
The network connection is available.
-
The workspace and the target service reside in the same region and in the expected VPC.
-
Routes, security groups, and the whitelist of the target service allow the access.
-
The endpoint and port are correct.
-
The username, password, and authentication method are correct.
-
The current engine version meets the requirements of the catalog type.
The DLF list does not contain the expected data catalog
DLF data catalogs are region-specific. Make sure that the data catalog resides in the same region as the workspace, and check whether your account has read permissions on the data catalog.
The HMS connection times out
Check the network connection, security group rules, the status of the HMS service, and the Thrift port. The default port is 9083, but the actual port depends on your deployment. If the address cannot be resolved, check the DNS configuration of the VPC in which the workspace resides, or use a reachable internal address instead.
A Hologres query reports that the table does not exist
A Hologres data catalog is bound to a single database, and a query must also specify the correct schema. Use catalogName.schemaName.tableName, or run USE <schemaName> first. The default schema is usually public.
Can I add multiple data catalogs to one workspace?
Yes. You can add multiple data catalogs of the same type or of different types. Each catalog is registered independently, but names must be unique within a workspace. To access multiple Hologres databases, add one data catalog for each database.
Does deleting a data catalog delete business data?
No. The deletion removes only the registration from the workspace. The databases, tables, and data in the external service are not affected.
Why are MaxCompute and Iceberg not listed as catalog types?
MaxCompute is accessed by using the Spark MaxCompute Connector and is not registered on the data catalog page. Iceberg is a custom catalog that you enable in the Spark configuration of a session or job. For more information, see Use Iceberg.
A DLF data catalog uses the Paimon format by default. You do not need to add a separate Paimon catalog. For more information about Paimon, see Paimon User Guide.