Data splitting method, device, electronic device and readable storage medium
By performing split processing based on data distribution information and combining the characteristics of the data itself and the local overheating data rules, the problem of uneven data distribution in the existing technology is solved, data splitting that is closer to the business scenario is achieved, and the efficiency of data splitting is improved. Convenience and balance.
Patent Information
- Application Number
- CN202111129140.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-26
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2041-09-26
AI Technical Summary
Existing technologies fail to fully consider the characteristics of business data when splitting data in distributed databases, resulting in uneven data distribution and failure to meet splitting requirements in some scenarios.
By obtaining the first field value of the data to be split, splitting is performed based on its distribution information to form multiple sets of target values, and mapped to the database to configure different splits based on the characteristics of the data itself and the distribution rules of local overheated data. Rules are divided to ensure the balanced distribution of data on each node.
It achieves a more balanced data distribution, meets the splitting needs in different scenarios, improves the convenience of data splitting, and ensures that the split data retains its own characteristics and is close to the business scenario.
Smart Images

Figure CN113821514B
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of electronic devices, and in particular, to a data splitting method, a data splitting device, an electronic device and a readable storage medium. Background Art
[0002] With the continuous progress of digital technology and cloud computing, the combination with various industry application scenarios, the expansion of business and multi-directional development, the amount of business data generated is increasing. The distributed database and big data processing technology that emerged in response to this need to split the massive relational model data, structured data and unstructured data in a certain way (dimension) to meet the data landing on a single physical machine (limited data storage and computing processing capabilities).
[0003] In the related technologies, the distributed database industry usually splits data horizontally by range, hash modulus, time, etc., directly splitting "large" data into "small" ones. However, all data are treated in a unified manner such as hash modulus, range, consistent hash, time, etc., without fully considering the characteristics of the business data itself, resulting in a weak correlation between the distribution of data and the characteristics of the business data itself, and the splitting requirements cannot be met in some scenarios. Summary of the invention
[0004] The embodiments of the present application provide a data splitting method, device, electronic device and readable storage medium, which can configure different splitting rules based on the characteristics of the data itself or the distribution pattern of local overheating data, and scatter the data to each node, so that the distribution of the split data is more balanced.
[0005] In a first aspect, an embodiment of the present application provides a data splitting method, comprising:
[0006] Get the first field value of the data to be split;
[0007] Splitting the first field value according to the distribution information of the first field value to obtain multiple groups of target values;
[0008] The plurality of target values are mapped to a database to determine the plurality of target data.
[0009] In a second aspect, an embodiment of the present application provides a data splitting device, including:
[0010] An acquisition module, used for acquiring the first field value of the data to be split;
[0011] A splitting module, used for splitting the first field value according to the distribution information of the first field value to obtain multiple groups of target values;
[0012] The mapping module is used to map multiple target values to a database to determine multiple target data.
[0013] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor, a memory, and a program or instruction stored in the memory and running on the processor, which, when executed by the processor, implements the steps of the data splitting method provided in the first aspect.
[0014] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the data splitting method provided in the first aspect are implemented.
[0015] In a fifth aspect, an embodiment of the present application provides a chip, the chip including a processor and a communication interface, the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the steps of the data splitting method provided in the first aspect.
[0016] In an embodiment of the present application, the first field value of the data to be split is obtained; according to the distribution information of the first field value, the first field value is split to obtain multiple groups of target values; the multiple groups of target values are mapped to the database to determine multiple target data. The first field value of the data to be split is used to reflect the attributes, distribution and other information of the entity data. In the process of data splitting, the splitting process is performed on the value domain, that is, the value range of the first field value, based on the data distribution and other conditions, and the value domain is divided into multiple intervals. The target values in different intervals are mapped to the database to split the data to be split into multiple target data. In this way, different splitting rules can be configured in combination with the characteristics of the data itself or the distribution law of the local overheating data to scatter the data to each node, so that the target data after the split retains its own characteristics as much as possible, avoiding all scattering, and the data distribution is more balanced, and closer to the business scenario, meeting the splitting requirements in different scenarios, and effectively improving the convenience of data splitting. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 One of the flow charts of a data splitting method according to an embodiment of the present application is shown;
[0018] Figure 2 A second flowchart of a data splitting method according to an embodiment of the present application is shown;
[0019] Figure 3 A third flowchart of a data splitting method according to an embodiment of the present application is shown;
[0020] Figure 4 A fourth flowchart of a data splitting method according to an embodiment of the present application is shown;
[0021] Figure 5 A fifth flowchart of a data splitting method according to an embodiment of the present application is shown;
[0022] Figure 6 A sixth flowchart of a data splitting method according to an embodiment of the present application is shown;
[0023] Figure 7 FIG7 shows a flowchart of a data splitting method according to an embodiment of the present application;
[0024] Figure 8 A schematic diagram of data splitting according to a specific embodiment of the present application is shown;
[0025] Fig. 9 A structural block diagram of a data splitting device according to an embodiment of the present application is shown;
[0026] Fig.10 A structural block diagram of an electronic device according to an embodiment of the present application is shown;
[0027] Fig.11 A hardware structure block diagram of an electronic device according to an embodiment of the present application is shown. DETAILED DESCRIPTION
[0028] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.
[0029] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0030] Refer to the following Figures 1 to 11 Describe a data splitting method, a data splitting device, an electronic device and a readable storage medium according to some embodiments of the present application.
[0031] In one embodiment of the present application, Figure 1 A flowchart of a data splitting method according to an embodiment of the present application is shown, including:
[0032] Step 102, obtaining the first field value of the data to be split;
[0033] The first field value is a numerical value in the virtual table of the data to be split, represented by a string. A virtual table (not a real physical table) is a horizontally expanded table used to map the physical table of the data, which is equivalent to the configuration table of the physical table of the database. The field values in the virtual table can easily identify the data size, data distribution and other characteristic information corresponding to the physical table of the data to be split.
[0034] It is understandable that during the data splitting process, it is necessary to first determine whether the data to be split is a virtual table. If it is not a virtual table, vertical expansion is used and is temporarily ignored.
[0035] Step 104, splitting the first field value according to the distribution information of the first field value to obtain multiple groups of target values;
[0036] The distribution information includes but is not limited to at least one of the following: at least one value interval obtained after clustering of the first field value, the number of first field values in each value interval, and the overlapping part of all first field values in each value interval, etc. The distribution information is used to indicate the distribution pattern of field values of different sizes in the virtual table. Taking the user service number information (first field value) of 0755-167xxx91, 0755-255xxx27, and 020-855xxx45 as an example, after clustering, the interval of 0755 and the interval of 020 are obtained. There are 2 numbers in the interval of 0755, and there are 2 numbers in the interval of 020. 0755 is the overlapping part of the first field value in the interval of 0755.
[0037] Step 106 , mapping the multiple sets of target values to a database to determine multiple target data.
[0038] The multiple target data are multiple data after the data to be split is split.
[0039] In this embodiment, since the first field value of the data to be split reflects the attributes, distribution rules and other information of the entity data, during the data splitting process, the data distribution and other conditions can be used to split the value domain, that is, the value range of the first field value, and the value domain can be divided into multiple intervals. The target values in different intervals are mapped to the database to split the data to be split into multiple target data. Furthermore, different splitting rules can be configured in combination with the characteristics of the data itself or the distribution law of the local overheated data to scatter the data to each node, so that the target data after the split retains its own characteristics as much as possible, avoiding all scattering, making the data distribution more balanced and closer to the business scenario, meeting the splitting requirements in different scenarios, and effectively improving the convenience of data splitting.
[0040] Specifically, the data splitting method is applicable to electronic devices, including but not limited to mobile terminals, tablet computers, computers, laptop computers, wearable devices or vehicle-mounted terminals, etc.
[0041] In one embodiment of the present application, Figure 2 As shown, step 104, according to the distribution information of the first field value, the first field value is split to obtain multiple groups of target values, including:
[0042] Step 202, determining a splitting method according to the distribution information of the first field value and a preset condition;
[0043] The preset condition can be reasonably set according to the applicable conditions of the splitting method and user needs. For example, the preset condition can be that there are repeated values in the first field value or there is an interval that meets a specified range in the distribution information.
[0044] Step 204, splitting the first field value according to the splitting method to form multiple groups of second field values;
[0045] In this embodiment, the splitting method (splitting rule) of the first field value is matched by the distribution information of the first field value, so that the first field value is split by using an appropriate splitting method during the splitting process, so that the distribution of the second field value after the splitting is balanced. In this way, the splitting method is dynamically adjusted in combination with the characteristics of the data itself or the distribution law of the local overheated data, so as to achieve a non-fixed split and ensure the balance of the data after splitting.
[0046] Step 206, divide each group of second field values into multiple groups of target values according to a preset range. In this embodiment, after obtaining the second field value, each group of split second field values is split again according to the preset range to obtain multiple groups of target values, that is, each preset range is a value range of a group of target values. Thus, the personalized splitting of the field values in the virtual table is completed. After the above processing, the characteristic entity business table can be effectively mapped to multiple nodes in a more balanced way, which effectively solves the balanced distribution of the original data.
[0047] Specifically, the preset range can be determined according to the distribution information of the second field value and / or the user's demand for splitting data. Taking the provincial and municipal user service number information (t_acc_nbr) table (Table 1) in the distributed relational database business scenario as an example, it contains the following attributes:
[0048] Table 1
[0049] Field (attribute) name type user_id (user ID) Integer (bigint) latn_id (local network identifier) string acct_nbr(user number) String
[0050] For example, taking the user service number information as an example, the user service number information (first field value) is 0755-1, 0755-2, 0755-3, 0755-4, 0755-5, 020-8, and the local network identifier can be considered as the area code, such as 020, 0755, etc. The user numbers are 1, 2, 3, 4, 5, and 8. After the sub-data corresponding to the area code is split, it is divided into 0755 group (first group second field value) and 020 group (second group second field value). Since the number of first field values in the 0755 interval is large (5 is greater than 1), it means that the field values in this interval are more concentrated. In order to split the data into one value, the preset range can be set to the user number, and then it is split into 5 target values according to the user number, namely 0755-1, 0755-2, 0755-3, 0755-4, and 0755-5. The number of field values in the 020 interval is small, so 020-8 is directly used as the preset range of the 020 group.
[0051] In one embodiment of the present application, Figure 3 As shown, step 202, according to the distribution information of the first field value and the preset conditions, determines the splitting method, including:
[0052] Step 302: if the distribution information of the first field value meets a preset condition, determine that the splitting method is enumeration;
[0053] Step 304: When the distribution information of the first field value does not satisfy a preset condition, determine that the splitting method is modulo.
[0054] In this embodiment, the conditions for determining the splitting method are matched according to the distribution information of the first field value obtained in the virtual table. The first field value is compared with the preset condition. When the distribution information of the first field value meets the preset condition, the enumeration splitting method is adopted. When the distribution information of the first field value does not meet the preset condition, the modulo splitting method is adopted. Thus, the corresponding splitting method (splitting rule) is matched by the distribution information of the first field value, so that during the splitting process, the first field value is split using an appropriate splitting method, so that the distribution of the second field value after the split is balanced. Thus, the splitting method is dynamically adjusted in combination with the characteristics of the data itself or the distribution law of the local overheated data, so as to achieve a non-fixed split and ensure the balance of the data after splitting.
[0055] It should be noted that the enumeration splitting and modulus splitting adopt existing conventional algorithms, and this application does not make any specific limitations.
[0056] For example, if there are repeated values in the first field value, the same second field value may be obtained after splitting by enumeration, which is not conducive to subsequent splitting. In this case, the preset condition can be configured as no repeated values in the first field value. During the splitting process, if repeated values appear, the modulus method is used for splitting, otherwise the enumeration method is used for splitting.
[0057] It is understandable that the process of determining the splitting method can be implemented through DSL (domain-specific language), that is, the splitting rules with splitting data can be configured through DSL.
[0058] In one embodiment of the present application, Figure 4 The fourth flowchart of the data splitting method of the embodiment of the present application is shown, including:
[0059] Step 402, determining a plurality of sub-data in the data to be split according to the attribute information of the data to be split;
[0060] The attribute information includes the virtual table name, data type, data volume, etc.
[0061] Step 404, determining the subordinate relationship between the plurality of sub-data;
[0062] The subordinate relationship is used to indicate the dependency of sub-data with different attributes. For example, if sub-data B is subordinate to sub-data A, then sub-data A contains sub-data B.
[0063] Step 406, determining the order of splitting the plurality of sub-data according to the subordinate relationship;
[0064] Step 408: split the first field value corresponding to each sub-data in the splitting order according to the distribution information of the first field value corresponding to each sub-data.
[0065] In this embodiment, the data to be split is classified according to the attribute information of the data to be split, and multiple sub-data of different attributes are obtained. The subordinate relationship between the sub-data of different attributes is determined. The splitting order of the multiple sub-data is determined according to the subordinate relationship. Thus, the logical relationship between the multiple attribute sub-data is utilized to apply a split to a single attribute sub-data, and the value domain is divided into multiple groups of target values. Based on the target values, the second attribute sub-data is applied to achieve the distribution of the entity to be divided again, and so on. On the one hand, it can be applied to the data to be split containing multiple attributes to ensure the balanced distribution of the target data. On the other hand, the number and order of splits are related to the attribute information of the data to be split and the data distribution law. The splitting process of the data to be split can be regarded as a recursive process, so the number of splits is not limited, which overcomes the limitation of only performing 1 to 2 splits when the business data is horizontally split in the related art, so as to achieve more detailed division, so that the split target data can be close to the business data itself and the relationship between the attributes.
[0066] For example, Figure 8 As shown in Table 1, for user service number information, the user number depends on the area code, that is, the sub-data of the user number category belongs to the sub-data of the local network identifier category, so it is determined to split the sub-data of the local network identifier first, and then split the sub-data of the user number category based on the target data after the local network identifier category is split. For example, the numbers 0755-167xxx91, 0755-255xxx27, and 020-855xxx45 are first determined according to the splitting order that 0755-167xxx91 and 0755-255xxx27 belong to the category of area code 0755, and 020-85562445 belongs to the category of area code 020; further division is performed based on the sub-data of the area code 0755 category, 0755-167xxx91 belongs to the category of user number 167xxx91, and 0755-255xxx27 belongs to the category of user number 255xxx27.
[0067] The split rule table (vt_split_rule) of the user service number information is shown in Table 2. The split rule table is used to record the corresponding split methods, split orders, and split quantities of different attribute data in the user service number information.
[0068] Table 2
[0069]
[0070] Among them, the split identifier is used to mark the value range of the first field value of different sub-data for easy distinction. The value range identifier is used to indicate whether the current split is to split again according to the split order based on the target value after the previous attribute split. The value of vt_range_id defaults to -1, which is the first in the split order. The value of vt_range_id>0 refers to the record in the split interval table (vt_split_range), indicating that the current split is a secondary split based on the previous attribute target data. The value of split_method is 1 for enumeration, and 2 for hash modulo.
[0071] Combination Figure 8 As can be seen from Table 2, for user service number information, the field values of the area code class are first divided into three groups (sub-intervals) by enumeration according to the virtual table field values of the area code, namely, group 0755, group 020, and groups 0756 and 0757. Based on the dependency between the area code and the user number, the field values of the user number class are further divided on the basis of these three groups. Among them, the field values of the user number class under the 0755 group and the 020 group are taken in a modulo manner, and the field values of the user number class under the 0756 and 0757 groups are enumerated.
[0072] The split range table (vt_split_range) of the user service number information is shown in Table 3. After the field value corresponding to each attribute of the virtual table is divided into multiple groups of target values (sub-ranges to which a type of target value belongs) according to the splitting rule recorded in vt_split_rule, each group of target values corresponds to a record in the table.
[0073] Table 3
[0074]
[0075]
[0076] The split_id in Table 3 follows the record in Table 2 to distinguish sub-data of different attributes. The starting value and the end value of the value range constitute the preset range corresponding to the second field value. The database list is the node address of the database, that is, the mapping position of multiple groups of target values.
[0077] Combination Figure 8As can be seen from Table 2 and Table 3, for the user service number information, on the basis of the second field values of the area code class vt_range_id being 1, 2, and 3, the second field value of the user number class is further split. Specifically, the second field value of the user number class in the interval to which 0755 belongs and the interval to which 020 belongs are divided into 3 groups (three groups of target values with split_id being 2 or 3), and the second field value of the user number class in the interval to which 0756 and 0757 belong is divided into 4 groups (four groups of target values with split_id being 4). The field values (target values) corresponding to vt_range_id being 4 to 13 are mapped to a specific physical library to split the user service number information into 10 portions of target data, thereby completing the regional data cutover and facilitating the user to determine the database instance where the corresponding data is located. Of course, the target values in all groups (vt_range_id being 1 to 13) can also be mapped to a specific physical library to facilitate reading of the sub-data of the area code class.
[0078] It can be understood that each data splitting action (the process of dividing the second field value into multiple groups of target values) can be diverged into other actions, such as splitting the table, adding a suffix to the table name, or forwarding the output of the stream to a smaller range.
[0079] In one embodiment of the present application, Figure 5 As shown, step 106, mapping multiple sets of target values to target positions, includes:
[0080] Step 502, determining the category information of each group of target values;
[0081] Step 504, determining the node address of the target position corresponding to each group of target values according to the category information;
[0082] Step 506, mapping each set of target values to the database according to the node address.
[0083] In this embodiment, according to the category information of the target data, the node address corresponding to the target data of the category is found, and each group of target values is mapped to the database according to the node address to convert the target value into target data. Thus, the characteristic business table can be effectively mapped to multiple nodes in a more balanced way, effectively solving the problem of balanced distribution of the original data.
[0084] For example, Figure 8 As shown in Table 3, the target value of the 0755 area code class is mapped to physical libraries DB1, DB2, and DB3, and the three sub-intervals after the user number under the 0755 area code is split correspond to physical libraries DB1, DB2, and DB3 respectively.
[0085] In one embodiment of the present application, Figure 6The sixth flowchart of the data splitting method according to the embodiment of the present application is shown, including:
[0086] Step 602, obtaining SQL statements;
[0087] Among them, SQL statements, also known as Structured Query Language, are a database query and programming language used to access data and query, update and manage relational database systems.
[0088] Step 604, parse the SQL statement to generate a syntax tree of the SQL statement;
[0089] Specifically, each word in the SQL statement is read, and statement spaces, tabs, line breaks, and comments are removed. Then, morphemes are identified, and the morphemes are checked according to a pre-defined top-down grammar construction model to generate a syntax tree.
[0090] Step 606: Use the SQL statement blocks that match the nodes in the syntax tree as data to be split.
[0091] In this embodiment, a syntax parsing operation is performed on the sub-SQL statement block by calling any syntax parsing algorithm, and a syntax tree representing the SQL statement structure is automatically generated by directly importing the SQL statement, thereby utilizing syntax parsing to convert the SQL statement into an SQL statement block executable by the electronic device, thereby facilitating the compilation and execution of subsequent data splitting.
[0092] It is worth mentioning that the data splitting method proposed in this application can be applied to relational databases, structured data, and unstructured data. As long as the fixed attributes of the database and the distribution information of the data can be extracted, this method can be applied. Of course, it can also be applied to big data computing scenarios, solving the problem of data skew through data splitting, and through modular implementation, it can be applied to the input and output ends of big data streams.
[0093] In one embodiment of the present application, Figure 7 The seventh flowchart of the data splitting method according to the embodiment of the present application is shown, including:
[0094] Step 702, in response to a query instruction of any target data, reading any target data from a target location;
[0095] Step 704, output any target data.
[0096] In this embodiment, when the user needs to call data, a query instruction can be issued, and the electronic device reads the required target data from the target location based on the query instruction and outputs it, so that the user can obtain the required data in a targeted manner and improve the efficiency of data calling.
[0097] Specifically, for example, the client sends the SQL text (DML, DQL) statement to be executed by the network protocol (such as MySQL protocol) to the electronic device of the server through the SQL interface of JDBC / ODBC, so that the server can split the data to be split in the SQL statement. Further, after receiving the input SQL text, the server program parses and generates the syntax tree in the program through SQL lexical syntax analysis. According to the existing configuration rules, find out whether the database table involved in the syntax tree needs to be split. If it needs to be split, find the split column contained in the table by the table name (attribute information), where one column is a sub-data, and obtain the value corresponding to the split column in the SQL text. Determine whether the sub-data is a virtual table. If not, enter the non-virtual table processing flow; if so, configure the splitting rules according to the distribution law, cardinality size, logical relationship (split order) of the corresponding values of each column of SQL, and find the corresponding value domain (second field value) according to the splitting rules. Determine whether the second field value under the current value domain still has subordinate data to be split. If yes, then under the current value range, continue to split the corresponding value of the next column of SQL until all columns that need to be split complete the data splitting step; if not, determine the database corresponding to the current value range according to the value range, execute the corresponding SQL statement on the found database, and return the execution result to the client. The client receives the output of the server and returns it to the calling program. On the one hand, configuring the splitting rules in combination with the characteristics of the business data itself or the distribution law of local overheating data, rather than fixed splitting, can be closer to the business scenario and scatter the data to each node. At the same time, the split data can retain its own characteristics as much as possible to avoid all scattering. On the other hand, data splitting can be regarded as a conversion (mapping) of the values corresponding to the column and dividing the values after the value mapping. Moreover, the splitting can be divided again based on the existing target value, that is, recursive processing, without limiting the number of splits, so that the characteristic business table can be effectively mapped to multiple nodes in a more balanced way, effectively solving the balanced distribution of the original data.
[0098] In one embodiment of the present application, Fig. 9 As shown, the data splitting device 900 includes: an acquisition module 902, which is used to obtain the first field value of the data to be split; a splitting module 904, which is used to split the first field value according to the distribution information of the first field value to obtain multiple groups of target values; a mapping module 906, which is used to map the multiple groups of target values to the database to determine multiple target data.
[0099] In this embodiment, since the first field value of the data to be split reflects the attributes, distribution rules and other information of the entity data, during the data splitting process, the data distribution and other conditions can be used to split the value domain, that is, the value range of the first field value, and the value domain can be divided into multiple intervals. The target values in different intervals are mapped to the database to split the data to be split into multiple target data. Furthermore, different splitting rules can be configured in combination with the characteristics of the data itself or the distribution law of the local overheated data to scatter the data to each node, so that the target data after the split retains its own characteristics as much as possible, avoiding all scattering, making the data distribution more balanced and closer to the business scenario, meeting the splitting requirements in different scenarios, and effectively improving the convenience of data splitting.
[0100] Optionally, the data splitting device 900 also includes: a first determination module (not shown in the figure), the first determination module is used to determine the splitting method according to the distribution information of the first field value and preset conditions; according to the splitting method, the first field value is split to form multiple groups of second field values; the splitting module 904 is also used to divide each group of second field values into multiple groups of target values according to a preset range.
[0101] Optionally, the first determination module is further used to determine that the splitting method is enumeration when the distribution information of the first field value meets the preset conditions; and to determine that the splitting method is modulo when the distribution information of the first field value does not meet the preset conditions.
[0102] Optionally, the data splitting device 900 also includes: a second determination module (not shown in the figure), the second determination module is used to determine multiple sub-data in the data to be split according to the attribute information of the data to be split; determine the subordinate relationship between the multiple sub-data; determine the splitting order of the multiple sub-data according to the subordinate relationship; the splitting module 904 is also used to split the first field value corresponding to each sub-data according to the splitting order and according to the distribution information of the first field value corresponding to each sub-data.
[0103] Optionally, the data splitting device 900 also includes: a third determination module (not shown in the figure), the third determination module is used to determine the category information of each group of target values; determine the node address of the target position corresponding to each group of target values according to the category information; the mapping module 906 is also used to map each group of target values to the database according to the node address.
[0104] Optionally, the data splitting device 900 also includes: a reading module (not shown in the figure), which is used to read any target data from the target position in response to a query instruction of any target data; and an output module (not shown in the figure), which is used to output any target data.
[0105] In this embodiment, each module of the data splitting device 900 implements the steps of the data splitting method in any embodiment of the first aspect when performing its respective functions. Therefore, the data splitting device 900 also includes all the beneficial effects of the data splitting method in any embodiment of the first aspect, which will not be repeated here.
[0106] The data splitting device in the embodiment of the present application can be a device, or a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. Exemplarily, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., and the non-mobile electronic device can be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV) or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.
[0107] The data splitting device in the embodiment of the present application can be a device with an operating system. The operating system can be an Android operating system, an iOS operating system, or other operating systems, which are not specifically limited in the embodiment of the present application.
[0108] In one embodiment of the present application, Fig.10 As shown, an electronic device 1000 is provided, including: a processor 1001, a memory 1002, and a program or instruction stored in the memory 1002 and running on the processor 1001. When the program or instruction is executed by the processor 1001, the steps of the data splitting method provided in any of the above embodiments are implemented. Therefore, the electronic device 1000 includes all the beneficial effects of the data splitting method provided in any of the above embodiments, which will not be repeated here.
[0109] It should be noted that the electronic devices in the embodiments of the present application include the above-mentioned mobile electronic devices and non-mobile electronic devices.
[0110] Fig.11The hardware structure diagram of an electronic device 1100 for implementing an embodiment of the present application is shown in the following figure. The electronic device 1100 includes, but is not limited to, a radio frequency unit 1101, a network module 1102, an audio output unit 1103, an input unit 1104, a sensor 1105, a display unit 1106, a user input unit 1107, an interface unit 1108, a memory 1109, and a processor 1110.
[0111] Those skilled in the art will appreciate that the electronic device 1100 may also include a power source (such as a battery) for supplying power to each component, and the power source may be logically connected to the processor 1110 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Fig.11 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.
[0112] Among them, the processor 1110 is used to obtain the first field value of the data to be split; split the first field value according to the distribution information of the first field value to obtain multiple groups of target values; map the multiple groups of target values to the database to determine multiple target data.
[0113] In this embodiment, since the first field value of the data to be split reflects the attributes, distribution rules and other information of the entity data, during the data splitting process, the data distribution and other conditions can be used to split the value domain, that is, the value range of the first field value, and the value domain can be divided into multiple intervals. The target values in different intervals are mapped to the database to split the data to be split into multiple target data. Furthermore, different splitting rules can be configured in combination with the characteristics of the data itself or the distribution law of the local overheated data to scatter the data to each node, so that the target data after the split retains its own characteristics as much as possible, avoiding all scattering, making the data distribution more balanced and closer to the business scenario, meeting the splitting requirements in different scenarios, and effectively improving the convenience of data splitting.
[0114] Furthermore, the processor 1110 is also used to determine a splitting method based on the distribution information of the first field value and preset conditions; split the first field value according to the splitting method to form multiple groups of second field values; and divide each group of second field values into multiple groups of target values according to a preset range.
[0115] Furthermore, the processor 1110 is also used to determine that the splitting method is enumeration when the distribution information of the first field value meets the preset condition; and to determine that the splitting method is modulo when the distribution information of the first field value does not meet the preset condition.
[0116] Furthermore, the processor 1110 is also used to determine multiple sub-data in the data to be split according to the attribute information of the data to be split; determine the subordinate relationship between the multiple sub-data; determine the splitting order of the multiple sub-data according to the subordinate relationship; and split the first field value corresponding to each sub-data according to the splitting order and the distribution information of the first field value corresponding to each sub-data.
[0117] Furthermore, the processor 1110 is also used to determine the category information of each group of target values; determine the node address of the target position corresponding to each group of target values according to the category information; and map each group of target values to the database according to the node address.
[0118] Furthermore, the processor 1110 is further configured to read any target data from the target location in response to a query instruction for any target data; and the radio frequency unit 1101 is configured to output any target data.
[0119] It should be understood that in the embodiment of the present application, the input unit 1104 may include a graphics processor (Graphics Processing Unit, GPU) 1141 and a microphone 1142, and the graphics processor 1141 processes the image data of the static picture or video obtained by the image capture device (such as a camera) in the video capture mode or the image capture mode. The display unit 1106 may include a display panel 1161, and the display panel 1161 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 1107 includes a touch panel 1171 and other input devices 1172. The touch panel 1171 is also called a touch screen. The touch panel 1171 may include two parts: a touch detection device and a touch controller. Other input devices 1172 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be repeated here. The memory 1109 can be used to store software programs and various data, including but not limited to applications and operating systems. The processor 1110 may integrate an application processor and a modem processor, wherein the application processor mainly processes an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the modem processor may not be integrated into the processor 1110.
[0120] In one embodiment of the present application, a read storage medium is provided, on which a program or instruction is stored. When the program or instruction is executed by a processor, the steps of the data splitting method provided in any of the above embodiments are implemented.
[0121] In this embodiment, reading the storage medium can implement each process of the data splitting method provided in the embodiment of the present application and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0122] The processor is the processor in the communication device in the above embodiment. The read storage medium includes a computer readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0123] An embodiment of the present application also provides a chip, which includes a processor and a communication interface. The communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned data splitting method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0124] It should be understood that the chip mentioned in the embodiments of the present application may also be referred to as a system-level chip, a system chip, a chip system, or a system-on-chip chip, etc.
[0125] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0126] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0127] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A data splitting method, characterized in that: include: Get the first field value of the data to be split; Splitting the first field value according to the distribution information of the first field value to obtain multiple groups of target values; Mapping the multiple sets of target values to a database to determine multiple target data; The distribution information includes at least one value interval obtained after clustering of the first field values, the number of the first field values in each value interval, and the overlapping part of all the first field values in each value interval.
2. The data splitting method according to claim 1, characterized in that: The splitting of the first field value according to the distribution information of the first field value to obtain multiple groups of target values includes: Determine a splitting method according to the distribution information of the first field value and a preset condition; According to the splitting method, the first field value is split to form multiple groups of second field values; Each group of second field values is divided into the plurality of groups of target values according to a preset range.
3. The data splitting method according to claim 2, characterized in that: The determining the splitting method according to the distribution information of the first field value and the first preset range includes: When the distribution information of the first field value meets the preset condition, determining that the splitting method is enumeration; When the distribution information of the first field value does not satisfy the preset condition, the splitting method is determined to be modulo.
4. The data splitting method according to claim 1, characterized in that: Also includes: Determining a plurality of sub-data in the data to be split according to the attribute information of the data to be split; Determine the subordinate relationship between multiple sub-data; Determining a splitting order of the plurality of sub-data according to the subordinate relationship; The splitting process of the field value according to the distribution information of the field value includes: According to the splitting order and based on the distribution information of the first field value corresponding to each sub-data, the first field value corresponding to each sub-data is split.
5. A data splitting device, characterized in that: include: An acquisition module, used for acquiring the first field value of the data to be split; a splitting module, configured to split the first field value according to the distribution information of the first field value to obtain multiple groups of target values; A mapping module, used for mapping the plurality of target values to a database to determine a plurality of target data; The distribution information includes at least one value interval obtained after clustering of the first field values, the number of the first field values in each value interval, and the overlapping part of all the first field values in each value interval.
6. The data splitting device according to claim 5, characterized in that: Also includes: A first determining module, used to determine a splitting method according to the distribution information of the first field value and a preset condition; According to the splitting method, the first field value is split to form multiple groups of second field values; The splitting module is further used to divide each group of second field values into the multiple groups of target values according to a preset range.
7. The data splitting device according to claim 6, characterized in that: The first determining module is further configured to determine that the splitting method is enumeration when the distribution information of the first field value meets the preset condition; When the distribution information of the first field value does not satisfy the preset condition, the splitting method is determined to be modulo.
8. The data splitting device according to claim 5, characterized in that: Also includes: A second determining module, configured to determine a plurality of sub-data in the data to be split according to the attribute information of the data to be split; Determine the subordinate relationship between multiple sub-data; Determining a splitting order of the plurality of sub-data according to the subordinate relationship; The splitting module is further used to split the first field value corresponding to each sub-data according to the splitting order and the distribution information of the first field value corresponding to each sub-data.
9. An electronic device, characterized in that: It includes a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the data splitting method as described in any one of claims 1 to 4.
10. A readable storage medium, characterized in that: The readable storage medium stores programs or instructions, and when the programs or instructions are executed by the processor, the steps of the data splitting method as described in any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Database table segmentation method, device and system and medium
CN108153849A
Method and device for obtaining recommendation language and electronic equipment
CN111143546A
