A classification management method of table and function metadata based on Flink data catalog

By introducing a Flink data catalog into the Hive database, fine-grained management and categorized querying of Flink table and function metadata are achieved. This solves the problems of metadata clutter and insufficient visibility, improves the security and query flexibility of the data catalog, and provides the ability to view historical versions of metadata.

CN117591611BActive Publication Date: 2026-11-27SHENZHEN YINXING INTELLIGENT DATA CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311735752.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-16
Publication Date
2026-11-27
Estimated Expiration
2043-12-16

AI Technical Summary

Technical Problem

In existing technologies, the metadata of Flink tables and functions stored in Hive databases is disorganized, making it difficult for users to clearly distinguish different types, customize metadata visibility settings, access historical versions, and promptly understand metadata changes or deletions.

Method used

By introducing a Flink data catalog, step one connects to a third-party data source, creates a Hive-type data catalog, uses Flink SQL tasks to define table and function information, performs full and incremental metadata acquisition, parses and categorizes the metadata and saves it to a storage database, provides category queries and historical version queries, and introduces an access control mechanism to customize metadata visibility settings.

Benefits of technology

It enables fine-grained management of Flink table and function metadata, improves the security and personalization of data catalog, enhances query functionality and historical tracking capabilities, and ensures the timeliness and accuracy of metadata information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117591611B_ABST
    Figure CN117591611B_ABST
Patent Text Reader

Abstract

The application discloses a kind of table and function metadata classification management method based on Flink data directory, to effectively classified management of the metadata of table and function stored in corresponding Hive library in Flink data directory;The method comprises the following steps: connecting third-party data source;Create data directory, the directory type is Hive, and one-to-one correspondence with Hive library;Create Flink SQL task, define Flink table in task, Flink function information;Run Flink SQL task, store table and function metadata to the Hive library corresponding to data directory;For the full acquisition, incremental acquisition of metadata to HIVE database;And the analysis classification of metadata, and save to storage database;Provide the classification query, historical version query of metadata.The application improves the data directory metadata classification and visibility, enhances the security and personalized management of data directory, improves the query function and enhances the data historical tracking capability, and innovatively introduces an automatic metadata change management mechanism.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of data processing and management technology, and specifically relates to a method for classifying and managing table and function metadata based on the Flink data catalog. Background Technology

[0002] In modern data processing and analysis, data engineers and analysts often need to process both streaming and batch data simultaneously. This introduces the concept of stream-batch unification, which integrates streaming and batch data into a unified platform or system. In a stream-batch unification environment, the Flink Hive Catalog becomes particularly important because it acts as a key metadata management tool, enabling Flink applications to access the metadata of tables and functions in the Hive database. With the widespread adoption of stream-batch unification, users want to be able to register the metadata of different Flink tables and Flink custom functions in the Hive database by creating a data catalog and using the Flink Hive Catalog, so that this metadata information can be managed and accessed within a unified Hive database.

[0003] However, existing technologies have certain limitations in this regard: ① The Hive database stores not only Hive table metadata and Hive custom function metadata, but also Flink table metadata and Flink function metadata registered by users through the Flink Hive Catalog. Furthermore, Flink tables have different table types depending on the data source, resulting in a disorganized and fragmented metadata structure for tables and functions stored in the Hive database. Users cannot clearly view and distinguish the metadata information of different types of tables and functions within the Hive database corresponding to the data catalog; ② Users cannot customize the visibility of the metadata information of tables and functions in the Hive database corresponding to the data catalog, nor can they delete their respective metadata; ③ Users cannot access historical versions of the metadata information of tables and functions, failing to provide a more comprehensive data perspective; ④ Users cannot promptly learn about any changes or deletions to the metadata information of tables and functions, thus hindering rapid response and appropriate action. Summary of the Invention

[0004] This invention addresses the problems existing in the prior art by proposing a classification and management method for table and function metadata based on the Flink data catalog. The first objective is to solve the problem that users cannot clearly view and distinguish metadata information for different types of tables and functions in the Hive database corresponding to the data catalog. The second objective is to solve the problem that users cannot customize the visibility of metadata information for tables and functions in the Hive database corresponding to the data catalog, nor can they delete individual metadata. The third objective is to solve the problem that users cannot access historical versions of table and function metadata information, thus failing to provide users with a more comprehensive data perspective. The fourth objective is to solve the problem that users cannot promptly learn about any changes or deletions to the metadata information of tables and functions, thereby hindering rapid response and appropriate action.

[0005] The present invention adopts the following technical solution to solve its technical problem:

[0006] A method for classifying and managing table and function metadata based on the Flink data catalog, characterized by the following steps;

[0007] Step 1: Connect to a third-party data source;

[0008] Step 2: Create a data directory. This directory type is Hive, and it corresponds one-to-one with the Hive library.

[0009] Step 3: Create a Flink SQL task and use this data directory. In the task, create SQL by the user to define Flink tables and Flink function information.

[0010] Step 4: Run the Flink SQL task to store the table and function metadata to the Hive library corresponding to the data directory;

[0011] Step 5: Perform full and incremental metadata retrieval for the Hive database;

