Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Table usage description in metadata of hive

Shulou Source: shulou.com Published: 2022-06-03 02:26:06 09月11日 Update

In this example, the metadata of Hive is stored in mysql

A thorough understanding of the purpose of each table and how each table is associated with each other is of great help in using hive

The number of tables may vary depending on the version of Hive; Hive 1.1is 36 tables and 1.2is 35 tables

Tables to focus on:

VERSION

DBS

CDS

TBLS

COLUMNS_V2

PARTITIONS

PARTITION_KEYS

PARTITION_KEY_VALUES

FUNCS

VERSION table

There can be only one message in this table. If it is 0 or more than 1, Hive cannot be started. This table records the version information of Hive.

DBS table

This table records the database information in Hive, including the ID of the database (DB_ID), the storage location on the HDFS (DB_LOCATION_URI), and the name of the DB (NAME field)

TBLS table

This table records the table information in the Hive library; contains the table's ID (TBL_ID), database to which it belongs (DB_ID), table name (TBL_NAME), table type (TBL_TYPE, such as internal or external tables), table storage format (SD_ID); select * from TBLS\ G

SDS table

This table records the input, output format, storage location and other information of the table; select * from SDS\ G

COLUMNS_ V2 table

This table records the column field information in the hive table; associates it through CD_ID; contains the column name (COLUMN_NAME), column data type (TYPE_NAME), column number (INTEGER_IDX) select * from COLUMNS_V2\ G Note: hive determines the position of the column through the column number (INTEGER_IDX) to prevent data confusion.

PARTITIONS (partition) table

This table records the information of the partition table, including the partition value of the partition table (PART_NAME), the input and output format of the table (SD_ID), and the table to which it belongs (TBL_ID); select * from PARTITIONS

PARTITION_KEYS (partitioned key) table

This table records that the key; of the partition is associated to the table through TBL_ID; select * from PARTITION_KEYS; Note: you can see that the key of the partition is day

PARTITION_KEY_VALS (value of subtable key) table

This table records that the value; of the partitioned key is associated to the table through TBL_ID; select * from PARTITION_KEY_VALS; Note: you can value the value of key.

Tags: Information data association storage location database format different field ownership version type partition table input output purpose large thorough disorder number Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Docker Shulou Information Shulou Tech Info macOS