- 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
Usage notes
- The file format of Delta Lake that the database supports is Parquet. Parquet files support the following compression formats: SNAPPY, LZ4, ZSTD, GZIP, and NO_COMPRESSION.
Integration preparations
Before you create a Delta Lake catalog, make sure your cluster can integrate with the storage system and metastore of your Delta Lake cluster.AWS IAM
If your Delta Lake cluster uses 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. The following authentication methods are recommended:- Instance profile
- Assumed role
- IAM user
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 Delta Lake 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 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 BE_HOME/conf path of each BE or the $CN_HOME/conf path of each CN.
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 principalcommand 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 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.confis the save path of the krb5.conf file. You can modify the path based on your needs.
Create a Delta Lake catalog
Syntax
Parameters
catalog_name
The name of the Delta Lake 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 Delta Lake catalog. This parameter is optional.type
The type of your data source. Set the value todeltalake.
MetastoreParams
A set of parameters about how the database integrates with the metastore of your data source.Hive metastore
If you choose Hive metastore as the metastore of your data source, configureMetastoreParams as follows:
/etc/hosts path. Otherwise, the database may fail to access your Hive metastore when you start a query.
The following table describes the parameter 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
MetastoreParamsas follows: -
To choose the assumed role-based authentication method, configure
MetastoreParamsas follows: -
To choose the IAM user-based authentication method, configure
MetastoreParamsas follows:
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 configureStorageCredentialParams.
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 for your Delta Lake cluster, take one of the following actions:-
To choose the instance profile-based authentication method, configure
StorageCredentialParamsas follows: -
To choose the assumed role-based authentication method, configure
StorageCredentialParamsas follows: -
To choose the IAM user-based authentication method, configure
StorageCredentialParamsas follows:
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
Delta Lake catalogs support S3-compatible storage systems from v2.5 onwards. If you choose an S3-compatible storage system, such as MinIO, as storage for your Delta Lake cluster, configureStorageCredentialParams as follows to ensure a successful integration:
StorageCredentialParams.
Microsoft Azure Storage
Delta Lake catalogs support Microsoft Azure Storage from v3.0 onwards.Azure Blob Storage
If you choose Blob Storage as storage for your Delta Lake cluster, take one of the following actions:-
To choose the Shared Key authentication method, configure
StorageCredentialParamsas follows:The following table describes the parameters you need to configure inStorageCredentialParams. -
To choose the SAS Token authentication method, configure
StorageCredentialParamsas follows:The following table describes the parameters you need to configure inStorageCredentialParams.
Azure Data Lake Storage Gen2
If you choose Data Lake Storage Gen2 as storage for your Delta Lake cluster, take one of the following actions:-
To choose the Managed Identity authentication method, configure
StorageCredentialParamsas follows:The following table describes the parameters you need to configure inStorageCredentialParams. -
To choose the Shared Key authentication method, configure
StorageCredentialParamsas follows:The following table describes the parameters you need to configure inStorageCredentialParams. -
To choose the Service Principal authentication method, configure
StorageCredentialParamsas follows:The following table describes the parameters you need to configurein StorageCredentialParams. -
To choose the Workload Identity authentication method, configure
StorageCredentialParamsas follows:The following table describes the parameters you need to configure inStorageCredentialParams.
Azure Data Lake Storage Gen1
If you choose Data Lake Storage Gen1 as storage for your Delta Lake cluster, take one of the following actions:-
To choose the Managed Service Identity authentication method, configure
StorageCredentialParamsas follows:The following table describes the parameters you need to configure inStorageCredentialParams. -
To choose the Service Principal authentication method, configure
StorageCredentialParamsas follows:The following table describes the parameters you need to configure inStorageCredentialParams.
Google GCS
Delta Lake catalogs support Google GCS from v3.0 onwards. If you choose Google GCS as storage for your Delta Lake cluster, take one of the following actions:-
To choose the VM-based authentication method, configure
StorageCredentialParamsas follows:The following table describes the parameters you need to configure inStorageCredentialParams. -
To choose the service account-based authentication method, configure
StorageCredentialParamsas follows:The following table describes the parameters you need to configure inStorageCredentialParams. -
To choose the impersonation-based authentication method, configure
StorageCredentialParamsas 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.
-
Make a VM instance impersonate a service account:
MetadataUpdateParams
A set of parameters about how the database updates the cached metadata of Delta Lake. This parameter set is optional. From v3.3.3 onwards, Delta Lake Catalog supports Metadata Local Cache and Retrieval. In most cases, you can ignoreMetadataUpdateParams 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 Delta Lake is high, you can tune these parameters to further optimize the performance of automatic asynchronous updates.
Note
In most cases, if your Delta Lake data is updated at a granularity of 1 hour or less, the data update frequency is considered high.
Examples
The following examples create a Delta Lake catalog nameddeltalake_catalog_hms or deltalake_catalog_glue, depending on the type of metastore you use, to query data from your Delta Lake cluster.
HDFS
If you use HDFS as storage, run a command like below:AWS S3
If you choose instance profile-based credential
-
If you use Hive metastore in your Delta Lake cluster, run a command like below:
-
If you use AWS Glue in your Amazon EMR Delta Lake cluster, run a command like below:
If you choose assumed role-based credential
-
If you use Hive metastore in your Delta Lake cluster, run a command like below:
-
If you use AWS Glue in your Amazon EMR Delta Lake cluster, run a command like below:
If you choose IAM user-based credential
-
If you use Hive metastore in your Delta Lake cluster, run a command like below:
-
If you use AWS Glue in your Amazon EMR Delta Lake cluster, 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:
-
If you make a VM instance impersonate a service account, run a command like below:
View Delta Lake catalogs
You can use SHOW CATALOGS to query all catalogs in the current cluster:deltalake_catalog_glue:
Switch to a Delta Lake Catalog and a database in it
You can use one of the following methods to switch to a Delta Lake catalog and a database in it:-
Use SET CATALOG to specify a Delta Lake catalog in the current session, and then use USE to specify an active database:
-
Directly use USE to switch to a Delta Lake catalog and a database in it:
Drop a Delta Lake catalog
You can use DROP CATALOG to drop an external catalog. The following example drops a Delta Lake catalog nameddeltalake_catalog_glue:
View the schema of a Delta Lake table
You can use one of the following syntaxes to view the schema of a Delta Lake table:-
View schema
-
View schema and location from the CREATE statement
Query a Delta Lake table
-
Use SHOW DATABASES to view the databases in your Delta Lake cluster:
- Switch to a Delta Lake Catalog and a database in it.
-
Use SELECT to query the destination table in the specified database:
Load data from Delta Lake
Suppose you have an OLAP table namedolap_tbl, you can transform and load data like below:
Configure metadata cache and update strategy
From v3.3.3 onwards, Delta Lake Catalog supports Metadata Local Cache and Retrieval. You can configure the Delta Lake metadata cache refresh through the following FE parameters:Appendix: Metadata Local Cache and Retrieval
Because the repeated decompression and parsing of metadata files can introduce unnecessary delays, the database employs a new metadata cache strategy of caching deserialized memory objects. By storing these deserialized files in memory, the system can bypass the decompression and parsing stages for subsequent queries. This caching mechanism allows direct access to the required metadata, significantly reducing retrieval times. As a result, the system becomes more responsive and better suited to meet high query demands and materialized view rewriting needs. You can configure this behavior through the Catalog property MetadataUpdateParams and relevant configuration items.Feature support
Currently, Delta Lake catalogs support the following table features:- V2 Checkpoint (From v3.3.0 onwards)
- Timestamp without Timezone (From v3.3.1 onwards)
- Column mapping (From v3.3.6 onwards)
- Deletion Vector (From v3.4.1 onwards)