[0012] Step Six: Parse and categorize the metadata of the Hive database;

[0013] Step 7: Save the parsed and categorized metadata to the storage database;

[0014] Step 8: Provide metadata category queries and metadata historical version queries.

[0015] Furthermore, step five involves performing full and incremental metadata retrieval from the Hive database, and the specific process is as follows:

[0016] 1) Introduce a permission control mechanism for the data directory. This mechanism not only allows for customized settings of the visibility of tables and functions in the data directory, but also grants different users and organizations permissions to add and remove their respective metadata.

[0017] 2) Metadata Acquisition: Obtain full metadata of tables and functions in the Hive database corresponding to all data directories through the Flink Hive Catalog API; obtain incremental metadata of tables and functions in the Hive database corresponding to all data directories through a custom Hive Hook program.

[0018] Furthermore, in step 5, process 2), the full metadata of tables and functions in the database corresponding to all data directories is obtained through the Flink Hive Catalog API, as detailed below:

[0019] i. Obtain the names of all Hive databases corresponding to data directories that have been created in the system;

[0020] ii. Establish a connector to the Flink Hive Catalog: The connection is established using the Hive database name and configuration file address of the data catalog;

[0021] iii. Obtaining metadata information: Once the connection is established, Flink can send requests to Hive through the Flink Hive Catalog API to obtain metadata information of tables and functions.

[0022] Furthermore, in step five, process 2), the incremental metadata of tables and functions in the Hive database corresponding to all data directories is obtained through a custom Hive Hook program, as detailed below:

[0023] i. Listen for events related to tables and functions in Hive; these events include: table creation, table deletion, function creation, and function deletion events;

[0024] ii. When a change occurs, the Hive Hook can immediately capture the change and trigger the process of metadata classification and synchronization.

[0025] Furthermore, the specific process is as follows:

[0026] The acquisition of full metadata and incremental metadata in step 5, process 2), specifically involves the following steps:

[0027] A. The full acquisition mentioned above refers to obtaining all data corresponding to the Hive database name in the current data directory based on the Flink Hive Catalog API, including all metadata of tables and functions;

[0028] B. The incremental data acquisition refers to acquiring only the newly added data since the last full data acquisition, while deleting the data that has changed.

[0029] In Flink, Catalog is an interface for managing external data sources, while Flink Hive Catalog is a specific implementation for connecting to Apache Hive. Through Flink Hive Catalog, Flink can connect to the Hive metadata store, query table and function metadata information in Hive, and allow Flink jobs to directly access and manipulate this data.

[0030] Furthermore, in step 5, process 2), the full acquisition of all metadata in stage A occurs only once, and subsequent acquisitions are incremental. The full and incremental acquisition of metadata in stages A) and B) of step 5, process 2) includes metadata for table information and metadata for function information. The metadata for table information includes the table name, column names, data types, partition information, storage format, and table join information. The metadata for function information includes the function name, function class name, function registration path in Hive, and function category.

[0031] Furthermore, step six, which involves parsing and classifying metadata in the Hive database, is as follows:

[0032] 1) When retrieving all the table's metadata, parse out the connector attribute value from the table's metadata and classify the table based on the connector attribute value;

[0033] 2) When the full metadata of a function is retrieved, the Hive storage address field information in the function metadata is parsed out. The classification is completed based on the value of the Hive storage address field. If a value exists, the function is classified as a Hive function; otherwise, the function is classified as a Flink function.

[0034] 3) When incrementally retrieving data, the `onCreateTable(CreateTableEvent tableEvent)` method is called when adding data to the table. In this method, the Map object in the `tableEvent` passed to the method is parsed out.<String,String> The `parameters` object is used to categorize tables based on their values ​​or the `flink.connector` property value. If the `parameters` object does not exist, the table is categorized as a Hive table. If it does exist, the `flink.connector` property value is retrieved from the `parameters` object, and the table is categorized based on that value. If the `flink.connector` property value cannot be retrieved, the table is categorized as a Hive table.

[0035] 4) When incrementally retrieving data, the function will be called during the addition of new data.

[0036] The `onCreateFunction(CreateFunctionEvent funcEvent)` method parses the properties of the `function` object in the `funcEvent` object passed to the method. It then determines the classification based on the value of the Hive storage address field in the `function` object. If the value exists, the function is classified as a Hive function; otherwise, it is classified as a Flink function.

[0037] Furthermore, in step seven, the parsed and categorized metadata is saved to a storage database;

[0038] The specific process is as follows:

[0039] When retrieving all metadata

[0040] ① Obtain the basic metadata information of all tables and store the data in the storage database; add an is_delete field to the basic metadata information and set the value of the is_delete field to false to indicate that the metadata is newly added data;

[0041] ② Obtain all function metadata basic information and store the data in the storage database. Add an is_delete field to the metadata basic information and set the value of the is_delete field to false to indicate that the metadata is newly added data.

[0042] Furthermore, in step seven, the parsed and categorized metadata is saved to a storage database;

[0043] The specific process is as follows:

[0044] When incrementally retrieving metadata

