Dimension table data processing method, device, electronic device and storage medium
By selecting the target data processing nodes in the data processing node cluster and forwarding the data to be associated, distributed storage and fast routing of huge dimension tables are achieved, which solves the problem that data processing nodes need to store huge dimension tables in traditional technology, reduces operation and maintenance and development costs, and avoids the waste of storage resources.
Patent Information
- Application Number
- CN202210164717.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-22
- Publication Date
- 2025-04-08
- Estimated Expiration
- 2042-02-22
AI Technical Summary
In traditional technology, a single data processing node needs to store a huge dimension table in full, resulting in high operation and maintenance costs, high development costs and serious waste of storage resources.
By obtaining the dimension table key value of the data to be associated, selecting the target data processing node from the data processing node cluster, and forwarding the data to be associated to the target data processing node, the distributed storage and fast routing of the target dimension table data is achieved.
It reduces the storage burden of a single data processing node, avoids the need for full export to high-cost storage engines, reduces development and operation and maintenance costs, and avoids the waste of storage resources.
Smart Images

Figure CN114510486B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a dimension table data processing method, device, electronic device and storage medium. Background Art
[0002] With the increasing development of Internet technology, the era of massive data has arrived. In the era of massive data, in order to observe data from multiple angles and multiple aspects, data can be stored in dimension tables.
[0003] Dimension tables can be seen as windows for users to analyze data. Dimension tables contain the characteristics of fact tables for recording facts. Some characteristics provide descriptive information, and some characteristics indicate how to summarize fact table data to provide useful information to analysts.
[0004] However, a single data processing node in traditional technology often needs to store the entire dimension table. When faced with a dimension table with a huge amount of data (i.e., a huge dimension table), due to the limited data capacity of a single data processing node, it is necessary to export the dimension table with a huge amount of data to a storage engine with high operation and maintenance costs. This undoubtedly increases development costs and operation and maintenance costs, and also causes a huge waste of storage resources. Summary of the invention
[0005] The present disclosure provides a dimension table data processing method, device, electronic device and storage medium to at least solve the problem of waste of database storage resources in related technologies. The technical solution of the present disclosure is as follows:
[0006] According to a first aspect of an embodiment of the present disclosure, a dimension table data processing method is provided, including:
[0007] Acquire the data to be associated; the data to be associated is data used to establish an association relationship with at least one dimension table data in the target dimension table; the data to be associated has a corresponding dimension table key value;
[0008] A target data processing node corresponding to the target node identifier is selected from the data processing node cluster, and the data to be associated is forwarded to the target data processing node; the dimension table data stored in each data processing node in the data processing node cluster constitutes the target dimension table; the target node identifier is a node identifier obtained by mapping the dimension table key value corresponding to the data to be associated according to a preset mapping rule;
[0009] Acquire target dimension table data queried by the target data processing node based on the data to be associated; the target dimension table data is dimension table data that matches the dimension table key value;
[0010] An association relationship between the data to be associated and the target dimension table data is established to obtain associated dimension table data corresponding to the data to be associated.
[0011] In one possible implementation, the node identifier is a routing address, and the step of selecting a target data processing node corresponding to the target node identifier from a data processing node cluster and forwarding the data to be associated to the target data processing node includes: mapping the dimension table key value corresponding to the data to be associated according to the mapping rule to determine the target routing address for the data to be associated; and sending the data to be associated to the data processing node corresponding to the target routing address.
[0012] In one possible implementation, determining a target routing address for the data to be associated based on the dimension table key value corresponding to the data to be associated includes: performing a hash operation on the dimension table key value corresponding to the data to be associated to obtain a hash code corresponding to the data to be associated; and mapping the hash code corresponding to the data to be associated to a corresponding routing address as the target routing address according to the mapping rule.
[0013] In one possible implementation, the method further includes: generating a cache instruction for the target dimension table; the cache instruction carries an identifier corresponding to the mapping rule; sending the cache instruction to each data processing node in the data processing node cluster; the cache instruction is used to instruct any of the data processing nodes to determine and store dimension table data matching a target key value in the target dimension table; the target key value is a dimension table key value corresponding to the dimension table data stored by any of the data processing nodes, and a node identifier obtained by mapping the target key value according to the mapping rule is the same as a node identifier corresponding to any of the data processing nodes.
[0014] According to a second aspect of an embodiment of the present disclosure, a dimension table data processing method is provided, including:
[0015] In response to a cache instruction for a target dimension table, determining at least one dimension table data in the target dimension table;
[0016] Dimension table data to be stored that matches a target key value is screened out from each dimension table data; the target key value is a dimension table key value corresponding to the dimension table data stored by the data processing node, and a node identifier obtained by mapping the target key value according to a preset mapping rule is the same as a node identifier corresponding to the data processing node; the data processing node is one of the data processing nodes in the data processing node cluster; the dimension table data stored by each data processing node in the data processing node cluster constitutes the target dimension table;
[0017] The dimension table data to be cached is stored in a preset storage area.
[0018] In one possible implementation, the node identifier is a routing address, and the step of screening out the dimension table data to be stored that matches the target key value from each dimension table data includes: for any dimension table data, mapping the dimension table key value corresponding to the any dimension table data to the corresponding target routing address according to the mapping rule; the target routing address is used to represent the target data processing node responsible for storing the any dimension table data; if the target routing address is the same as the routing address corresponding to the data processing node, then taking the any dimension table data as the dimension table data to be stored.
[0019] In a possible implementation, the method further includes: if the target routing address is different from the routing address corresponding to the data processing node, discarding any dimension table data.
[0020] In one possible implementation, mapping the dimension table key value corresponding to any dimension table data to the corresponding target routing address according to the mapping rule includes: performing a hash operation on the dimension table key value corresponding to any dimension table data to obtain a hash code corresponding to the any dimension table data; and mapping the hash code corresponding to any dimension table data to the corresponding routing address as the target routing address according to the mapping rule.
[0021] According to a third aspect of an embodiment of the present disclosure, there is provided a dimension table data processing device, including:
[0022] An acquisition unit is configured to acquire data to be associated; the data to be associated is data used to establish an association relationship with at least one dimension table data in a target dimension table; the data to be associated has a corresponding dimension table key value;
[0023] A selection unit is configured to select a target data processing node corresponding to a target node identifier from a data processing node cluster, and forward the data to be associated to the target data processing node; the dimension table data stored in each data processing node in the data processing node cluster constitutes the target dimension table; the target node identifier is a node identifier obtained by mapping the dimension table key value corresponding to the data to be associated according to a preset mapping rule;
[0024] A receiving unit is configured to execute acquisition of target dimension table data queried by the target data processing node based on the data to be associated; the target dimension table data is dimension table data matching the dimension table key value;
[0025] The associating unit is configured to establish an associative relationship between the data to be associated and the target dimension table data, and obtain associated dimension table data corresponding to the data to be associated.
[0026] In one possible implementation, the node identifier is a routing address, and the selection unit is specifically configured to perform mapping processing on the dimension table key value corresponding to the data to be associated according to the mapping rule, determine the target routing address for the data to be associated; and send the data to be associated to a data processing node corresponding to the target routing address.
[0027] In one possible implementation, the selection unit is specifically configured to perform a hash operation on the dimension table key value corresponding to the data to be associated to obtain a hash code corresponding to the data to be associated; and map the hash code corresponding to the data to be associated to a corresponding routing address according to the mapping rule as the target routing address.
[0028] In one possible implementation, the device is also configured to execute and generate a cache instruction for the target dimension table; the cache instruction carries an identifier corresponding to the mapping rule; the cache instruction is sent to each data processing node in the data processing node cluster; the cache instruction is used to instruct any of the data processing nodes to determine and store dimension table data matching a target key value in the target dimension table; the target key value is a dimension table key value corresponding to the dimension table data that any of the data processing nodes is responsible for storing, and a node identifier obtained by mapping the target key value according to the mapping rule is the same as a node identifier corresponding to any of the data processing nodes.
[0029] According to a fourth aspect of an embodiment of the present disclosure, a dimension table data processing device is provided, comprising:
[0030] a response unit, configured to execute, in response to a cache instruction for a target dimension table, determining at least one dimension table data in the target dimension table;
[0031] A screening unit is configured to screen out dimension table data to be stored that matches a target key value from each dimension table data; the target key value is a dimension table key value corresponding to the dimension table data that the data processing node is responsible for storing, and a node identifier obtained by mapping the target key value according to a preset mapping rule is the same as a node identifier corresponding to the data processing node; the data processing node is one of the data processing nodes in the data processing node cluster; the dimension table data that each data processing node in the data processing node cluster is responsible for storing constitutes the target dimension table;
[0032] The storage unit is configured to store the dimension table data to be cached in a preset storage area.
[0033] In one possible implementation, the node identifier is a routing address, and the screening unit is specifically configured to execute, for any of the dimension table data, mapping the dimension table key value corresponding to the any of the dimension table data to the corresponding target routing address according to the mapping rule; the target routing address is used to represent the target data processing node responsible for storing the any of the dimension table data; if the target routing address is the same as the routing address corresponding to the data processing node, then the any of the dimension table data is used as the dimension table data to be stored.
[0034] In a possible implementation, the dimension table data processing device is configured to discard any dimension table data if the target routing address is different from the routing address corresponding to the data processing node.
[0035] In one possible implementation, the screening unit is specifically configured to perform a hash operation on the dimension table key value corresponding to any dimension table data to obtain a hash code corresponding to any dimension table data; and according to the mapping rule, map the hash code corresponding to any dimension table data to a corresponding routing address as the target routing address.
[0036] According to a fifth aspect of an embodiment of the present disclosure, an electronic device is provided, comprising a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the dimension table data processing method as described in the first aspect or any possible implementation of the first aspect, and / or the dimension table data processing method as described in the second aspect or any possible implementation of the second aspect is implemented.
[0037] According to a sixth aspect of an embodiment of the present disclosure, a storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the dimension table data processing method described in the first aspect or any possible implementation of the first aspect is implemented, and / or the dimension table data processing method described in the second aspect or any possible implementation of the second aspect is implemented.
[0038] According to a seventh aspect of an embodiment of the present disclosure, a computer program product is provided, the program product comprising a computer program, the computer program being stored in a readable storage medium, at least one processor of a device reading and executing the computer program from the readable storage medium, so that the device executes the dimension table data processing method described in the first aspect or any possible implementation of the first aspect, and / or the dimension table data processing method described in the second aspect or any possible implementation of the second aspect.
[0039] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects: by acquiring data to be associated that needs to establish an association relationship with at least one dimension table data in a target dimension table, selecting a target data processing node corresponding to the dimension table key value corresponding to the data to be associated from a data processing node cluster, and forwarding the data to be associated to the target data processing node; wherein the dimension table data stored by each data processing node in the data processing node cluster constitutes the target dimension table; acquiring target dimension table data matching the dimension table key value returned by the target data processing node in response to the data to be associated, and establishing an association relationship between the data to be associated and the target dimension table data, so as to obtain the associated dimension table data corresponding to the data to be associated; thereby achieving the goal of distributing and storing a huge amount of target dimension tables in the data processing nodes. The data to be associated is routed to each data processing node in the processing node cluster, and the dimension table key value corresponding to the data to be associated is used to accurately route the data to be associated to the target data processing node storing the dimension table associated with the data to be associated, so that the target dimension table data used to associate with the data to be associated can be quickly and accurately obtained, and then the associated dimension table data corresponding to each data to be associated can be accurately obtained; at the same time, a single data processing node does not need to store the target dimension table with a huge amount of data in full, which also removes the restriction on the amount of data of the target dimension table (such as HIVE dimension table) in the dimension table association process, and does not need to export the target dimension table in full to a storage engine with high operation and maintenance costs, thereby reducing development costs and operation and maintenance costs, and avoiding a huge waste of storage resources as much as possible.
[0040] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.
[0042] Figure 1 The diagram is an application environment diagram of a dimension table data processing method according to an exemplary embodiment.
[0043] Figure 2 The figure is a flowchart of a dimension table data processing method according to an exemplary embodiment.
[0044] Figure 3 The figure is a flowchart of another dimension table data processing method according to an exemplary embodiment.
[0045] Figure 4 The figure is a flowchart of a dimension table data processing method according to another exemplary embodiment.
[0046] Figure 5 The figure is a flowchart of another dimension table data processing method according to another exemplary embodiment.
[0047] Figure 6 The figure is a block diagram of a device for processing dimension table data according to an exemplary embodiment.
[0048] Figure 7 It is a block diagram of another device for processing dimension table data according to an exemplary embodiment.
[0049] Figure 8 It is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION
[0050] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
[0051] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0052] It should also be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display, data for analysis, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties.
[0053] The dimension table data processing method provided in the present disclosure can be applied to Figure 1In the application environment shown. Among them, the electronic device 102 communicates with the data processing node cluster 104 through the network. The electronic device 102 obtains the data to be associated; the data to be associated is data that needs to establish an association relationship with at least one dimension table data in the target dimension table; the data to be associated has a corresponding dimension table key value; the electronic device 102 selects the target data processing node corresponding to the dimension table key value from the data processing node cluster 104, and forwards the data to be associated to the target data processing node; the dimension table data stored by each data processing node in the data processing node cluster 104 constitutes the target dimension table; the electronic device 102 obtains the target dimension table data returned by the target data processing node in response to the data to be associated; the target dimension table data is the dimension table data that matches the dimension table key value; the electronic device 102 establishes an association relationship between the data to be associated and the target dimension table data, and obtains the associated dimension table data corresponding to the data to be associated. Among them, the electronic device 102 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices, and the Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car devices, etc. The portable wearable device may be a smart watch, a smart bracelet, a head-mounted device, etc. The data processing node 104 may be implemented by a server cluster consisting of multiple servers.
[0054] Figure 2 is a flowchart of a dimension table data processing method according to an exemplary embodiment. Figure 2 As shown, this method is used to Figure 1 The electronic device includes the following steps.
[0055] In step S210, the data to be associated is obtained.
[0056] The data to be associated is data used to establish an association relationship with at least one dimension table data in the target dimension table. The data to be associated has at least one corresponding dimension table key value.
[0057] For example, the data to be associated may be detailed data generated by executing business operations through the server and / or client, and the original detailed data may be a data record corresponding to a certain web browsing behavior of a user account, such as the specific web page corresponding to the web browsing behavior, the web browsing time corresponding to the web browsing behavior, the time when the web browsing behavior occurred, the user corresponding to the web browsing behavior, the region where the user corresponding to the web browsing behavior is located, etc.
[0058] The dimension table key value may refer to a database query key value used to query dimension table data that has an association relationship with the data to be associated.
[0059] The dimension table may record descriptive information of the data to be associated in different dimensions. For example, when the data to be associated is a web browsing data record of a user account, the descriptive information of the data to be associated in different dimensions may refer to descriptive information of the web browsing data record in different dimensions (such as time dimension, region dimension, user dimension, etc.).
[0060] The dimension table data may refer to data recorded in the target dimension table and having corresponding dimension attributes.
[0061] In a specific implementation, the electronic device may receive detailed data generated by executing business operations through the server and / or client, and use the detailed data as data to be associated, for subsequently determining at least one dimension table data that needs to establish an association relationship in the target dimension table.
[0062] In step S220, a target data processing node corresponding to the target node identifier is selected from the data processing node cluster, and the data to be associated is forwarded to the target data processing node.
[0063] The target node identifier is a node identifier obtained by mapping the dimension table key value corresponding to the data to be associated according to a preset mapping rule. In practical applications, the node identifier may be a routing address of a data processing node.
[0064] The data processing node cluster may refer to a cluster composed of multiple data processing nodes. In practical applications, the dimension table data stored in each data processing node in the data processing node cluster constitutes a target dimension table.
[0065] The data processing node is used to receive input data and query dimension data associated with the input data. To facilitate understanding by those skilled in the art, the data processing node can also be named as a dimension table association operator.
[0066] In a specific implementation, the electronic device can extract the dimension table key value (i.e., the association key value) corresponding to the data to be associated, and the electronic device can obtain the key identification information carried in the data to be associated, and use the key identification information as the dimension table key value corresponding to the data to be associated; for example, if the dimension table key value of the user dimension table is the user number, the electronic device obtains the user number from the data to be associated, and determines the dimension table key value corresponding to the data to be associated.
[0067] In actual applications, key identification information may be, but is not limited to, time identification information, region identification information, and user identification information; dimension table key values may be, but are not limited to, time dimension table key values, region dimension table key values, and user dimension table key values.
[0068] The electronic device uses the dimension table key value to select a target data processing node corresponding to the dimension table key value in the data processing node cluster. The target data processing node caches a dimension table that has a matching relationship with the dimension table key value. The electronic device sends the data to be associated to the target data processing node.
[0069] Among them, the electronic device performs a hash operation (HASH) on the dimension table key value corresponding to the data to be associated, and obtains the corresponding hash operation result; the electronic device maps the hash operation result to a routing address pointing to the target data processing node according to a preset mapping rule. The electronic device sends the data to be associated to the data processing node corresponding to the routing address according to the routing address. In practical applications, the mapping mechanism used to map the dimension table key value of the data to be associated to the routing address can be named a shuffle strategy.
[0070] It should be noted that a person skilled in the art may set a mapping indication identifier for the data to be associated before associating the data with a dimension table, thereby using the mapping indication identifier to instruct the electronic device to adopt the above-mentioned mapping mechanism to map the dimension table key value of the data to be associated to the corresponding routing address.
[0071] In practical applications, a syntax that complies with the SQL standard and is used to instruct the electronic device to execute a shuffle strategy (e.g., Query Hint) can be used. The Query Hint can instruct the electronic device to add a Hash Shuffle operation before associating the dimension table of the data to be associated, that is, to instruct the electronic device to perform a hash operation (HASH) on the dimension table key value corresponding to the data to be associated, obtain the corresponding hash operation result, and map the hash operation result to the corresponding routing address according to the preset mapping rule.
[0072] In actual applications, a comment for instructing the electronic device to perform a hash shuffle operation on the associated data may be inserted into the code for controlling the electronic device to perform dimension table association on the associated data, such as: " / *+PARTITIONED_JOIN* / "; in this way, when the electronic device reads the comment " / *+PARTITIONED_JOIN* / " in the code, the electronic device performs a hash operation (HASH) on the dimension table key value corresponding to the data to be associated, obtains a corresponding hash operation result, and maps the hash operation result to a corresponding routing address according to a preset mapping rule.
[0073] In step S230, the target dimension table data queried by the target data processing node based on the data to be associated is obtained; the target dimension table data is the dimension table data that matches the dimension table key value;
[0074] In a specific implementation, the target data processing node receives the data to be associated, and can query the database for dimension table data that has a mapping relationship (or matching relationship) with the associated key value corresponding to the data to be associated, i.e., the target dimension table data. The target data processing node can return the target dimension table data to the electronic device.
[0075] In step S240, an association relationship between the data to be associated and the target dimension table data is established to obtain the associated dimension table data corresponding to the data to be associated.
[0076] In a specific implementation, the electronic device can establish an association relationship between the data to be associated and the target dimension table based on determining the target dimension table whose dimension table key value matches the data to be associated, thereby obtaining the associated dimension table data corresponding to the data to be associated.
[0077] The electronic device can output the data to be associated and the associated dimension table data with established association relationships to the user terminal where the operating user account is located, so that the operating user account can implement different business operations by analyzing the descriptive information of the data to be associated in different dimensions, for example, using the above-mentioned descriptive information to implement content recommendations for the user account.
[0078] In the above-mentioned dimension table data processing method, by obtaining the data to be associated that needs to establish an association relationship with at least one dimension table data in the target dimension table, a target data processing node corresponding to the dimension table key value corresponding to the data to be associated is selected from the data processing node cluster, and the data to be associated is forwarded to the target data processing node; wherein the dimension table data stored by each data processing node in the data processing node cluster constitutes the target dimension table; the target dimension table data matching the dimension table key value returned by the target data processing node in response to the data to be associated is obtained, and an association relationship between the data to be associated and the target dimension table data is established to obtain the associated dimension table data corresponding to the data to be associated; thereby, the target dimension table with a huge amount of data can be distributed and stored in the data processing node cluster. In each data processing node, the dimension table key value corresponding to the data to be associated is used to accurately route the data to be associated to the target data processing node storing the dimension table associated with the data to be associated, so that the target dimension table data used to associate with the data to be associated can be quickly and accurately obtained, and then the associated dimension table data corresponding to each data to be associated can be accurately obtained; at the same time, a single data processing node does not need to store the target dimension table with a huge amount of data in full, which also removes the restriction on the amount of data of the target dimension table (such as HIVE dimension table) in the dimension table association process, and does not need to export the target dimension table in full to a storage engine with high operation and maintenance costs, thereby reducing development costs and operation and maintenance costs, and avoiding a huge waste of storage resources as much as possible.
[0079] In an exemplary embodiment, a target data processing node corresponding to a target node identifier is selected from a data processing node cluster, and the data to be associated is forwarded to the target data processing node, including: determining a target routing address for the data to be associated based on a dimension table key value corresponding to the data to be associated; and sending the data to be associated to the data processing node corresponding to the target routing address.
[0080] In a specific implementation, the electronic device selects a target data processing node corresponding to the dimension table key value from the data processing node cluster and forwards the data to be associated to the target data processing node. The electronic device can determine the target routing address for the data to be associated based on the dimension table key value corresponding to the data to be associated.
[0081] Specifically, the electronic device may convert at least one dimension table key value corresponding to the data to be associated into a hash code of a preset length; the electronic device maps the hash code of the preset length into a routing address according to a mapping rule as a target routing address for the data to be associated. The electronic device sends the data to be associated to a data processing node corresponding to the target routing address.
[0082] The technical solution of this embodiment sends the data to be associated to the data processing node pointed to by the target routing address determined based on the dimension table key value corresponding to the data to be associated, thereby accurately routing the data to be associated to the target data processing node storing the dimension table associated with the data to be associated, thereby quickly and accurately acquiring the target dimension table data for associating with the data to be associated.
[0083] In an exemplary embodiment, a target routing address for the data to be associated is determined based on the dimension table key value corresponding to the data to be associated, including: performing a hash operation on the dimension table key value corresponding to the data to be associated to obtain a hash code corresponding to the data to be associated; and mapping the hash code corresponding to the data to be associated to a corresponding routing address as the target routing address according to a preset mapping rule.
[0084] In a specific implementation, the electronic device determines a target routing address for the data to be associated based on the dimension table key value corresponding to the data to be associated; wherein the electronic device may perform a hash operation on the dimension table key value corresponding to the data to be associated to obtain a hash code corresponding to the dimension table key value, and map the hash code corresponding to the dimension table key value to a corresponding routing address according to a preset mapping rule as the target routing address for the data to be associated.
[0085] The technical solution of this embodiment performs a hash operation on the dimension table key value corresponding to the data to be associated to obtain a hash code corresponding to the data to be associated; according to a preset mapping rule, the hash code corresponding to the data to be associated is mapped to a corresponding routing address as a target routing address, thereby effectively determining the target routing address corresponding to the dimension table key value corresponding to the data to be associated, thereby facilitating accurate routing of the data to be associated to a target data processing node storing the dimension data associated with the data to be associated.
[0086] In an exemplary embodiment, a cache instruction is generated for a target dimension table; the cache instruction carries an identifier corresponding to a mapping rule; the cache instruction is sent to each data processing node in a data processing node cluster; the cache instruction is used to instruct any data processing node to determine and store dimension table data matching a target key value in the target dimension table; the target key value is a dimension table key value corresponding to the dimension table data stored by any data processing node, and a node identifier obtained by mapping the target key value according to the mapping rule is the same as a node identifier corresponding to any data processing node.
[0087] In a specific implementation, the electronic device can generate a cache instruction for the target dimension table; the cache instruction carries an identifier corresponding to the mapping rule; the electronic device sends the cache instruction to each data processing node in the data processing node cluster to instruct any data processing node in the data processing node cluster to determine and store the dimension table data that the any data processing node is responsible for storing in the target dimension table.
[0088] Any data processing node receives a cache instruction for a target dimension table, and any data processing node scans the target dimension table to determine the dimension table key value corresponding to at least one dimension table data in the target dimension table. The data processing node maps the dimension table key value corresponding to any dimension table data according to the mapping rule to obtain a node identifier; the data processing node determines whether the node identifier is the same as the node identifier corresponding to the data processing node; if the node identifier is the same as the node identifier corresponding to the data processing node, the dimension table data is used as the dimension table data that the data processing node is responsible for storing.
[0089] If the node identifier is different from the node identifier corresponding to the data processing node, the data processing node discards any dimension table data, thereby filtering out the dimension table data to be stored that matches the target key value from each dimension table data.
[0090] The technical solution of this embodiment, by sending a cache instruction for the target dimension table carrying an identifier corresponding to the mapping rule to the data processing node, can ensure that the mapping rule (shuffling strategy) adopted by the data processing node to map the dimension table key value corresponding to any dimension table data to the node identifier is the same as the mapping mechanism (shuffling strategy) adopted by the electronic device to map the dimension table key value of the data to be associated to the node identifier during the distributed caching of the target dimension table by the data processing node, thereby ensuring that the electronic device can accurately send the data to be associated to the target data processing node that caches the dimension table data that has an association relationship with the data to be associated, so as to effectively perform dimension table association processing on the data to be associated.
[0091] Figure 3 is a flowchart of another dimension table data processing method according to an exemplary embodiment. Figure 3 As shown, this method is used to Figure 1 In the electronic device, the following steps are included.
[0092] In step S310, the data to be associated is obtained; the data to be associated is data that needs to establish an association relationship with at least one dimension table data in the target dimension table; the data to be associated has a corresponding dimension table key value.
[0093] In step S320, a hash operation is performed on the dimension table key value corresponding to the data to be associated, so as to obtain a hash code corresponding to the data to be associated.
[0094] In step S330, according to a preset mapping rule, the hash code corresponding to the data to be associated is mapped to a corresponding routing address as the target routing address.
[0095] In step S340, the data to be associated is sent to a data processing node corresponding to the target routing address.
[0096] In step S350, target dimension table data returned by the target data processing node corresponding to the target routing address in response to the data to be associated is obtained; the target dimension table data is dimension table data matching the dimension table key value.
[0097] In step S360, an association relationship between the data to be associated and the target dimension table data is established to obtain associated dimension table data corresponding to the data to be associated.
[0098] It should be noted that the specific limitations of the above steps can refer to the specific limitations of a dimension table data processing method mentioned above, which will not be repeated here.
[0099] In the above-mentioned dimension table data processing method, by distributing and storing the target dimension table with a huge amount of data in each data processing node in the data processing node cluster, and using the dimension table key value corresponding to the data to be associated to accurately route the data to be associated to the target data processing node storing the dimension table associated with the data to be associated, it is possible to quickly and accurately obtain the target dimension table data for associating with the data to be associated, and then accurately obtain the associated dimension table data corresponding to each data to be associated.
[0100] Figure 4 is a flowchart of a dimension table data processing method according to another exemplary embodiment. Figure 4 As shown, this method is used to Figure 1 In one of the data processing nodes in the process, the following steps are included.
[0101] In step S410, in response to a cache instruction for a target dimension table, at least one dimension table data in the target dimension table is determined.
[0102] In a specific implementation, in response to a cache instruction for a target dimension table, the data processing node receives the target dimension table and scans the target dimension table to determine a dimension table key value corresponding to at least one dimension table data in the target dimension table.
[0103] In step S420 , dimension table data to be stored that matches the target key value is screened out from each dimension table data.
[0104] The node identifier obtained by mapping the target key value according to the preset mapping rule is the same as the node identifier corresponding to the data processing node.
[0105] The target key value is a dimension table key value corresponding to the dimension table data stored by the data processing node.
[0106] In a specific implementation, each time a data processing node scans a dimension table data, the data processing node determines whether the dimension table data is the dimension table data that the data processing node is responsible for storing; if the dimension table data is the dimension table data that the data processing node is responsible for storing, the electronic device uses the dimension table data as the dimension table data to be stored.
[0107] Specifically, for any dimension table data, the data processing node maps the dimension table key value corresponding to any dimension table data to a target routing address, which is used to represent the target data processing node responsible for storing any dimension table data.
[0108] The data processing node determines whether the target routing address is the same as the routing address corresponding to the data processing node itself; if the target routing address is the same as the routing address corresponding to the data processing node, any dimension table data is used as the dimension table data to be stored; if the target routing address is not the same as the routing address corresponding to the data processing node, any dimension table data is discarded, thereby filtering out the dimension table data to be stored that matches the target key value from each dimension table data.
[0109] It should be noted that the mapping mechanism (shuffling strategy) used by the data processing node to map the dimension table key value corresponding to any dimension table data to the target routing address is the same as the mapping mechanism (shuffling strategy) used by the electronic device in the above text to map the dimension table key value of the data to be associated to the routing address, that is, the shuffling mechanism used by the data processing node to filter the dimension table corresponds to the shuffling mechanism used by the electronic device for the data to be associated.
[0110] In step S430 , the dimension table data to be cached is stored in a preset storage area.
[0111] In a specific implementation, the data processing node stores the dimension table data to be cached in a target cache area in the data processing node to cache the dimension table data to be cached.
[0112] In the above-mentioned dimension table data processing method, by responding to the cache instruction of the target dimension table, at least one dimension table data in the target dimension table is determined; the dimension table data to be stored that matches the target key value is screened out from each dimension table data; the target key value is the dimension table key value corresponding to the dimension table data that the data processing node is responsible for storing; and the dimension table data to be cached is stored in a preset storage area. In this way, the target dimension table with a huge amount of data can be distributed and stored in each data processing node in the data processing node cluster, and the dimension table key value corresponding to the data to be associated can be used to accurately route the data to be associated to the target data processing node storing the dimension table associated with the data to be associated, so that the target dimension table data used to associate with the data to be associated can be quickly and accurately obtained, and then the associated dimension table data corresponding to each data to be associated can be accurately obtained; at the same time, a single data processing node does not need to store the target dimension table with a huge amount of data in full, which also removes the restriction on the data amount of the target dimension table (such as the HIVE dimension table) in the dimension table association process, and does not need to export the target dimension table in full to a storage engine with high operation and maintenance costs, thereby reducing development costs and operation and maintenance costs, and avoiding a huge waste of storage resources as much as possible.
[0113] In an exemplary embodiment, a dimension table key value corresponding to any dimension table data is mapped to a target routing address, including: performing a hash operation on the dimension table key value corresponding to any dimension table data to obtain a hash code corresponding to any dimension table data; and mapping the hash code corresponding to any dimension table data to a corresponding routing address as the target routing address according to a mapping rule.
[0114] In a specific implementation, when a data processing node is mapping a dimension table key value corresponding to any dimension table data to a target routing address, the data processing node may perform a hash operation on the dimension table key value corresponding to any dimension table data to obtain a hash code corresponding to any dimension table data; the data processing node maps the hash code corresponding to any dimension table data to a corresponding routing address as the target routing address according to the mapping rules.
[0115] It should be noted that the mapping rule used by the data processing node to map the hash code corresponding to any dimension table data to the corresponding routing address is the same as the mapping rule used by the electronic device to map the hash code corresponding to the data to be associated to the corresponding routing address in the above text; in other words, the shuffling mechanism used by the data processing node to filter the dimension table corresponds to the shuffling mechanism used by the electronic device to treat the associated data. In practical applications, a shuffling strategy for informing the dimension table connector of the input data can be introduced, so that the real-time computing engine side informs the dimension table connector of the shuffling strategy of the dimension table associated input data, and the dimension table connector knows which key values need to be cached.
[0116] The technical solution of this embodiment can effectively determine the data processing node responsible for storing any dimension table data, thereby facilitating the data processing node to determine whether it is necessary to cache any dimension table data, thereby realizing a filtering mechanism for the target dimension table, and effectively screening out the dimension table data that each data processing node is responsible for caching in the target dimension table.
[0117] Figure 5 is a flowchart of another dimension table data processing method according to another exemplary embodiment. Figure 5 As shown, this method is used to Figure 1 The data processing node in the process includes the following steps.
[0118] In step S510, in response to a cache instruction for a target dimension table, at least one dimension table data in the target dimension table is determined.
[0119] In step S520, for any dimension table data, a hash operation is performed on the dimension table key value corresponding to the any dimension table data to obtain a hash code corresponding to the any dimension table data.
[0120] In step S530, according to the mapping rule, the hash code corresponding to any dimension table data is mapped to a corresponding routing address as a storage routing address; the storage routing address is used to represent the target data processing node responsible for storing any dimension table data.
[0121] In step S540, if the storage routing address is the same as the routing address corresponding to the data processing node, any dimension table data is used as the dimension table data to be stored.
[0122] In step S550, the dimension table data to be cached is stored in a preset storage area.
[0123] It should be noted that the specific limitations of the above steps can refer to the specific limitations of a dimension table data processing method mentioned above, which will not be repeated here.
[0124] In the above-mentioned dimension table data processing method, since the mapping rules used by the data processing node to filter the dimension table correspond to the mapping rules used by the electronic device before associating the dimension table with the data to be associated, a single data processing node does not need to store the target dimension table with a huge amount of data in full. This also removes the restriction on the amount of data of the target dimension table (such as the HIVE dimension table) during the dimension table association process, and there is no need to export the target dimension table in full to a storage engine with high operation and maintenance costs, thereby reducing development costs and operation and maintenance costs, avoiding a huge waste of storage resources as much as possible, realizing distributed storage of the target dimension table, and being able to quickly find dimension table data that has an association relationship with the data to be associated in the data processing node cluster in the future.
[0125] It should be understood that although Figure 2 , Figure 3 , Figure 4 and Figure 5 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2 , Figure 3 , Figure 4 and Figure 5 At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.
[0126] It can be understood that the same / similar parts between the various embodiments of the above method in this specification can refer to each other, and each embodiment focuses on the differences from other embodiments. For related points, please refer to the description of other method embodiments.
[0127] Figure 6 FIG. 1 is a block diagram of a dimension table data processing device according to an exemplary embodiment. Figure 6 , the device comprises:
[0128] The acquisition unit 610 is configured to acquire data to be associated; the data to be associated is data that needs to establish an association relationship with at least one dimension table data in the target dimension table; the data to be associated has a corresponding dimension table key value;
[0129] The selection unit 620 is configured to select a target data processing node corresponding to the dimension table key value from the data processing node cluster, and forward the data to be associated to the target data processing node; the dimension table data stored in each data processing node in the data processing node cluster constitutes the target dimension table;
[0130] The receiving unit 630 is configured to execute acquisition of target dimension table data returned by the target data processing node in response to the data to be associated; the target dimension table data is dimension table data matching the dimension table key value;
[0131] The associating unit 640 is configured to establish an associative relationship between the data to be associated and the target dimension table data, and obtain associated dimension table data corresponding to the data to be associated.
[0132] In an exemplary embodiment, the node identifier is a routing address, and the selection unit 620 is specifically configured to perform mapping processing on the dimension table key value corresponding to the data to be associated according to the mapping rule, determine the target routing address for the data to be associated; and send the data to be associated to the data processing node corresponding to the target routing address.
[0133] In an exemplary embodiment, the selection unit 620 is specifically configured to perform a hash operation on the dimension table key value corresponding to the data to be associated to obtain a hash code corresponding to the data to be associated; and map the hash code corresponding to the data to be associated to a corresponding routing address according to the mapping rule as the target routing address.
[0134] Figure 7 FIG. 1 is a block diagram of another dimension table data processing device according to an exemplary embodiment. Figure 7 , the device comprises:
[0135] A response unit 710 is configured to execute a response to a cache instruction for a target dimension table and determine at least one dimension table data in the target dimension table;
[0136] A screening unit 720 is configured to screen out dimension table data to be stored that matches a target key value from each dimension table data; the target key value is a dimension table key value corresponding to the dimension table data that the data processing node is responsible for storing;
[0137] The storage unit 730 is configured to store the dimension table data to be cached in a preset storage area.
[0138] In one possible implementation, the node identifier is a routing address, and the screening unit 720 is specifically configured to execute, for any of the dimension table data, mapping the dimension table key value corresponding to the any of the dimension table data to the corresponding target routing address according to the mapping rule; the target routing address is used to represent the target data processing node responsible for storing the any of the dimension table data; if the target routing address is the same as the routing address corresponding to the data processing node, then the any of the dimension table data is used as the dimension table data to be stored.
[0139] In a possible implementation, the dimension table data processing device is configured to discard any dimension table data if the target routing address is different from the routing address corresponding to the data processing node.
[0140] In one possible implementation, the screening unit 720 is specifically configured to perform a hash operation on the dimension table key value corresponding to any dimension table data to obtain a hash code corresponding to any dimension table data; and map the hash code corresponding to any dimension table data to a corresponding routing address as the target routing address according to the mapping rule.
[0141] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0142] Figure 8 8 is a block diagram of an electronic device 800 for executing the above-mentioned dimension table data processing method according to an exemplary embodiment. For example, the electronic device 800 may be a server. Figure 8 , the electronic device 800 includes a processing component 820, which further includes one or more processors, and a memory resource represented by a memory 822 for storing instructions executable by the processing component 820, such as an application. The application stored in the memory 822 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 820 is configured to execute the instructions to perform the above method.
[0143] The electronic device 800 may further include a power supply component 824 configured to perform power management of the electronic device 800, a wired or wireless network interface 826 configured to connect the electronic device 800 to a network, and an input / output (I / O) interface 828. The electronic device 800 may operate based on an operating system stored in the memory 822, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, or the like.
[0144] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory 822 including instructions, and the above instructions can be executed by a processor of the electronic device 800 to perform the above method. The storage medium can be a computer-readable storage medium, for example, the computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0145] In an exemplary embodiment, a computer program product is further provided. The computer program product includes instructions. The instructions can be executed by a processor of the electronic device 800 to complete the above method.
[0146] It should be noted that the above-mentioned devices, electronic devices, computer-readable storage media, computer program products, etc. may also include other implementation methods according to the description of the method embodiments. The specific implementation methods can refer to the description of the relevant method embodiments, which will not be described one by one here.
[0147] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.
[0148] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A dimension table data processing method, characterized in that: include: Get the data to be associated; The data to be associated is data used to establish an association relationship with at least one dimension table data in the target dimension table; The data to be associated has a corresponding dimension table key value; Selecting a target data processing node corresponding to the target node identifier from the data processing node cluster, and forwarding the data to be associated to the target data processing node; the dimension table data stored in each data processing node in the data processing node cluster constitutes the target dimension table; The target node identifier is a node identifier obtained by mapping the dimension table key value corresponding to the data to be associated according to a preset mapping rule; Acquire target dimension table data queried by the target data processing node based on the data to be associated; The target dimension table data is dimension table data that matches the dimension table key value; Establishing an association relationship between the data to be associated and the target dimension table data, and obtaining the associated dimension table data corresponding to the data to be associated; The node identifier is a routing address, and the step of selecting a target data processing node corresponding to the target node identifier from the data processing node cluster and forwarding the data to be associated to the target data processing node includes: Mapping the dimension table key values corresponding to the data to be associated according to the mapping rules to determine the target routing address for the data to be associated; The data to be associated is sent to a data processing node corresponding to the target routing address.
2. The dimension table data processing method according to claim 1, characterized in that: The determining, according to the dimension table key value corresponding to the data to be associated, a target routing address for the data to be associated, includes: Performing a hash operation on the dimension table key value corresponding to the data to be associated, to obtain a hash code corresponding to the data to be associated; According to the mapping rule, the hash code corresponding to the data to be associated is mapped to the corresponding routing address as the target routing address.
3. The dimension table data processing method according to any one of claims 1 to 2, characterized in that: The method further comprises: Generate a cache instruction for the target dimension table; the cache instruction carries an identifier corresponding to the mapping rule; The cache instruction is sent to each data processing node in the data processing node cluster; the cache instruction is used to instruct any of the data processing nodes to determine and store dimension table data matching the target key value in the target dimension table; the target key value is the dimension table key value corresponding to the dimension table data stored by any of the data processing nodes, and the node identifier obtained by mapping the target key value according to the mapping rule is the same as the node identifier corresponding to any of the data processing nodes.
4. A dimension table data processing method, the method is applied to a data processing node, characterized in that: include: In response to a cache instruction for a target dimension table, determining at least one dimension table data in the target dimension table; Dimension table data to be stored that matches a target key value is screened out from each dimension table data; the target key value is a dimension table key value corresponding to the dimension table data stored by the data processing node, and a node identifier obtained by mapping the target key value according to a preset mapping rule is the same as a node identifier corresponding to the data processing node; the data processing node is one of the data processing nodes in the data processing node cluster; the dimension table data stored by each data processing node in the data processing node cluster constitutes the target dimension table; Storing the dimension table data to be stored in a preset storage area; The node identifier is a routing address, and the step of screening out the dimension table data to be stored that matches the target key value from each dimension table data includes: For any of the dimension table data, mapping the dimension table key value corresponding to any of the dimension table data to a corresponding target routing address according to the mapping rule; the target routing address is used to represent a target data processing node responsible for storing any of the dimension table data; If the target routing address is the same as the routing address corresponding to the data processing node, any one of the dimension table data is used as the dimension table data to be stored.
5. The dimension table data processing method according to claim 4, characterized in that: The method further comprises: If the target routing address is different from the routing address corresponding to the data processing node, any dimension table data is discarded.
6. The dimension table data processing method according to claim 4, characterized in that: Mapping the dimension table key value corresponding to any dimension table data to the corresponding target routing address according to the mapping rule includes: Performing a hash operation on the dimension table key value corresponding to any dimension table data to obtain a hash code corresponding to any dimension table data; According to the mapping rule, the hash code corresponding to any dimension table data is mapped to a corresponding routing address as the target routing address.
7. A dimension table data processing device, characterized in that: include: An acquisition unit, configured to acquire the data to be associated; The data to be associated is data used to establish an association relationship with at least one dimension table data in the target dimension table; The data to be associated has a corresponding dimension table key value; A selection unit is configured to select a target data processing node corresponding to the target node identifier from the data processing node cluster, and forward the data to be associated to the target data processing node; the dimension table data stored in each data processing node in the data processing node cluster constitutes the target dimension table; The target node identifier is a node identifier obtained by mapping the dimension table key value corresponding to the data to be associated according to a preset mapping rule; A receiving unit, configured to execute acquisition of target dimension table data queried by the target data processing node based on the data to be associated; The target dimension table data is dimension table data that matches the dimension table key value; An associating unit is configured to establish an associative relationship between the data to be associated and the target dimension table data, and obtain associated dimension table data corresponding to the data to be associated; The node identifier is a routing address, and the selection unit is specifically configured to perform mapping processing on the dimension table key value corresponding to the data to be associated according to the mapping rule, and determine the target routing address for the data to be associated; The data to be associated is sent to a data processing node corresponding to the target routing address.
8. The dimension table data processing device according to claim 7, characterized in that: The selection unit is specifically configured to perform a hash operation on the dimension table key value corresponding to the data to be associated to obtain a hash code corresponding to the data to be associated; and map the hash code corresponding to the data to be associated to a corresponding routing address as the target routing address according to the mapping rule.
9. The dimension table data processing device according to claim 7 or 8, characterized in that: The device is also configured to execute and generate a cache instruction for the target dimension table; the cache instruction carries an identifier corresponding to the mapping rule; the cache instruction is sent to each data processing node in the data processing node cluster; the cache instruction is used to instruct any of the data processing nodes to determine and store dimension table data matching the target key value in the target dimension table; the target key value is the dimension table key value corresponding to the dimension table data stored by any of the data processing nodes, and the node identifier obtained by mapping the target key value according to the mapping rule is the same as the node identifier corresponding to any of the data processing nodes.
10. A dimension table data processing device, characterized in that: The dimension table data processing device is applied to a data processing node, and includes: a response unit, configured to execute, in response to a cache instruction for a target dimension table, determining at least one dimension table data in the target dimension table; A screening unit is configured to screen out dimension table data to be stored that matches a target key value from each dimension table data; the target key value is a dimension table key value corresponding to the dimension table data that the data processing node is responsible for storing, and a node identifier obtained by mapping the target key value according to a preset mapping rule is the same as a node identifier corresponding to the data processing node; the data processing node is one of the data processing nodes in the data processing node cluster; the dimension table data that each data processing node in the data processing node cluster is responsible for storing constitutes the target dimension table; A storage unit, configured to store the dimension table data to be stored in a preset storage area; The node identifier is a routing address, and the screening unit is specifically configured to execute, for any of the dimension table data, mapping the dimension table key value corresponding to the any of the dimension table data to the corresponding target routing address according to the mapping rule; the target routing address is used to represent the target data processing node responsible for storing the any of the dimension table data; if the target routing address is the same as the routing address corresponding to the data processing node, then the any of the dimension table data is used as the dimension table data to be stored.
11. The dimension table data processing device according to claim 10, characterized in that: The dimension table data processing device is configured to discard any dimension table data if the target routing address is different from the routing address corresponding to the data processing node.
12. The dimension table data processing device according to claim 10, characterized in that: The screening unit is specifically configured to perform a hash operation on the dimension table key value corresponding to any dimension table data to obtain a hash code corresponding to any dimension table data; and map the hash code corresponding to any dimension table data to a corresponding routing address as the target routing address according to the mapping rule.
13. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the dimension table data processing method according to any one of claims 1 to 6.
14. A computer-readable storage medium, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the dimension table data processing method according to any one of claims 1 to 6.
15. A computer program product, comprising instructions, characterized in that: When the instruction is executed by a processor of an electronic device, the electronic device is enabled to execute the dimension table data processing method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Dimension table processing method and device based on Kylin system, electronic equipment and storage medium
CN111753017A
Traffic data storage method and device, electronic equipment and storage medium
CN112069021A