You need to enable JavaScript to run this app.
ByteHouse Cloud Data Warehouse Version

ByteHouse Cloud Data Warehouse Version

Copy page
Download PDF
External Catalog
Hive Catalog
Copy page
Download PDF
Hive Catalog

ByteHouse cloud data warehouse edition supports integrating Hive Catalog. You do not need to manually create external databases or tables; you can query Hive data via Hive Catalog. This article will introduce how to create and use Hive Catalog.

Background information

When ByteHouse accesses the Hive cluster, it must have privileges to access the Hive metadata storage (metastore) service. Currently, ByteHouse supports the following metadata storage services:

  • Standard Hive metastore
  • LAS Formation from BytePlus AI Data Lake Service LAS

The method for creating Hive Catalog varies depending on the metadata storage service used; you can select the corresponding method according to your actual service. Additionally, ByteHouse also experimentally supports AWS Glue Datacatalog, which you can create as needed.

Prerequisites

Please obtain the following privileges and connection information according to the metadata storage type used by your Hive.

Metadata storage service type

Required permissions and connection information

S3-compatible object storage service

  • Obtain the access permissions for the S3-compatible object storage service used by Hive.
  • Connection address for Hive metadata storage.
  • Access Key ID (AK)/Secret Access Key (SK) with access permissions to the S3-compatible object storage service. If you are using the BytePlus object storage service TOS, see Access Key (key) management for how to obtain it.
  • The endpoint of the S3-compatible object storage service. If you are using the BytePlus object storage service TOS, see Region and URL Full Domain (Endpoint) for how to obtain it.

LAS

  • Access permissions for the LAS Catalog, as well as database and table-level read and write permissions. For configuration details, see LAS access control.
  • Connection information:
    • The endpoint and access keys (Access Key ID (AK)/Secret Access Key (SK)) for the TOS service used by LAS.
    • The region where the physical data center of the TOS (Volcano Engine Object Storage Service) used by LAS is located. For a list of common regions, see Region and URL Full Domain.
    • LAS access key AK/SK. For information on how to obtain it, see Access Key (密钥) management.
    • LAS catalog name.
    • The metadata storage service address of LAS. For addresses corresponding to common regions, see URL.

To create an AWS Glue Catalog, obtain the following information in advance:

  • Glue service endpoint.
  • Region where Glue is located.
  • Glue Catalog ID, which is a 12-digit AWS account name; for details, refer to AWS Account ID document.
  • Key with Glue access privileges.
  • Region of the AWS S3 storage bucket.
  • AWS S3 service endpoint.
  • Key AK/SK with AWS S3 access privileges.

Create Hive Catalog

Hive uses different metadata services, and the corresponding parameter configuration will also be different. This section will introduce the method for creating Hive Catalog by metadata service type.

S3

When data is stored in S3-compatible object storage, you can use the following command:

CREATE EXTERNAL CATALOG `{catalogName}`
properties
  type='hive',
  metastore_type='hive',
  hive_metastore_uri = 'thrift://hive_thrift_server_ip:port',
  endpoint = 's3_endpoint',
  ak_id = 's3_ak',
  ak_secret = 's3_sk';

Param

Configuration description

Create catalog description

Replace {catalogName} with your custom catalog name.

Catalog param

  • type='hive': Set to hive.
  • metastore_type: Set to hive.
  • hive_metastore_uri: The connection address of the Hive Metastore service. The format and example are as follows:
    • Format: thrift://hive_thrift_server_ip:port, where <hive_thrift_server_ip> is the IP address of the Hive Thrift server, and <port> is the port number. You can refer to the official documentation of the Hive service you use to obtain the connection address information.
    • Example: thrift:// 101.1xx.xx.xxx:9083
  • endpoint: The connection address of the external data source. For example, if you use the TOS (Volcano Engine Object Storage Service), you can log in to the TOS console and view the required endpoint via the path Bucket List > Bucket Name > Overview > URL Full Domain. As shown in the figure below, the endpoint is tos-s3-cn-beijing.volces.com. For a list of common endpoints, see Region and URL Full Domain (Endpoint).

Image

  • ak_id/ak_secret: The key with S3 access privilege. If you use the TOS (Volcano Engine Object Storage Service), see Access Key (密钥) management for how to obtain it.

LAS

CREATE EXTERNAL CATALOG `{your_catalog_name}` 
PROPERTIES 
type='hive',
metastore_type='lf',
endpoint='tos-s3-{REGION}.ivolces.com',
ak_id='xxx',
ak_secret='xxx==',
lf_metastore_ak_id='xxx',
lf_metastore_ak_secret='xxx==',
lf_metastore_catalog='catalogName',
lf_metastore_region='region',
lf_metastore_url = 'thrift://lf_thrift_server_ip:port';

Param

Configuration description

Create catalog description

Replace {your_catalog_name} with your custom catalog name.