[0045] ① When a new table is added, the custom Hive Hook program is triggered to add the table, obtain the basic information of the table metadata, store the data in the storage database, and push a message to the creator of the data directory; and add the is_delete field to the basic information of the metadata, with the value of the is_delete field set to false to indicate that the metadata is newly added data;

[0046] ② When a new function is added, the custom Hive Hook program's method for adding the function is triggered, the basic information of the function's metadata is obtained, and the data is stored in the storage database; a message is pushed to the creator of the data directory; and an is_delete field is added to the basic information of the metadata, with the is_delete field value set to false to indicate that the metadata is newly added data;

[0047] ③ When a table is deleted, the custom Hive Hook program is triggered to delete the table, obtain the basic information of the table metadata, add the is_delete field to the basic information of the metadata, set the value of the is_delete field to true to indicate that the metadata has been deleted, retrieve the database by database name and table name, update the record, store the historical data in the storage database, and push a message to the creator of the data directory.

[0048] ④ When a function is deleted, the custom Hive Hook program is triggered to delete the function, obtain the basic information of the function's metadata, add the is_delete field to the basic information of the metadata, set the value of the is_delete field to true to indicate that the metadata has been deleted, retrieve the database by database name and function name, update the record, store the historical data in the storage database, and push a message to the creator of the data directory.

[0049] Furthermore, step eight, providing metadata category query, means querying metadata in the storage database according to category; step eight, providing metadata historical version query, means querying data in the storage database that indicates that the metadata has been deleted.

[0050] Advantages and effects of the present invention

[0051] 1. Improved Data Catalog Metadata Classification and Visibility: This invention provides a mechanism for registering and classifying metadata for tables and functions in the Flink data catalog within Hive. This mechanism enables fine-grained management of different types of tables and functions. It solves the problem in existing technologies where users cannot clearly view and distinguish different types of tables and functions. Through this invention, users can easily identify and access specific types of metadata, thereby significantly improving the precision and ease of control over metadata management.

[0052] 2. Enhanced Data Catalog Security and Personalized Management: This invention innovatively introduces a data catalog access control mechanism. This mechanism not only allows for customized settings of the visibility of metadata for tables and functions in the data catalog, but also grants different users and organizations the right to deregister their respective metadata. This feature specifically addresses the lack of flexibility in existing data catalog management technologies, significantly enhancing the security and personalized management capabilities of the data catalog. By allowing users and organizations to perform deregistration operations on different types of table and function metadata, this invention effectively reduces the risk of data catalog metadata leakage, ensuring data management compliance and data environment security.

[0053] 3. Enhanced query functionality and improved data history tracking capabilities: This invention achieves advanced query functions, such as fuzzy search and multi-condition filtering, by performing advanced classification and localized storage of metadata for tables and functions in the data catalog, and introduces the ability to view historical versions of metadata. This significantly improves the flexibility and accuracy of users' queries when conducting data analysis. Simultaneously, the ability to access historical versions of metadata provides users with a more comprehensive data perspective, enabling data analysis to not only rely on the current state but also consider the history of data changes, thereby achieving deeper and more comprehensive data insights.

[0054] 4. Automated Metadata Change Management and Notification Mechanism This invention innovatively introduces an automated metadata change management mechanism, including automated processing of metadata additions or deletions, and a corresponding notification system. This mechanism directly solves the problem of existing technologies lacking automated processing and timely notification in metadata management. Through automated change management and real-time notifications, users and administrators can promptly learn about any additions or deletions of metadata, thereby responding quickly and taking appropriate measures. Attached Figure Description

[0055] Figure 1 This is a flowchart of the table and function metadata classification and management method based on the Flink data catalog of the present invention;

[0056] Figure 2 This is a flowchart of the metadata classification and management method and the metadata acquisition method of the present invention.

[0057] Figure 3 This is a flowchart of the metadata acquisition method of the present invention: a method for acquiring all metadata.

[0058] Figure 4 This is a flowchart of the metadata acquisition method of the present invention: incremental metadata acquisition method;

[0059] Figure 5 This is a flowchart of the metadata acquisition method and metadata classification and parsing method of the present invention.

[0060] Figure 6 This is a schematic diagram of the table and function metadata classification and management platform based on the Flink data catalog of the present invention. Detailed Implementation

[0061] Design principle of the invention

[0062] 1. Design Challenges of this Invention: ① Implementation of Precise Classification Management. In the existing Flink data catalog, achieving refined classification management of different types of tables and functions is a challenge, especially when dealing with complex and ever-changing metadata. Example 1: Assume an Excel spreadsheet. The header and sheets within the spreadsheet are metadata information, while the content within the spreadsheet is data, not metadata. Example 2: Assume a two-dimensional database table. The field names, types, lengths, table names, table descriptions, database names, and database name descriptions are all metadata; while the content stored in each field of the database table is data. This metadata classification management not only needs to be precise but also adaptable to constantly changing new data environments. ② Real-time Metadata Capture and Analysis Classification: Metadata capture and analysis classification is divided into full capture and incremental capture and analysis. Full capture allows the development of a specific program to read all metadata at once, but the key challenge lies in achieving real-time monitoring, capture, analysis, and classification of metadata generated when a user submits a task. This requires accurately capturing any subtle changes in metadata and updating the metadata information in real time, which is technically challenging.

