Data table connection method and device, electronic equipment and storage medium
By obtaining tables with a small number of null values and tables with a large number of null values, and using Bloom filters to filter common field values, efficient joins of large tables are realized and the problem of low join operation efficiency of large tables is solved.
Patent Information
- Application Number
- CN202410811962.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-21
- Publication Date
- 2024-08-27
AI Technical Summary
The processing efficiency of large tables and join operations of large tables is low in relational databases, and it is difficult for existing optimization strategies to effectively improve efficiency.
By obtaining a table with a small number of null values as the first splicing table and a table with a large number of null values as the second splicing table, create a splicing Bloom filter based on the same field, filter out a list of common field values, and perform an intersection operation to achieve Efficient connection.
The efficiency of join operations between large tables is improved. Data is filtered and connected through Bloom filters, which reduces the processing volume and improves the efficiency of join operations on large tables.
Smart Images

Figure CN118550918A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of databases, and in particular to a data table connection method, device, electronic equipment and storage medium. Background Art
[0002] The join operation in the database is a core function in the relational database management system. The basic process of the join operation includes: parsing the query, optimizing the query plan, executing the join, and generating the result set. There are optimization strategies for the join operation, including: index optimization, small table priority principle, parallel processing, etc. For the join operation of a large table and a small table, the small table is usually used as the driving table of the join to reduce the number of rows that need to be checked, and then parallel processing is performed to improve efficiency. However, for the join operation of a large table and a large table, the processing efficiency is still low. Summary of the invention
[0003] In view of the above technical problems, the technical solution adopted by the present invention is:
[0004] A data table connection method, the method comprising:
[0005] Obtain a first concatenation table and a second concatenation table, wherein the number of null values in the first concatenation table is less than the number of null values in the second concatenation table;
[0006] Obtain the same field marks of the first splicing table and the second splicing table as splicing fields, and obtain a first splicing field value list under the splicing field of the first splicing table and a second splicing field value list under the splicing field of the second splicing table, wherein the first splicing field value list includes a plurality of first splicing field values, and the second splicing field value list includes a plurality of second splicing field values;
[0007] Creating a concatenated Bloom filter for the second concatenated field value list based on the number of the second concatenated field values and a preset false alarm rate;
[0008] Traverse the first concatenated field value list, use the first concatenated field value to search in the concatenated Bloom filter, if not found, delete the first concatenated field value from the first concatenated field value list, and obtain the intersection of the second concatenated field value list and the first concatenated field value list after deletion as the specified field value list;
[0009] Based on the specified field value list, the first concatenated table and the second concatenated table are connected to obtain a specified connection table.
[0010] A data table connection device, the device comprising:
[0011] A first splicing table and a second splicing table acquisition module, used to acquire the first splicing table and the second splicing table, wherein the number of null values in the first splicing table is less than the number of null values in the second splicing table;
[0012] A splicing field acquisition module is used to obtain the same field marks of the first splicing table and the second splicing table as splicing fields, and obtain the first splicing field value list of the first splicing table under the splicing field and the second splicing field value list of the second splicing table under the splicing field, wherein the first splicing field value list contains several first splicing field values, and the second splicing field value list contains several second splicing field values.
[0013] The splicing Bloom filter creation module is used to create a splicing Bloom filter of the second splicing field value list based on the number of the second splicing field values and a preset false alarm rate.
[0014] The designated field value list acquisition module is used to traverse the first spliced field value list, use the first spliced field value to search in the spliced Bloom filter, if not found, delete the first spliced field value in the first spliced field value list, and obtain the intersection of the second spliced field value list and the deleted first spliced field value list as the designated field value list.
[0015] A designated connection table acquisition module is used to traverse the first splicing field value list, use the first splicing field value to search in the splicing Bloom filter, if not found, delete the first splicing field value in the first splicing field value list, and obtain the intersection of the second splicing field value list and the deleted first splicing field value list as the designated field value list.
[0016] According to another aspect of the present invention, a non-transitory computer-readable storage medium is provided, in which at least one instruction or at least one program is stored, and the at least one instruction or the at least one program is loaded and executed by a processor to implement the aforementioned method.
[0017] According to yet another aspect of the present invention, an electronic device is provided, comprising a processor and the aforementioned non-transitory computer-readable storage medium.
[0018] The present invention has at least the following beneficial effects:
[0019] In summary, the same fields of the first splicing table and the second splicing table are marked as splicing fields, and the first splicing field value list of the first splicing table under the splicing field and the second splicing field value list of the second splicing table under the splicing field are obtained. Based on the number of second splicing field values and a preset false alarm rate, a splicing Bloom filter of the second splicing field value list is created, the first splicing field value list is traversed, and the first splicing field value is used to search in the splicing Bloom filter. If it cannot be found, the first splicing field value is deleted from the first splicing field value list, and the intersection of the second splicing field value list and the deleted first splicing field value list is obtained as the designated field value list. Based on the designated field value list, the first splicing table and the second splicing table are connected to obtain a designated connection table. The present invention uses a Bloom filter to screen the same fields of the first splicing table and the second splicing table and then splice them, thereby efficiently realizing the splicing between large tables. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0021] Figure 1 A flowchart of a data table connection method provided in Example 1 of the present invention. DETAILED DESCRIPTION
[0022] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0023] Embodiment 1
[0024] Embodiment 1 of the present invention provides a data table connection method, such as Figure 1 As shown, the method includes:
[0025] S009: Obtain a first concatenation table and a second concatenation table, wherein the number of null values in the first concatenation table is less than the number of null values in the second concatenation table.
[0026] S010, obtain the same field mark of the first splicing table and the second splicing table as the splicing field, and obtain the first splicing field value list under the splicing field of the first splicing table and the second splicing field value list under the splicing field of the second splicing table, wherein the first splicing field value list contains several first splicing field values, and the second splicing field value list contains several second splicing field values.
[0027] Specifically, if the first splicing table and the second splicing table have only one identical field, the identical field is recorded as the splicing field; if the first splicing table and the second splicing table have more than one identical field, based on the preset field priority list, the identical field with the highest priority among the identical fields in the first splicing table and the second splicing table is recorded as the splicing field.
[0028] Specifically, the first concatenated field value list E={E1, E2, ..., E g , …, E z}, E g is the first concatenated field value, the value range of g is 1 to z, z is the number of first concatenated field values, and the second concatenated field value list F = {F1, F2, ..., F t , …, F k}, F t is the t-th second concatenated field value, where t ranges from 1 to k, and k is the number of second concatenated field values.
[0029] S020: Create a concatenated Bloom filter for the second concatenated field value list based on the number of the second concatenated field values and a preset false alarm rate.
[0030] S030, traverse the first spliced field value list, use the first spliced field value to search in the spliced Bloom filter, if not found, delete the first spliced field value in the first spliced field value list, and obtain the intersection of the second spliced field value list and the deleted first spliced field value list as the specified field value list.
[0031] Specifically, traversing the first splicing field value list and using the first splicing field value to search in the splicing Bloom filter specifically includes: mapping each first splicing field value to a first splicing hash value through each preset hash function, and determining whether the first hash value is "0" at the corresponding position of the splicing Bloom filter.
[0032] S040: Based on the specified field value list, connect the first concatenation table and the second concatenation table to obtain a specified connection table.
[0033] In one embodiment of the present invention, based on a specified field value list, the first concatenation table and the second concatenation table are screened, and a large-small table join operation is performed on the screened first concatenation table and the screened second concatenation table to obtain a specified connection table.
[0034] In summary, the same fields of the first splicing table and the second splicing table are marked as splicing fields, and the first splicing field value list of the first splicing table under the splicing field and the second splicing field value list of the second splicing table under the splicing field are obtained. Based on the number of second splicing field values and a preset false alarm rate, a splicing Bloom filter of the second splicing field value list is created, the first splicing field value list is traversed, and the first splicing field value is used to search in the splicing Bloom filter. If it cannot be found, the first splicing field value is deleted from the first splicing field value list, and the intersection of the second splicing field value list and the deleted first splicing field value list is obtained as the designated field value list. Based on the designated field value list, the first splicing table and the second splicing table are connected to obtain a designated connection table. The present invention uses a Bloom filter to screen the same fields of the first splicing table and the second splicing table and then splice them, thereby efficiently realizing the splicing between large tables.
[0035] Furthermore, the present invention uses the data table with fewer null values in the first data table and the second data table as the first splicing table, and uses the data table with more null values in the first data table and the second data table as the second splicing table, and creates a splicing Bloom filter corresponding to the second splicing table. It can be understood that the second splicing table is regarded as a "small table" to perform a join operation on the large and small tables, thereby realizing a join operation between large tables.
[0036] Specifically, in S020, based on the number of second spliced field values and a preset false alarm rate, creating a spliced Bloom filter of the second spliced field value list specifically includes:
[0037] S021, using the number of the second concatenated field values as the number of inserted elements of the concatenated Bloom filter.
[0038] Specifically, the number of inserted elements of the spliced Bloom filter=k.
[0039] S022, obtaining a preset false alarm rate.
[0040] Specifically, a preset false alarm rate u is obtained, and the preset false alarm rate is obtained based on the data volume of the second splicing table. It can be understood that a data volume range-false alarm rate correspondence table is pre-set, so as to obtain the preset false alarm rate based on the data volume of the second splicing table.
[0041] S023: Create a concatenated Bloom filter of a second concatenated field value list based on the number of inserted elements of the concatenated Bloom filter and a preset false alarm rate.
[0042] Specifically, the bit array length of the spliced Bloom filter is L=k×lnu / (ln2) 2, the intermediate number f=L / k×ln2, a concatenated Bloom filter is created based on the bit array length L and the intermediate number f.
[0043] Specifically, the step of creating a spliced Bloom filter of a second spliced field value list based on the number of inserted elements of the spliced Bloom filter and a preset false alarm rate in S023 specifically includes:
[0044] S0231, obtaining a specified hash function list, wherein the specified hash function list includes an intermediate number of specified hash functions, and the intermediate number is obtained based on the number of inserted elements of the spliced Bloom filter and a preset false alarm rate.
[0045] Specifically, the specified hash function list G = {G1, G2, ..., G h , …, G f}, G h It is the hth specified hash function, and the value range of h is 1 to f.
[0046] S0232, mapping each second splicing field value into a second splicing hash value through each specified hash function, and setting the value of the corresponding position of the bit array to "1" based on the second splicing hash value, thereby obtaining a splicing Bloom filter.
[0047] In summary, the number of the second spliced field values is used as the number of inserted elements of the spliced Bloom filter, the preset false alarm rate is obtained, and the spliced Bloom filter of the second spliced field value list is created based on the number of inserted elements of the spliced Bloom filter and the preset false alarm rate. This is different from the case where the data of the large table is used to create the Bloom filter when the large table is joined with the table of the first data type of the large table, and the data table with a large number of null values is considered to be a "small table". Since the difference between the first spliced table and the second spliced table is not large, the Bloom filter is created directly based on the data of the "small table".
[0048] The present invention also includes that in S009, the first connection table and the second connection table are obtained by the following steps:
[0049] S004: Acquire the first data table and the second data table to be joined.
[0050] S005: Determine, based on a data table type determination method, whether the first data table and the second data table are first data type tables or second data type tables.
[0051] S006: If one of the first data table and the second data table is a table of the first data type and the other data table is a table of the second data type, mark the table of the first data type as a first connection table and mark the table of the second data type as a second connection table.
[0052] S007: If the first data table and the second data table are both tables of the first data type, mark the one with fewer null values in the first data table and the second data table with more null values in the second data table as the first concatenated table, and mark the one with more null values in the first data table and the second concatenated table.
[0053] Specifically, the method for determining the data table type in S005 is:
[0054] S001, obtain the target data table.
[0055] S002, obtaining the memory occupied by the target data table, the number of fields in the target data table, and the sum of the number of field values under all fields in the target data table.
[0056] S003, determining whether the target data table is a first data type table or a second data type table based on the memory occupied by the target data table, the number of fields of the target data table, and the sum of the number of field values under all fields of the target data table.
[0057] In summary, obtain the target data table, obtain the memory occupied by the target data table, the number of fields of the target data table, and the sum of the number of field values under all fields of the target data table, and determine whether the target data table is a first data type table or a second data type based on the memory occupied by the target data table, the number of fields of the target data table, and the sum of the number of field values under all fields of the target data table. When performing a join operation on a large second data type, it is necessary to distinguish the first data type table and the second data type from the data table for different processing. Usually, the large second data type is distinguished only according to the amount of data. The present invention distinguishes the first data type table and the second data type more accurately based on the three dimensions of occupied memory, the number of fields, and the number of field values, compared to distinguishing only by the amount of data, and is more conducive to subsequent join processing.
[0058] Specifically, in S003, based on the memory occupied by the target data table, the number of fields of the target data table, and the sum of the number of field values under all fields of the target data table, determining whether the target data table is a table of the first data type or a table of the second data type includes:
[0059] S310, normalize the memory occupied by the target data table to obtain target normalized memory.
[0060] Specifically, an inverse cotangent transform is performed on the memory occupied by the target data table to obtain the target normalized memory.
[0061] Furthermore, the memory x1 occupied by the target data table is obtained, and the target normalized memory y1=2 / π×arctan(x1) is obtained.
[0062] S320, normalize the number of fields in the target data table to obtain a target normalized field number.
[0063] Specifically, an inverse cotangent transformation is performed on the number of fields in the target data table to obtain the target normalized field number.
[0064] Further, the number x2 of fields in the target data table is obtained, and the target normalized field number y2=2 / π×arctan(x2) is obtained.
[0065] S330, normalize the sum of the number of field values under all fields of the target data table to obtain the sum of the number of target normalized field values.
[0066] The number of field values under each field is obtained and summed up, thereby obtaining the sum of the number of field values under all fields.
[0067] Specifically, an inverse cotangent transformation is performed on the sum of the number of field values under all fields of the target data table to obtain the sum of the number of target normalized field values.
[0068] Furthermore, the sum x3 of the number of field values under all fields of the target data table is obtained, and the sum y3=2 / π×arctan(x3) of the number of target normalized field values is obtained.
[0069] S340, based on the target normalized memory, the target normalized field quantity and the target normalized field value quantity, determine whether the target data table is a first data type table or a second data type table.
[0070] In S340, determining whether the target data table is a first data type table or a second data type table based on the target normalized memory, the target normalized field quantity, and the target normalized field value quantity specifically includes:
[0071] S341, obtain the sum of the target normalized memory, the target normalized field quantity and the target normalized field value quantity, and record it as the target normalized sum value.
[0072] S342, if the target normalized sum value>the preset first data type table score, determine the target data table as the first data type table; otherwise, determine the target data table as the second data type table.
[0073] Specifically, the preset first data type table score is determined according to actual needs.
[0074] In summary, the memory occupied by the target data table is normalized to obtain the target normalized memory, the number of fields of the target data table is normalized to obtain the target normalized number of fields, the sum of the number of field values under all fields of the target data table is normalized to obtain the sum of the target normalized number of field values, and based on the target normalized memory, the target normalized number of fields and the sum of the target normalized number of field values, it is determined that the target data table is a first data type table or a second data type. In the present invention, the memory occupied by the target data table, the number of fields of the target data table, and the sum of the number of field values under all fields of the target data table are not at the same order of magnitude, so normalization is performed so that the values of the three dimensions are at the same order of magnitude, which is convenient for determining the size table.
[0075] Furthermore, after S006, the following steps are also included:
[0076] S100, obtaining the same fields of the first connection table and the second connection table and recording them as connection fields, and obtaining a first connection field value list under the connection field of the first connection table and a second connection field value list under the connection field of the second connection table, wherein the first connection field value list includes a plurality of first connection field values, and the second connection field value list includes a plurality of second connection field values.
[0077] Specifically, if the first connection table and the second connection table have only one common field, the common field is recorded as the connection field; if the first connection table and the second connection table have more than one common field, based on the preset field priority list, the common field with the highest priority among the common fields of the first connection table and the second connection table is recorded as the connection field, wherein the preset field priority list A={A1,A2,…,A i , …, A m}, A i is the i-th preset field, A i has a higher priority than A i+1 The priority of i ranges from 1 to m, where m is the number of preset fields.
[0078] Specifically, the first connection field value list B = {B1, B2, ..., B j , …, B n}, B j is the jth first connection field value, the value range of j is 1 to n, and n is the number of first connection field values; the second connection field value list C = {C1, C2, ..., C r , …, C s}, C r is the rth second connection field value, r ranges from 1 to s, and s is the number of second connection field values.
[0079] S110 : Create a connection Bloom filter for the second connection field value list based on the number of second connection field values and the number of first connection field values.
[0080] The step of creating a connection Bloom filter for the second connection field value list based on the number of second connection field values and the number of first connection field values in S110 includes:
[0081] S111, taking the number of first connection field values as the number of inserted elements.
[0082] Specifically, the number n of the first connection field values is the number of inserted elements connecting the Bloom filters.
[0083] S112: Taking the ratio of the number of the second connection field values to the number of the first connection field values as the false alarm rate.
[0084] Specifically, the false alarm rate of the connection Bloom filter is d=s / n.
[0085] S113, creating a connection Bloom filter for the second connection field value list based on the number of inserted elements and the false alarm rate.
[0086] Specifically, in S113, creating a connection Bloom filter for the second connection field value list based on the number of inserted elements and the false alarm rate includes:
[0087] S1131, obtaining the bit array length and the number of connected hash functions based on the number of inserted elements and the false alarm rate.
[0088] Specifically, the bit array length a=(n×lnd) / (ln2) 2 ; The number of connection hash functions b = a / n×ln2.
[0089] S1132, obtaining a preset hash function list, wherein the number of preset hash functions in the preset hash function list is the same as the number of connection hash functions.
[0090] Specifically, the preset hash function list D = {D1, D2, ..., D c , …, D b}, D c It is the cth preset hash function, and the value range of c is from 1 to b.
[0091] S1133, mapping each second connection field value to a second connection hash value through each preset hash function, and setting the value of the corresponding position of the bit array to "1" based on the second connection hash value, thereby obtaining a connection Bloom filter of the second connection field value list.
[0092] In summary, the number of first connection field values is used as the number of inserted elements of the connection Bloom filter, and the ratio of the number of second connection field values to the first connection field value is used as the false alarm rate of the connection Bloom filter. The bit array length and the number of connection hash functions are obtained based on the number of inserted elements of the connection Bloom filter and the false alarm rate of the connection Bloom filter, and a preset hash function list is obtained. The preset hash function list includes preset hash functions of the number of connection hash functions, and each second connection field value is mapped to a second connection hash value through each preset hash function. Based on the second connection hash value, the value of the corresponding position of the bit array is set to "1", thereby obtaining the connection Bloom filter of the second connection field value list. In the present invention, the first connection table is a first data type table, and the connection Bloom filter of the second connection field value list is created based on the data information of the first connection field value, which does not affect the conversion of the first connection field value into the first connection hash value, thereby avoiding the problem of excessive and inaccurate repetition of the hash value of the first connection field value caused by insufficient bit array length when creating the data information of the second connection field value.
[0093] S120, traverse the first connection field value list, use the first connection field value to search in the connection Bloom filter, if not found, delete the first connection field value in the first connection field value list, and obtain the intersection of the deleted first connection field value list and the second connection field value list as the target field value list.
[0094] Among them, traversing the first connection field value list in S120 and using the first connection field value to search in the connection Bloom filter specifically includes: mapping each first connection field value to a first connection hash value through each preset hash function, and determining whether the first connection hash value is "0" at the corresponding position of the connection Bloom filter.
[0095] Specifically, if the first connection hash value is "0" at the corresponding position of the connection Bloom filter, the first connection field value corresponding to the first connection hash value is determined to be not found, and the first connection field value is deleted from the first connection field value list.
[0096] S130: Connect the first connection table and the second connection table based on the target field value list to obtain a target connection table.
[0097] In one embodiment of the present invention, based on the target field value list, the first connection table and the second connection table are screened, and a large-small table join operation is performed on the screened first connection table and the screened second connection table to obtain the target connection table.
[0098] In summary, the same field of the first connection table and the second connection table is obtained and recorded as the connection field, and the first connection field value list of the first connection table under the connection field and the second connection field value list of the second connection table under the connection field are obtained. Based on the number of second connection field values and the number of first connection field values, a connection Bloom filter of the second connection field value list is created, the first connection field value list is traversed, and the first connection field value is used to search in the connection Bloom filter. If it cannot be found, the first connection field value is deleted from the first connection field value list, and the intersection of the deleted first connection field value list and the second connection field value list is obtained as the target field value list. Based on the target field value list, the first connection table and the second connection table are connected to obtain the target connection table. The present invention filters out the same fields of the first connection table and the second connection table by means of a Bloom filter, and then connects them through the same fields. Compared with directly performing a join operation, the present invention has a smaller amount of data when connecting, a higher efficiency, and a more reasonable target connection table is obtained.
[0099] Embodiment 2
[0100] A second embodiment of the present invention provides a data table connection device, the device comprising:
[0101] The data acquisition module is used to acquire a first splicing table and a second splicing table, wherein the number of null values in the first splicing table is less than the number of null values in the second splicing table.
[0102] A splicing field acquisition module is used to obtain the same field marks of the first splicing table and the second splicing table as splicing fields, and obtain the first splicing field value list of the first splicing table under the splicing field and the second splicing field value list of the second splicing table under the splicing field, wherein the first splicing field value list contains several first splicing field values, and the second splicing field value list contains several second splicing field values.
[0103] The splicing Bloom filter creation module is used to create a splicing Bloom filter of the second splicing field value list based on the number of the second splicing field values and a preset false alarm rate.
[0104] The designated field value list acquisition module is used to traverse the first spliced field value list, use the first spliced field value to search in the spliced Bloom filter, if not found, delete the first spliced field value in the first spliced field value list, and obtain the intersection of the second spliced field value list and the deleted first spliced field value list as the designated field value list.
[0105] A designated connection table acquisition module is used to traverse the first splicing field value list, use the first splicing field value to search in the splicing Bloom filter, if not found, delete the first splicing field value in the first splicing field value list, and obtain the intersection of the second splicing field value list and the deleted first splicing field value list as the designated field value list.
[0106] Specifically, the splicing Bloom filter creation module also includes:
[0107] The module for obtaining the number of inserted elements of the spliced Bloom filter is used to use the number of second spliced field values as the number of inserted elements of the spliced Bloom filter.
[0108] The preset false alarm rate acquisition module is used to obtain the preset false alarm rate.
[0109] The spliced Bloom filter acquisition module is used to create a spliced Bloom filter of the second spliced field value list based on the number of inserted elements of the spliced Bloom filter and a preset false alarm rate.
[0110] Specifically, the splicing Bloom filter acquisition module also includes:
[0111] The designated hash function list acquisition module is used to acquire a designated hash function list, wherein the designated hash function list includes an intermediate number of designated hash functions, and the intermediate number is acquired based on the number of inserted elements of the spliced Bloom filter and a preset false alarm rate.
[0112] The spliced Bloom filter mapping module is used to map each second spliced field value into a second spliced hash value through each specified hash function, and set the value of the corresponding position of the bit array to "1" based on the second spliced hash value, so as to obtain a spliced Bloom filter.
[0113] Furthermore, the device also includes:
[0114] The first data table and the second data table acquisition module are used to acquire the first data table and the second data table for the join operation.
[0115] The first data table and the second data table determining module are used to determine whether the first data table and the second data table are first data type tables or second data type tables based on a data table type determining method.
[0116] The first connection table and the second connection table acquisition module are used to mark the first data type table as the first connection table and the second data type as the second connection table if one of the first data table and the second data table is a first data type table and the other data table is a second data type table.
[0117] The first splicing table and the second splicing table acquisition module is used to mark the data table with fewer null values as the first splicing table and mark the data table with more null values as the second splicing table if both the first data table and the second data table are first data type tables.
[0118] Specifically, the device also includes:
[0119] The target data table acquisition module is used to acquire the target data table.
[0120] The target data table information acquisition module is used to obtain the memory occupied by the target data table, the number of fields in the target data table, and the sum of the number of field values under all fields in the target data table.
[0121] The determination module is used to determine whether the target data table is a first data type table or a second data type based on the memory occupied by the target data table, the number of fields in the target data table, and the sum of the number of field values under all fields in the target data table.
[0122] Specifically, the determination module includes:
[0123] The target normalized memory acquisition module is used to normalize the memory occupied by the target data table and obtain the target normalized memory.
[0124] The target normalized field quantity acquisition module is used to normalize the number of fields in the target data table and obtain the target normalized field quantity.
[0125] The target normalized field value quantity and acquisition module is used to normalize the quantity and field values of all fields in the target data table to obtain the target normalized field value quantity and the target normalized field value quantity.
[0126] The target data table determination module is used to determine whether the target data table is a first data type table or a second data type based on the target normalized memory, the target normalized field quantity and the target normalized field value quantity.
[0127] Among them, the target data table determination module includes:
[0128] The target normalization and value acquisition module is used to obtain the sum of the target normalization memory, the number of target normalization fields, and the number and value of target normalization fields, which is recorded as the target normalization and value.
[0129] A preset large table score determination module is used to determine the target data table as a first data type table if the target normalized sum value is greater than the preset first data type table score; otherwise, the target data table is determined as a second data type.
[0130] Furthermore, the device further comprises:
[0131] A connection field acquisition module is used to obtain the same fields of the first connection table and the second connection table and record them as connection fields, and obtain a first connection field value list under the connection field of the first connection table and a second connection field value list under the connection field of the second connection table, wherein the first connection field value list contains a plurality of first connection field values, and the second connection field value list contains a plurality of second connection field values.
[0132] The connection Bloom filter acquisition module is used to create a connection Bloom filter of the second connection field value list based on the number of the second connection field values and the number of the first connection field values.
[0133] The target field value list acquisition module is used to traverse the first connection field value list, use the first connection field value to search in the connection Bloom filter, if not found, delete the first connection field value in the first connection field value list, and obtain the intersection of the deleted first connection field value list and the second connection field value list as the target field value list.
[0134] The target connection table acquisition module is used to connect the first connection table and the second connection table based on the target field value list to obtain the target connection table.
[0135] The connection Bloom filter acquisition module also includes:
[0136] The module for obtaining the number of elements inserted in the connection Bloom filter is used to use the number of first connection field values as the number of elements inserted in the connection Bloom filter.
[0137] The false alarm rate acquisition module of the connection Bloom filter is used to use the ratio of the number of the second connection field value to the number of the first connection field value as the false alarm rate of the connection Bloom filter.
[0138] A connection bloom filter module is created, which is used to create a connection bloom filter for the second connection field value list based on the number of inserted elements of the connection bloom filter and the false alarm rate of the connection bloom filter.
[0139] Specifically, creating a connection Bloom filter module also includes:
[0140] The module for obtaining the number of connected hash functions is used to obtain the length of the bit array and the number of connected hash functions based on the number of inserted elements of the connected Bloom filter and the false alarm rate of the connected Bloom filter.
[0141] The preset hash function list acquisition module is used to acquire a preset hash function list, wherein the preset hash function list includes preset hash functions of the number of connected hash functions.
[0142] The connection Bloom filter mapping module is used to map each second connection field value to a second connection hash value through each preset hash function, and set the value of the corresponding position of the bit array to "1" based on the second connection hash value, so as to obtain the connection Bloom filter of the second connection field value list.
[0143] An embodiment of the present invention further provides a non-transitory computer-readable storage medium, which can be set in an electronic device to store at least one instruction or at least one program for implementing a method in a method embodiment, and the at least one instruction or the at least one program is loaded and executed by the processor to implement the following steps:
[0144] S009: Obtain a first concatenation table and a second concatenation table, wherein the number of null values in the first concatenation table is less than the number of null values in the second concatenation table.
[0145] S010, obtain the same field mark of the first splicing table and the second splicing table as the splicing field, and obtain the first splicing field value list under the splicing field of the first splicing table and the second splicing field value list under the splicing field of the second splicing table, wherein the first splicing field value list contains several first splicing field values, and the second splicing field value list contains several second splicing field values.
[0146] S020: Create a concatenated Bloom filter for the second concatenated field value list based on the number of the second concatenated field values and a preset false alarm rate.
[0147] S030, traverse the first spliced field value list, use the first spliced field value to search in the spliced Bloom filter, if not found, delete the first spliced field value in the first spliced field value list, and obtain the intersection of the second spliced field value list and the deleted first spliced field value list as the specified field value list.
[0148] S040: Based on the specified field value list, connect the first concatenation table and the second concatenation table to obtain a specified connection table.
[0149] An embodiment of the present invention further provides an electronic device, comprising a processor and the aforementioned non-transitory computer-readable storage medium.
[0150] Although some specific embodiments of the present invention have been described in detail by way of example, it will be appreciated by those skilled in the art that the above examples are for illustration only and are not intended to limit the scope of the present invention. It will also be appreciated by those skilled in the art that various modifications may be made to the embodiments without departing from the scope and spirit of the present invention. The scope of the present invention is defined by the appended claims.
Claims
1. A data table connection method, characterized in that: The method comprises: Obtain a first concatenation table and a second concatenation table, wherein the number of null values in the first concatenation table is less than the number of null values in the second concatenation table; Obtain the same field marks of the first splicing table and the second splicing table as splicing fields, and obtain a first splicing field value list under the splicing field of the first splicing table and a second splicing field value list under the splicing field of the second splicing table, wherein the first splicing field value list includes a plurality of first splicing field values, and the second splicing field value list includes a plurality of second splicing field values; Creating a concatenated Bloom filter for the second concatenated field value list based on the number of the second concatenated field values and a preset false alarm rate; Traverse the first concatenated field value list, use the first concatenated field value to search in the concatenated Bloom filter, if not found, delete the first concatenated field value from the first concatenated field value list, and obtain the intersection of the second concatenated field value list and the first concatenated field value list after deletion as the specified field value list; Based on the specified field value list, the first concatenated table and the second concatenated table are connected to obtain a specified connection table.
2. The data table connection method according to claim 1, characterized in that: Based on the number of second concatenated field values and a preset false alarm rate, creating a concatenated Bloom filter for the second concatenated field value list specifically includes: The number of the second concatenated field values is used as the number of inserted elements; Get the preset false alarm rate; A concatenated Bloom filter of the second concatenated field value list is created based on the number of inserted elements and a preset false positive rate.
3. The data table connection method according to claim 2, characterized in that: The preset false alarm rate is obtained based on the data volume of the second splicing table.
4. The data table connection method according to claim 2, characterized in that: The step of creating a spliced Bloom filter of the second spliced field value list based on the number of inserted elements and the preset false alarm rate specifically includes: Obtain a specified hash function list, the specified hash function list including an intermediate number of specified hash functions, the intermediate number being obtained based on the number of inserted elements and a preset false alarm rate; Each second splicing field value is mapped to a second splicing hash value through each specified hash function, and the value of the corresponding position of the bit array is set to "1" based on the second splicing hash value, so as to obtain a splicing Bloom filter.
5. The data table connection method according to claim 1, characterized in that: Traverse the first concatenated field value list and use the first concatenated field value to search in the concatenated Bloom filter, specifically including: Each first splicing field value is mapped to a first splicing hash value through each preset hash function, and it is determined whether the first hash value is "0" at a corresponding position of the splicing Bloom filter.
6. The data table connection method according to claim 1, characterized in that: Obtain the first and second concatenation tables by following the steps below: Get the first data table and the second data table to be joined; Determine, based on a data table type determination method, that the first data table and the second data table are first data type tables or second data type tables; If the first data table and the second data table are both tables of the first data type, the data table with fewer null values is marked as the first concatenated table, and the data table with more null values is marked as the second concatenated table.
7. The data table connection method according to claim 6, characterized in that: The data table type determination method is: Get the target data table; Get the memory occupied by the target data table, the number of fields in the target data table, and the sum of the field values under all fields in the target data table; Based on the memory occupied by the target data table, the number of fields of the target data table, and the sum of the number of field values under all fields of the target data table, it is determined whether the target data table is a first data type table or a second data type table.
8. A data table connection device, characterized in that: The device comprises: A first splicing table and a second splicing table acquisition module, used to acquire the first splicing table and the second splicing table, wherein the number of null values in the first splicing table is less than the number of null values in the second splicing table; A splicing field acquisition module, used to acquire the same field marks of the first splicing table and the second splicing table as the splicing field, and acquire a first splicing field value list under the splicing field of the first splicing table and a second splicing field value list under the splicing field of the second splicing table, wherein the first splicing field value list includes a plurality of first splicing field values, and the second splicing field value list includes a plurality of second splicing field values; A spliced Bloom filter creation module, used to create a spliced Bloom filter of the second spliced field value list based on the number of second spliced field values and a preset false alarm rate; A designated field value list acquisition module is used to traverse the first spliced field value list, use the first spliced field value to search in the spliced Bloom filter, if not found, delete the first spliced field value in the first spliced field value list, and obtain the intersection of the second spliced field value list and the first spliced field value list after deletion as the designated field value list; A designated connection table acquisition module is used to traverse the first splicing field value list, use the first splicing field value to search in the splicing Bloom filter, if not found, delete the first splicing field value in the first splicing field value list, and obtain the intersection of the second splicing field value list and the deleted first splicing field value list as the designated field value list.
9. A non-transitory computer-readable storage medium, wherein at least one instruction or at least one program is stored in the storage medium, characterized in that: The at least one instruction or the at least one program is loaded and executed by the processor to implement the data table connection method as described in any one of claims 1-7.
10. An electronic device, characterized in that: The invention comprises a processor and the non-transitory computer-readable storage medium as claimed in claim 9.