Catalog param

  • type='hive': Set to hive.
  • metastore_type='lf': Set to lf.
  • endpoint: The endpoint of the TOS (Volcano Engine Object Storage Service) used by LAS. You can log in to the TOS console and view the required endpoint via the path Bucket List > Bucket Name > Overview > URL Full Domain. As shown in the figure below, the endpoint is tos-s3-cn-beijing.volces.com. For a list of common endpoints, see Region and URL Full Domain (Endpoint).
    Image
  • ak_id/ak_secret: Configure with a TOS key that has access privilege. For information on how to obtain it, see Access Key (密钥) management.
  • lf_metastore_ak_id/lf_metastore_ak_secret: Configure with an LAS key that has access privilege. For information on how to obtain it, see Access Key (密钥) management.
  • lf_metastore_catalog: Enter the name of the catalog you want to connect to, which already exists in LAS, so that ByteHouse can locate the correct external data directory. You can log in to the LAS console, click Database > Metadata management in the left navigation bar, and view the catalog name.
  • lf_metastore_region: Configuration for the physical data center region where the TOS storage service used by LAS is located. For common region names, refer to Region and Access Domain.
  • lf_metastore_url: Configuration for the metadata storage service address of LAS. Fill in the connection address for the region where LAS is located: thrift://lakeformation.las.{REGION}. ivolces.com:48869. The corresponding addresses for common regions are as follows:
    • cn-beijing:thrift://lakeformation.las.cn-beijing.ivolces.com:48869
    • cn-shanghai:thrift://lakeformation.las.cn-shanghai.ivolces.com:48869
    • cn-guangzhou:thrift://lakeformation.las.cn-guangzhou.ivolces.com:48869
    • ap-southeast-1:thrift://lakeformation.las.ap-southeast-1.ivolces.com:48869

AWS Glue Catalog

ByteHouse also experimentally supports AWS Glue Datacatalog.

CREATE EXTERNAL CATALOG `{your_glue_catalog_name}` 
PROPERTIES
type='glue',
    aws_glue_endpoint = 'glue_endpoint',
    aws_glue_region='glue_region',
    aws_glue_catalog_id='glue_catalog_id',
    aws_glue_ak_id = 'glue_ak',
    aws_glue_ak_secret = 'glue_sk',
    region= 's3_region',
    endpoint = 's3_endpoint',
    ak_id = 's3_ak',
    ak_secret = 's3_sk';

Parameters

Configuration description

Create catalog description

Replace {your_glue_catalog_name} with your custom catalog name.

Catalog parameters

  • type='glue': Fixed as glue.
  • aws_glue_endpoint: Glue service endpoint.
  • aws_glue_region: Region where Glue is located.
  • aws_glue_catalog_id: Glue Catalog ID. This value is a 12-digit AWS account number. For details, refer to AWS Account ID Document.
  • aws.glue.ak_id/aws.glue.ak_secret: Key with Glue access privilege.
  • region: Region to which the S3 bucket belongs.
  • endpoint: S3 service endpoint.
  • ak_id/ak_secret: Key with S3 access privilege.

View Hive Catalog

View all catalogs.

SHOW EXTERNAL CATALOGS;

View the schema information of a catalog.

SHOW CREATE EXTERNAL CATALOG catalog_name;

Use Hive Catalog

Suppose you have already created an external catalog named hive_s3.

Query tables in Hive Catalog

Users can directly access tables in Hive Catalog using the three-part naming convention catalog_name.db_name.table_name, for example:

SELECT * FROM hive_s3.hive_db_name.hive_table_name;

ByteHouse native CnchMergeTree tables can also be accessed with the following SQL. Among them, cnch (abbreviation for cloud-native-clickhouse) is used as the default catalog name for ByteHouse CDW.

SELECT * FROM cnch.cnch_db_name.cnch_db_name;
-- Equivalent to SELECT * FROM cnch_db_name.cnch_db_name;

Cross-catalog query

By using external catalogs, you can directly join Hive external tables and ByteHouse CnchMergeTree tables.

SELECT * FROM hive_s3.hive_db.hive_table 
UNION ALL 
SELECT (1) FROM cnch.cnch_db.cnch_table;

List databases and tables in Hive Catalog

List database names in the catalog.

SHOW DATABASES FROM catalog_name;

List table names in the database.

SHOW TABLES FROM catalog_name.database_name;

Obtain the create statement of the table.

SHOW CREATE TABLE catalog_name.database_name.table_name;

Switch catalog

You can use the following SQL to change the default catalog:

SWITCH CATALOG catalog_name;

At this point, when you run the query statement again, ByteHouse will read data from the specified database and table under the Hive Catalog.

SELECT * FROM hive_db.hive_table;

To switch back to the ByteHouse default Catalog, you can use any of the following commands:

# 方式 1
SWITCH CATALOG default;

# 方式 2
SWITCH CATALOG cnch;

You can also use the following command to directly switch the default database to the specified database under the Hive Catalog:

USE hive_s3.hive_db;

To switch back to ByteHouse internal tables, use the following command:

USE cnch.cnch_database_name;

Query the currently used Catalog

You can use the currentCatalog() function to query the current Catalog.

SELECT currentCatalog();

Query Hive Catalog metadata

You can use the following statements to query metadata of databases, tables, and partitions in the Hive Catalog, including database name, storage path, attributes, and so on.

  • Query metadata of databases in the Hive Catalog

    SELECT * FROM catalog_name.database_name.__properties__
    
  • Query metadata of tables in the Hive Catalog

    SELECT * FROM catalog_name.database_name.table_name$metadata$properties
    
  • Query metadata of table partitions in the Hive Catalog

    SELECT * FROM {catalog_name.}database_name.table_name$metadata$partitions
    

Delete Hive Catalog

You can use the following command to delete the Hive Catalog.

DROP EXTERNAL CATALOG [IF EXISTS] catalog_name;

Use Hive Catalog through the ByteHouse Cloud Data Warehouse Edition Console

ByteHouse Cloud Data Warehouse Edition also supports creating and using Hive Catalog through the ByteHouse Cloud Data Warehouse Edition Console. For details, see Manage external catalog.

Use Hive external tables

In addition to accessing Hive data through the Hive Catalog, ByteHouse also supports querying and writing Hive data through external tables. For details, see Hive external table.

Last updated: 2026.03.31 16:23:16