[0063] 2. Solution Approach: Addressing one of the challenges: This invention introduces a dynamic classification logic that adjusts based on real-time changes in metadata. This strategy considers the diversity and dynamism of data, achieving both accurate and flexible classification management. Addressing the second challenge: To address this difficulty, this invention innovatively develops a specific Hive Hook program. This program is specifically designed to monitor user-registered tables and functions in the Hive database. In this way, once a change occurs, the Hive Hook can immediately capture this change and trigger real-time updates and analysis of metadata. This design not only ensures the timeliness and accuracy of metadata information but also improves the overall system's responsiveness and flexibility to changes.

[0064] Through the innovative design and implementation described above, this invention effectively solves the technical challenges of real-time metadata capture, analysis, and classification, significantly improving the real-time performance and accuracy of table and function metadata management in the Flink data catalog. This solution demonstrates the innovative thinking and technical capabilities of this invention in efficiently synchronizing and performing real-time analysis and classification in metadata management.

[0065] 3. Definitions:

[0066] Flink: Flink (Apache Flink) is an open-source stream and batch processing framework for handling large-scale streams and batches of data. It is a distributed data processing engine designed for real-time streaming data processing, event-driven applications, and batch jobs.

[0067] Flink Hive Catalog: Flink Hive Catalog (also known as Hive Catalog) is a component in Apache Flink used to integrate with Apache Hive. It is used to manage and access metadata information related to Hive tables, Hive functions, and Flink tables and Flink custom functions stored in the Hive database. It also allows Flink users to easily access and manipulate the metadata information related to Hive tables, Hive functions, and Flink tables and Flink custom functions stored in the Hive database in their stream processing and batch processing applications.

[0068] Flink Hive Catalog API: The Flink Hive Catalog API is the interactive programming interface provided by Flink Hive Catalog. Through this API, developers can query metadata information of the Hive database corresponding to the data catalog within their applications, including table metadata information and function metadata information.

[0069] Flink SQL: Flink SQL is a query language and programming interface in Apache Flink used to perform SQL queries and data manipulations in Flink stream processing and batch processing applications. It allows users to query, transform, and process real-time and batch data streams using standard SQL syntax without needing in-depth knowledge of the underlying Flink programming model.

[0070] 4. This invention is a classification management method for a business platform based on the classification management of table and function metadata in the Flink data catalog. This business platform, for example... Figure 6 As shown, the system includes modules for connecting to third-party data sources, creating a data catalog, creating Flink SQL tasks, running Flink SQL tasks, obtaining metadata, classifying and parsing metadata, synchronizing and storing metadata, and querying by category and historical version. The module for connecting to third-party data sources connects to third-party data sources in the business platform and saves connection information. The module for creating a data catalog creates a Hive-type data catalog in the business platform, which corresponds one-to-one with a Hive database. The module for creating Flink SQL tasks uses the Hive-type data catalog in the business platform and creates Flink SQL tasks, defining the metadata information of tables and functions through user-defined SQL statements. The module for running Flink SQL tasks runs the Flink SQL tasks defined by the business platform in the Flink runtime environment. During execution, Flink stores the metadata of tables and functions in the Hive database corresponding to the data catalog through the Flink Hive Catalog API. Its key features are:

[0071] The metadata acquisition module is used to acquire full and incremental metadata from the Hive database in the business platform; the metadata classification and parsing module is used to parse and classify the acquired full and incremental metadata in the business platform; the metadata synchronization and storage module is used to synchronize and store the parsed and classified metadata to the local storage database in the business platform; and the classification query and historical version query module is used to perform classification queries and historical data queries on the metadata in the local storage database in the business platform.

[0072] Furthermore, the metadata acquisition module includes: a full metadata acquisition module for the Hive database and an incremental metadata acquisition module for the Hive database; the full metadata acquisition for the Hive database can only be performed once, while the incremental metadata acquisition for the Hive database is based on the full acquisition and only acquires the added data and the data that has changed after deletion.

[0073] Furthermore, the module for obtaining full metadata of the Hive database includes a module for obtaining all Hive database names, a module for establishing a connector, a module for obtaining full metadata of all tables in the Hive database, and a module for obtaining full metadata of all functions in the Hive database.

[0074] Furthermore, the incremental metadata acquisition module for the Hive database includes a related event monitoring module, an event change capture module, and a metadata classification and synchronization module. The related event monitoring module is used to monitor events such as table creation, table deletion, function creation, and function deletion. The metadata classification and synchronization module is used to parse and classify the newly added metadata while capturing it, and save the parsed and classified metadata to the local storage database.

[0075] Furthermore, the metadata classification and parsing module includes a parsing and classification submodule for fully retrieving table metadata, a parsing and classification submodule for fully retrieving function metadata, a parsing and classification submodule for incrementally retrieving table metadata, and a parsing and classification submodule for incrementally retrieving function metadata. When fully retrieving table metadata, the module parses out the connector attribute value from the table metadata and classifies the table based on the connector attribute value. When fully retrieving function metadata, the module parses out the Hive storage address field information from the function metadata and classifies the function based on the Hive storage address field value. If the value exists, the function is classified as a Hive function; otherwise, it is classified as a Flink function. When incrementally retrieving data, adding data to the table will call...

[0076] The `onCreateTable(CreateTableEvent tableEvent)` method parses the Map from the `table` object in the `tableEvent` passed to the method.<String,String> The `parameters` object is used to categorize data based on its value or the `flink.connector` property value. If the `parameters` object does not exist, the table is categorized as a Hive table. If it exists, the `flink.connector` property value is retrieved from the `parameters` object, and the table is categorized accordingly. If the `flink.connector` property value cannot be retrieved, the table is categorized as a Hive table. When incrementally fetching data, the `onCreateFunction(CreateFunctionEvent funcEvent)` method is called when adding data to a function. In this method, the properties of the `function` object in the `funcEvent` object are parsed, and the categorization is determined based on the `Hive` storage address field value in the `function` object. If the value exists, the function is categorized as a Hive function; otherwise, it is categorized as a Flink function.

[0077] Furthermore, the metadata synchronization storage module includes a full metadata acquisition synchronization module and an incremental metadata acquisition synchronization module. The full metadata acquisition synchronization module identifies metadata as newly added data. The incremental metadata acquisition synchronization module identifies metadata as newly added data when new data is added and as deleted data when data is deleted.

[0078] Furthermore, the metadata category query and historical version query module includes a category query new data module and a category query historical data module. The category query new data module displays query results according to the metadata identifier as a new data identifier and the category to which the metadata is assigned. The category query historical data module displays query results according to the metadata identifier as a deleted data identifier and the category to which the metadata is assigned.

[0079] Based on the above-mentioned inventive principles and business platform, this invention designs a classification and management method for table and function metadata based on the Flink data catalog, such as... Figure 1-5 As shown, its characteristics include the following steps;

[0080] Step 1: Connect to a third-party data source;

[0081] Step 2: Create a data directory. This directory type is Hive, and it corresponds one-to-one with the Hive library.

[0082] Supplementary Note 1

[0083] ① When the above directory is created, the system will record the creator of the data directory for notification purposes when metadata changes occur.

[0084] ② Creating a data directory requires associating it with a Hive database. The specific SQL syntax is as follows:

[0085] create catalog hive_catalog with(

[0086] 'type' = 'hive',

[0087] 'default-database'='default',

[0088] 'hive-conf-dir'=' / etc / hive / conf' );

[0090] The explanation is as follows:

[0091] `create catalog hive_catalog`: This part indicates that a catalog named `hive_catalog` is being created.

[0092] Flink Catalog of hive_catalog.

[0093] with: This is the start of a configuration statement.

[0094] 'type' = 'hive': This specifies that the type of this Catalog is Hive. This means that the Catalog to be created is a Catalog connected to Hive, allowing Flink to use data and metadata from Hive.

[0095] 'default-database' = 'default': This parameter specifies the default database. When no database is specified, Flink will look for metadata objects such as the registry and functions in the database named 'default'.

[0096] 'hive-conf-dir' = ' / etc / hive / conf': This parameter defines the Hive configuration directory, specifying the path to the Hive configuration files. This is crucial for Flink Hive Catalog to connect to and access the Hive metadata store, as it can load Hive configuration information from the specified directory to ensure Flink can correctly interact with Hive.

[0097] ③ By creating and configuring data catalogs, Flink can define data structures such as tables and functions, allowing these structured data to be directly queried, read, and written by Flink jobs just like local tables. This unified interface reduces the complexity of integration with external systems, making it easier for developers to manipulate and process data from different data sources within Flink jobs.

[0098] ④ The data catalog can also provide metadata management functions, allowing developers to register, query and manipulate metadata information of data sources in Flink, such as table structure and data location, so as to better manage and use external data.

[0099] Step 3: Create a Flink SQL task and use this data directory. In the task, define Flink tables and Flink function information using user-created SQL.

[0100] Step 4: Run the Flink SQL task to store the table and function metadata to the Hive library corresponding to the data directory;

[0101] Supplementary Note 2

[0102] ① The above "running Flink SQL task" means that the task runs in the Flink runtime environment. During the process, Flink will use the Flink Hive Catalog API to store the metadata of the tables and functions to the Hive library corresponding to the data catalog.

[0103] ② The above "defining Flink tables and Flink function information in the task" refers to the metadata information of tables or functions defined by the user through SQL. The metadata of table information includes the table name, column names, data types, partition information, storage format, and table join information; the metadata of function information includes the function name, function class name, function registration path in Hive, and function category.

[0104] Step 5: Perform full and incremental metadata retrieval for the Hive database;

[0105] Step Six: Parse and categorize the metadata of the Hive database;

[0106] Step 7: Save the parsed and categorized metadata to the storage database;

[0107] Step 8: Provide metadata category queries and metadata historical version queries.

[0108] Furthermore, step five involves performing full and incremental metadata retrieval from the Hive database, and the specific process is as follows:

[0109] 1) Introduce a permission control mechanism for the data directory. This mechanism not only allows for customized settings of the visibility of tables and functions in the data directory, but also grants different users and organizations permissions to add and remove their respective metadata.

[0110] 2) Metadata Acquisition: Obtain full metadata of tables and functions in the database corresponding to all data directories through the Flink Hive Catalog API; obtain incremental metadata of tables and functions in the database corresponding to all data directories through a custom Hive Hook program.

[0111] Furthermore, in step 5, process 2), the full metadata of tables and functions in the database corresponding to all data directories is obtained through the Flink Hive Catalog API, as detailed below:

[0112] i. Obtain the names of all Hive databases corresponding to data directories that have been created in the system;

[0113] ii. Establish a connector to the Flink Hive Catalog: The connection is established using the Hive database name and configuration file address of the data catalog;

[0114] iii. Obtaining metadata information: Once the connection is established, Flink can send requests to Hive through the Flink Hive Catalog API to obtain metadata information for tables and functions.

[0115] Furthermore, in step five, process 2), the incremental metadata of tables and functions in the database corresponding to all data directories is obtained through a custom Hive Hook program, as detailed below:

[0116] i. Listen for events related to tables and functions in the Hive Catalog; these events include: table creation, table deletion, function creation, and function deletion events;

[0117] ii. When a change occurs, the Hive Hook can immediately capture the change and trigger the process of metadata classification and synchronization.

[0118] Supplementary Note 3

[0119] ①The events that trigger the table creation, table deletion, function creation, and function deletion are as follows:

[0120] onCreateTable(CreateTableEvent tableEvent): Triggered when a table is created.

[0121] onDropTable(DropTableEvent tableEvent): Triggered when a table is deleted.

[0122] onCreateFunction(CreateFunctionEvent funcEvent): Triggered when the function is created.

[0123] onDropFunction(DropFunctionEvent funcEvent): Triggered when the function is deleted.

[0124] ②The Flink Hive Catalog is a component in Apache Flink used to integrate Apache Hive, allowing data and metadata from Hive to be used directly in Flink jobs.

[0125] ③ Through the Flink Hive Catalog, Flink can connect to the Hive metadata store and use the metadata objects related to tables and functions defined therein.

[0126] Furthermore, the specific process is as follows:

[0127] The acquisition of full metadata and incremental metadata in step 5, process 2), specifically involves the following steps:

[0128] A. The full acquisition refers to obtaining all data corresponding to the Hive database name in the current data directory based on the Flink Hive Catalog API, including all metadata of tables and functions;

[0129] B. The incremental data acquisition refers to acquiring only the newly added data since the last full data acquisition, while deleting the data that has changed.

[0130] In Flink, Catalog is an interface for managing external data sources, while Flink Hive Catalog is a specific implementation for connecting to Apache Hive. Through Flink Hive Catalog, Flink can connect to the Hive metadata store, query table and function metadata information in Hive, and allow Flink jobs to directly access and manipulate this data.

[0131] Supplementary Note 4

[0132] ① The incremental data mentioned above refers to data that has been newly added or deleted within a certain period of time; compared to full data, incremental data refers to metadata that only includes the most recently added or deleted part, and does not include the entire content of the metadata.

[0133] ②The above-mentioned full data refers to all data in the dataset, that is, including all records, information or content; in contrast to incremental data, full data covers the entire metadata content, including all historical and current metadata; full metadata is data obtained at one time, while incremental data is data obtained multiple times based on changes in metadata due to additions or deletions;

[0134] ③ Metadata includes field names, field types, lengths, table names, table descriptions, database names, and database name descriptions. If one of the field names needs to be modified, the method is to delete the entire table instead of modifying only one field. Specifically: first delete the table, then create a new table; when deleting the table, set the `is_delete` field value to `true` to indicate that the metadata has been deleted; when creating the new table, add an `is_delete` field to the basic metadata information, setting its value to `false` to indicate that the metadata is newly added data.

[0135] Furthermore, in step 5, process 2), the full acquisition of all metadata in stage A occurs only once, and subsequent acquisitions are incremental. The full and incremental acquisition of metadata in stages A) and B) of step 5, process 2) includes metadata for table information and metadata for function information. The metadata for table information includes the table name, column names, data types, partition information, storage format, and table join information. The metadata for function information includes the function name, function class name, function registration path in Hive, and function category.

[0136] Furthermore, step six, which involves parsing and classifying metadata in the Hive database, is as follows:

[0137] 1) When retrieving all the table's metadata, parse out the connector attribute value from the table's metadata and classify the table based on the connector attribute value;

[0138] 2) When the full metadata of a function is retrieved, the Hive storage address field information in the function metadata is parsed out. The classification is completed based on the value of the Hive storage address field. If a value exists, the function is classified as a Hive function; otherwise, the function is classified as a Flink function.

[0139] 3) When incrementally retrieving data, the `onCreateTable(CreateTableEvent tableEvent)` method is called when adding data to the table. In this method, the Map object in the `tableEvent` passed to the method is parsed out.<String,String> The `parameters` object is used to categorize tables based on their values ​​or the `flink.connector` property value. If the `parameters` object does not exist, the table is categorized as a Hive table. If it does exist, the `flink.connector` property value is retrieved from the `parameters` object, and the table is categorized based on that value. If the `flink.connector` property value cannot be retrieved, the table is categorized as a Hive table.

[0140] 4) When incrementally retrieving data, the function will be called during the addition of new data.

[0141] The `onCreateFunction(CreateFunctionEvent funcEvent)` method parses the properties of the `function` object in the `funcEvent` object passed to the method. It then determines the classification based on the value of the Hive storage address field in the `function` object. If the value exists, the function is classified as a Hive function; otherwise, it is classified as a Flink function.

[0142] Furthermore, in step seven, the parsed and categorized metadata is saved to a storage database;

[0143] The specific process is as follows:

[0144] When retrieving all metadata

[0145] ① Obtain the basic metadata information of all tables and store the data in the storage database; add an is_delete field to the basic metadata information and set the value of the is_delete field to false to indicate that the metadata is newly added data;

[0146] ② Obtain all function metadata basic information and store the data in the storage database. Add an is_delete field to the metadata basic information and set the value of the is_delete field to false to indicate that the metadata is newly added data.

[0147] Furthermore, in step seven, the parsed and categorized metadata is saved to a storage database;

[0148] The specific process is as follows:

[0149] When incrementally retrieving metadata

[0150] ① When a new table is added, the custom Hive Hook program is triggered to add the table, obtain the basic information of the table metadata, store the data in the storage database, and push a message to the creator of the data directory; and add the is_delete field to the basic information of the metadata, with the value of the is_delete field set to false to indicate that the metadata is newly added data;

[0151] ② When a new function is added, the custom Hive Hook program's method for adding the function is triggered, the basic information of the function's metadata is obtained, and the data is stored in the storage database; a message is pushed to the creator of the data directory; and an is_delete field is added to the basic information of the metadata, with the is_delete field value set to false to indicate that the metadata is newly added data;

[0152] ③ When a table is deleted, the custom Hive Hook program is triggered to delete the table, obtain the basic information of the table metadata, add the is_delete field to the basic information of the metadata, set the value of the is_delete field to true to indicate that the metadata has been deleted, retrieve the database by database name and table name, update the record, store the historical data in the storage database, and push a message to the creator of the data directory.

[0153] ④ When a function is deleted, the custom Hive Hook program is triggered to delete the function, obtain the basic information of the function's metadata, add the is_delete field to the basic information of the metadata, set the value of the is_delete field to true to indicate that the metadata has been deleted, retrieve the database by database name and function name, update the record, store the historical data in the storage database, and push a message to the creator of the data directory.

[0154] Furthermore, step eight, providing metadata category query, means querying metadata in the storage database according to category; step eight, providing metadata historical version query, means querying data in the storage database that indicates that the metadata has been deleted.

[0155] The above description is merely an example and illustration of the concept of the present invention. Those skilled in the art can make various modifications or additions to the specific embodiments described or use similar methods to replace them, as long as they do not deviate from the concept of the invention or exceed the scope defined in the claims, they should all fall within the protection scope of the present invention.

Claims

1. A method for classifying and managing table and function metadata based on a Flink data catalog, characterized in that: Includes the following steps; Step 1: Connect to a third-party data source; Step 2: Create a data directory. This directory type is Hive, and it corresponds one-to-one with the Hive library. Step 3: Create a FlinkSQL task and use this data directory. In the task, create SQL by the user to define Flink tables and Flink function information. Step 4: Run the FlinkSQL task to store the table and function metadata to the Hive library corresponding to the data directory; Step 5: Perform full and incremental metadata retrieval for the Hive database; Step Six: Parse and categorize the metadata of the Hive database; Step 7: Save the parsed and categorized metadata to the storage database; Step 8: Provide categorized queries for metadata and historical version queries for metadata; The specific process of step five, which involves fully and incrementally acquiring metadata from the Hive database, is as follows: 1) Introduce a permission control mechanism for the data directory. This mechanism not only allows for customized settings of the visibility of tables and functions in the data directory, but also grants different users and organizations permissions to add and remove their respective metadata. 2) Metadata Acquisition: Obtain full metadata of tables and functions in the database corresponding to all data directories through the FlinkHiveCatalogAPI; obtain incremental metadata of tables and functions in the database corresponding to all data directories through a custom HiveHook program; Step 5, process 2), involves obtaining the full metadata of tables and functions in the database corresponding to all data directories through the FlinkHiveCatalogAPI, as detailed below: i. Obtain the names of all Hive databases corresponding to data directories that have been created in the system; ii. Establish a connector to the FlinkHiveCatalog: The connection is established using the Hive database name and configuration file address of the data catalog; iii. Obtaining metadata information: Once a connection is established, Flink can send requests to Hive through the FlinkHiveCatalogAPI to obtain metadata information for tables and functions; Step 5, process 2), involves obtaining incremental metadata of tables and functions in the database corresponding to all data directories through a custom HiveHook program, as detailed below: i. Listen for events related to tables and functions in Hive; these events include: table creation, table deletion, function creation, and function deletion events; ii. When a change occurs, HiveHook can immediately capture the change and trigger the process of metadata classification and synchronization.

2. The method for classifying and managing table and function metadata based on the Flink data catalog according to claim 1, characterized in that: The specific process is as follows: The acquisition of full metadata and incremental metadata in step 5, process 2), specifically involves the following steps: A. The full acquisition mentioned above refers to obtaining all data corresponding to the Hive database name in the current data directory based on the FlinkHiveCatalogAPI, including all metadata of tables and functions; B. The incremental data acquisition refers to acquiring only the newly added data since the last full data acquisition, while deleting the data that has changed. In Flink, Catalog is an interface for managing external data sources, while FlinkHiveCatalog is a specific implementation for connecting to Apache Hive. Through FlinkHiveCatalog, Flink can connect to the Hive metadata store, query table and function metadata information in Hive, and allow Flink jobs to directly access and manipulate this data.

3. The method for classifying and managing table and function metadata based on the Flink data catalog according to claim 2, characterized in that: In step 5, process 2), the full acquisition of all metadata in stage A occurs only once, and subsequent acquisitions are incremental. The full and incremental acquisition of metadata in stages A and B of step 5, process 2) includes metadata for table information and metadata for function information. The metadata for table information includes the table name, column names, data types, partition information, storage format, and table join information. The metadata for function information includes the function name, function class name, function registration path in Hive, and function category.

4. The method for classifying and managing table and function metadata based on the Flink data catalog according to claim 1, characterized in that: The specific process of parsing and classifying metadata in the Hive database in step six is ​​as follows: 1) When retrieving all the table's metadata, parse out the connector attribute value from the table's metadata and classify the table based on the connector attribute value; 2) When the full metadata of a function is retrieved, the Hive storage address field information in the function metadata is parsed out. The classification is completed based on the value of the Hive storage address field. If a value exists, the function is classified as a Hive function; otherwise, the function is classified as a Flink function. 3) When incrementally fetching data, adding data to the table will call the `onCreateTable(CreateTableEvent tableEvent)` method. In this method, the `MapParameters` object within the `table` object passed to the method `tableEvent` is parsed. The table is then categorized based on the value of the `parameters` object or the value of its `flink.connector` property. If the `parameters` object does not exist, the table is categorized as a Hive table. If it exists, the `flink.connector` property value is retrieved from the `parameters` object, and the table is categorized based on that value. If the `flink.connector` property value cannot be retrieved, the table is categorized as a Hive table. 4) When incrementally acquiring data, the addition of a function will call the onCreateFunction(CreateFunctionEventfuncEvent) method. In this method, the properties of the function object in the method-passed object funcEvent are parsed out. The classification is determined based on the value of the Hive storage address field in the function object. If the value exists, the function is classified as a Hive function; otherwise, the function is classified as a Flink function.

5. The method for classifying and managing table and function metadata based on the Flink data catalog according to claim 1, characterized in that: Step seven involves saving the parsed and categorized metadata to a storage database. The specific process is as follows: When retrieving all metadata ① Obtain the basic metadata information of all tables and store the data in the storage database; add an is_delete field to the basic metadata information and set the value of the is_delete field to false to indicate that the metadata is newly added data; ② Obtain all function metadata basic information and store the data in the storage database. Add an is_delete field to the metadata basic information and set the is_delete field value to false to indicate that the metadata is newly added data.

6. The method for classifying and managing table and function metadata based on the Flink data catalog according to claim 1, characterized in that: Step seven involves saving the parsed and categorized metadata to a storage database. The specific process is as follows: When incrementally retrieving metadata ① When a new table is added, the custom HiveHook program's method for adding the table is triggered, the basic information of the table's metadata is obtained, the data is stored in the storage database, and a message is pushed to the creator of the data directory; In addition, an is_delete field is added to the basic metadata information. The value of the is_delete field is set to false to indicate that the metadata is newly added data. ② When a new function is added, the custom HiveHook program's method for adding the function is triggered, the basic information of the function's metadata is obtained, and the data is stored in the storage database; It also pushes a message to the creator of the data directory; and adds an is_delete field to the basic metadata information, setting the is_delete field value to false to indicate that the metadata is newly added data; ③ When a table is deleted, the custom HiveHook program is triggered to delete the table, obtain the basic information of the table metadata, add the is_delete field to the basic information of the metadata, set the value of the is_delete field to true to indicate that the metadata has been deleted, retrieve the database by database name and table name, update the record, store the historical data in the storage database, and push a message to the creator of the data directory. ④ When a function is deleted, the custom HiveHook program's method for deleting the function is triggered, the basic information of the function's metadata is obtained, an is_delete field is added to the basic information of the metadata, and the value of the is_delete field is set to true to indicate that the metadata has been deleted. The database is retrieved by database name and function name, the record is updated, the historical data is stored in the storage database, and a message is pushed to the creator of the data directory.

7. The method for classifying and managing table and function metadata based on the Flink data catalog according to claim 1, characterized in that: The provision of metadata category query in step eight refers to querying metadata by category in the storage database. The provision of metadata historical version query in step eight refers to querying data in the storage database that indicates that the metadata has been deleted.

Citation Information

Patent Citations

  • Mass data quality verification method based on Hadoop

    CN111400297A

  • Securing a Distributed File System

    US20160098573A1