Data upgrading method and device, data query method and device
By upgrading online tables through the generation of binary numerical values and field values, the problem of existing technologies being unable to distinguish data from multiple sources is solved, enabling convenient data upgrades and queries while reducing costs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BAIDU (CHINA) CO LTD
- Filing Date
- 2023-04-10
- Publication Date
- 2026-04-24
AI Technical Summary
Existing technologies cannot distinguish between multiple data sources when entering data from various sources into online tables by incrementally adding enumeration values, resulting in limited application scope and failing to meet the needs of downstream business users for aggregating data from multiple sources.
By determining the fields to be upgraded, the field identifier set, and the number of entities in the initial online table, binary values are generated and converted into field values to create an upgraded online table. The field values and identifier set are then sent to the business side for querying, thus enabling the differentiation of data from multiple sources.
Downstream business users can easily query and upgrade data in the online table without modifying additional logic code or adding fields, improving the convenience of data upgrade operations and saving costs.
Smart Images

Figure CN116431652B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer application technology, and to the field of big data technology, specifically to a data upgrade method and apparatus, a data query method and apparatus, an electronic device, a computer-readable medium, and a computer program product. Background Technology
[0002] When entering data from multiple different sources into a specific field in an online table, the old identifier field is usually upgraded to an incremental enumeration value to distinguish the data from different sources. Downstream business units need to pay attention to the logic of using the old source identifier field to distinguish the data source. This data upgrade method is only applicable to mutually exclusive traffic sources (one piece of data belongs to only one source). If downstream business units need to aggregate data from multiple sources, it is not possible to distinguish them by adding an incremental enumeration value, which has a large limitation on its scope of use. Summary of the Invention
[0003] A data upgrade method and apparatus, a data query method and apparatus, an electronic device, a computer-readable storage medium, and a computer program product are provided.
[0004] According to the first aspect, a data upgrade method is provided, which includes: determining the field to be upgraded in the initial online table, the field identifier set of the field to be upgraded, and the number of entities in the entity set represented by the field identifier set; obtaining the binary value of the field to be upgraded based on the entity set, the number of entities, and the field identifier set; obtaining the field value of the field to be upgraded based on the binary value; obtaining the upgraded online table based on the field value and the initial online table; and sending the upgraded online table, the field value, and the field identifier set to the business party so that the business party can query the upgraded online table based on the field identifier set and the field value to obtain the query results.
[0005] According to the second aspect, a data query method is provided, which includes: receiving an online upgrade table and field identifiers and field values of fields to be upgraded in the online upgrade table, wherein the online upgrade table, the set of field identifiers, and the field values are obtained through a data upgrade method of any implementation of the first aspect; and querying the online upgrade table based on the set of field identifiers and the field values to obtain query results for the corresponding fields to be upgraded.
[0006] According to a third aspect, a data upgrade apparatus is provided, comprising: a determining unit configured to determine a field to be upgraded in an initial online table, a field identifier set of the field to be upgraded, and the number of entities in the entity set represented by the field identifier set; a value obtaining unit configured to obtain a binary value of the field to be upgraded based on the entity set, the number of entities, and the field identifier set; a field obtaining unit configured to obtain a field value of the field to be upgraded based on the binary value; a table obtaining unit configured to obtain an upgraded online table based on the field value and the initial online table; and a sending unit configured to send the upgraded online table, the field value, and the field identifier set to a business party, so that the business party can query the upgraded online table based on the field identifier set and the field value to obtain query results.
[0007] According to the fourth aspect, a data query apparatus is provided, the apparatus comprising: a data receiving unit configured to receive an online upgrade table and field identifiers and field values of fields to be upgraded in the online upgrade table, wherein the online upgrade table, the set of field identifiers, and the field values are obtained through a data upgrade apparatus of any implementation of the third aspect; and a query unit configured to query the online upgrade table based on the set of field identifiers and the field values to obtain query results for the corresponding fields to be upgraded.
[0008] According to a fifth aspect, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform a method as described in any implementation of the first or second aspect.
[0009] According to a sixth aspect, a non-transitory computer-readable storage medium is provided that stores computer instructions for causing a computer to perform the method as described in any implementation of the first or second aspect.
[0010] According to a seventh aspect, a computer program product is provided, including a computer program that, when executed by a processor, implements the method as described in either the first or second aspect.
[0011] The data upgrade method and apparatus provided in the embodiments of this disclosure first determine the field to be upgraded, the field identifier set of the field to be upgraded, and the number of entities in the entity set represented by the field identifier set in the initial online table; secondly, based on the entity set, the number of entities, and the field identifier set, obtain the binary value of the field to be upgraded; thirdly, based on the binary value, obtain the field value of the field to be upgraded; fourthly, based on the field value and the initial online table, obtain the upgraded online table; finally, send the upgraded online table, field value, and field identifier set to the business party so that the business party can query the upgraded online table based on the field identifier set and the field value to obtain the query result. Therefore, when upgrading the initial online table, the binary value is obtained based on the entity represented by the field identifier and the number of entities, and the binary value is converted into the field value. Only the field identifier of the field to be upgraded needs to be modified, without modifying additional logic code or adding additional fields. Furthermore, the downstream business party only needs to obtain the field value to query the corresponding field identifier in the field to be upgraded, improving the convenience of data upgrade operations and saving data upgrade costs.
[0012] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0013] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:
[0014] Figure 1 This is a flowchart of one embodiment of the data upgrade method according to this disclosure;
[0015] Figure 2 This is a flowchart of one embodiment of the data query method according to this disclosure;
[0016] Figure 3 This is a schematic diagram of a structure of an embodiment of the data upgrade device according to the present disclosure;
[0017] Figure 4 This is a schematic diagram of the structure of one embodiment of the data query device according to the present disclosure;
[0018] Figure 5 This is a block diagram of an electronic device used to implement the data upgrade method or data query method of the embodiments of this disclosure. Detailed Implementation
[0019] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0020] In this embodiment, "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined with "first" and "second" may explicitly or implicitly include at least one of those features.
[0021] Initially, an online table only provided traffic differentiation functionality (e.g., using the `is_lu` field). As business grew, new identifiers were needed, such as distinguishing between split-screen traffic and user growth traffic. Since this online table doesn't support directly adding fields (it doesn't support adding primary keys), the existing traffic functionality fields needed to be upgraded. This was achieved by upgrading the old identifier field to an incrementing enumeration value to differentiate data from different sources. Downstream users need to pay attention to the logic of using the old source identifier field to differentiate data sources. For example, if downstream users use data from source A11, they directly use the source identifier field equal to A11. The main drawback of this traditional solution is its limited scope; it only applies to situations where traffic sources are mutually exclusive (one piece of data belongs to only one source). However, if downstream users need to aggregate data from multiple sources, differentiation cannot be achieved by simply adding an incrementing enumeration value. For example, if downstream users need total consumption data belonging to both source A11 (entity) and source B11, and a piece of data belongs to both sources, directly retrieving consumption data from A11 and B11 using the old source identifier field would result in a statistically inflated consumption figure.
[0022] This disclosure provides a data upgrade method applicable to scenarios where specific fields in an initial online table can be modified to allow the entry of data from multiple sources without requiring any operations from downstream business parties or adding any new fields. Figure 1 A flow 100 of an embodiment of the data upgrade method according to this disclosure is shown, the data upgrade method comprising the following steps:
[0023] Step 101: Determine the fields to be upgraded, the field identifier set of the fields to be upgraded, and the number of entities in the entity set represented by the field identifier set in the initial online table.
[0024] In this embodiment, the initial online table is a data table that can change field identifiers and field values of field identifiers in real time. The fields to be upgraded are the fields in the initial online table whose field identifiers need to be expanded. If the field identifiers of the current initial online table cannot meet the actual field requirements, the field identifiers need to be expanded to obtain the upgraded online table.
[0025] In this embodiment, the field identifier set of the field to be upgraded includes multiple field identifiers. Each field identifier is an identifier that represents the scope of one or more entities. The scope of an entity can be a scope that includes one or more entities, or it can be a scope that does not include one or more entities. For example, in the field identifier set, one field identifier represents that it belongs to both entity 1 and entity 2, or another field identifier represents that it does not belong to either entity 1 or entity 2. An entity is the basic subject in the online table. An entity is something that can exist independently in the online table and serves as the basis and origin of all attributes. When it is necessary to expand the online table, the entities that need to be added can be determined first, and then the field identifiers that need to be added can be determined for the added entities.
[0026] In this embodiment, the field identifier set of the field to be upgraded represents multiple entities, including: an initial entity and an added entity. The initial entity is the original entity in the initial online table, and the added entity is the entity to be added to the initial online table. In this embodiment, the field identifier in the field identifier set of the field to be upgraded can be an identifier representing one type of entity, in which case the field identifier only has the entity meaning of that type of entity; or the field identifier can be an identifier representing two types of entity ranges, in which case the field identifier has the entity meaning of more than two types of entities. For example, field identifier A12 refers to an identifier that belongs to both entity A1 and entity A2, or field identifier C is an identifier that belongs only to entity C.
[0027] In this embodiment, the field identifier set includes multiple field identifiers, each of which represents the range of different entities. The entity set of the field identifier set is obtained by collecting all the different entities represented by the field identifiers in the field identifier set.
[0028] In this embodiment, the number of entities refers to the number of entities represented by the field identifier set. Some field identifiers of the fields to be upgraded represent only one type of entity, while others represent multiple types of entities. For example, the field identifiers include: Field Identifier 1, Field Identifier 2, and Field Identifier 3. Among them, Field Identifier 1 represents entity 1, Field Identifier 2 represents entity 2, and Field Identifier 3 represents both entity 1 and entity 2. Statistically, the entity set corresponding to the field identifier set has entity 1 and entity 2, that is, two entities. Therefore, the number of entities corresponding to the field identifier set is 2.
[0029] Step 102: Based on the entity set, the number of entities, and the field identifier set, obtain the binary value of the field to be upgraded.
[0030] In this embodiment, the number of bits in the binary value of the field to be upgraded is determined by the number of entities. For example, if there are two entities, the number of bits in the binary value of the field to be upgraded is two bits; if there are three entities, the number of bits in the binary value of the field to be upgraded is three bits.
[0031] In this embodiment, each field identifier in the field identifier set corresponds to a corresponding binary value, and each bit of the binary value corresponds to an entity. Step 102 specifically includes: determining the number of bits in the binary value to be generated based on the number of entities; allocating one bit of the binary value to each entity in the entity set; for each field identifier in the field identifier set, determining the binary value corresponding to the field identifier based on the range of entities represented by the field identifier; and setting preset binary data for the bits corresponding to the entity in the binary value, where the preset binary data is 0 or 1, the binary value refers to a binary data sequence, and the length of the binary data sequence is the number of entities.
[0032] Step 103: Based on the binary value, obtain the field value of the field to be upgraded.
[0033] In this embodiment, the field to be upgraded in the initial online table has its corresponding field type, which is an integer type, including Smallint, Mediumint, Int, and Bigint. After obtaining the binary value, each digit of the binary value is multiplied by a power of 2, and the results are added to obtain the field value of the corresponding field to be upgraded.
[0034] In this embodiment, the field value is a numerical value of the same type as the field to be upgraded. If the field type is an integer, then the field value is a decimal value.
[0035] Step 104: Based on the field values and the initial online table, obtain the upgraded online table.
[0036] In this embodiment, the upgraded online table is a table obtained by expanding the fields to be upgraded in the initial online table. For example, the initial identifier set of the fields to be upgraded in the initial online table is (c), and the field identifier set of the fields to be upgraded in the upgraded online table is (efg). Compared with the initial online table, the number of field identifiers is greater than the number of initial identifiers, and the number of entities represented by the field identifiers is greater than the number of entities represented by the initial identifiers.
[0037] In this embodiment, step 104 includes: determining the actual form-filling requirements; determining the field values to be filled based on the actual form-filling requirements; and filling the field values to be filled into the field value area corresponding to the field to be upgraded in the initial online table to expand the field to be upgraded, thus obtaining an upgraded online table. Compared to the initial online table, the upgraded online table updates the field identifiers and their field values while maintaining compatibility with the entities in the initial online table. This makes the scope of entities represented by the field identifiers broader and improves the diversity of information represented by the fields to be upgraded.
[0038] Step 105: Send the upgrade online table, field values, and field identifier set to the business party so that the business party can query the upgrade online table based on the field identifier set and field values to obtain the query results.
[0039] In this embodiment, the business party is a downstream terminal that uses the upgrade online table. By querying the upgrade online table, it can obtain the data information within it. Since the field identifier set represents the scope of two or more entities, after obtaining the field identifier set, the business party can determine the entity scope represented by each field identifier in the set, thereby determining the field identifier to be queried. Further, based on the obtained field values, it determines the field value of the field identifier to be queried; it then queries the upgrade online table for the field identifier with the same field value as the field identifier to be queried, thus obtaining the content of the upgrade online table corresponding to the field identifier to be queried.
[0040] The data upgrade method provided in this disclosure first determines the field to be upgraded, the field identifier set of the field to be upgraded, and the number of entities in the entity set represented by the field identifier set in the initial online table. Second, based on the entity set, the number of entities, and the field identifier set, the binary value of the field to be upgraded is obtained. Third, based on the binary value, the field value of the field to be upgraded is obtained. Fourth, based on the field value and the initial online table, an upgraded online table is obtained. Finally, the upgraded online table, field values, and field identifier set are sent to the business party, enabling the business party to query the upgraded online table based on the field identifier set and field value to obtain query results. Therefore, when upgrading the initial online table, binary values are obtained based on the entities represented by the field identifiers and the number of entities, and these binary values are converted into field values. Only the field identifiers of the fields to be upgraded need to be modified; no additional logic code or additional fields need to be added. Furthermore, downstream business parties only need to obtain the field values to query the corresponding field identifiers in the fields to be upgraded, improving the convenience of data upgrade operations and saving data upgrade costs.
[0041] In some optional implementations of this embodiment, the above-mentioned field identifier set includes multiple field identifiers, and the above-mentioned entity set includes multiple entities. Based on the entity set, the number of entities, and the field identifier set, obtaining the binary value of the field to be upgraded includes: determining a sequence of identifier bits with a fixed length based on the number of entities; assigning each identifier bit in the identifier bit sequence to each entity based on the order in which the entities in the entity set are obtained, so that each identifier bit in the identifier bit sequence represents the corresponding entity; for each field identifier, determining the number of bit identifiers of the field identifier based on the identifier bit sequence, and making the corresponding identifier bits in all the bit identifiers of the field identifier preset binary data to obtain the binary value corresponding to the field identifier, wherein the bit identifiers are represented using bit data type.
[0042] In this embodiment, the number of entities is the number of entities represented by the field identifier set. When the field identifier set includes multiple field identifiers, the number of entities is the number of entities corresponding to all field identifiers. The fixed length of the identifier bit sequence is the same as the number of entities.
[0043] In this embodiment, a bit identifier is a binary value identifier that identifies a field value through a bit data type. A bit identifier has at least two identifier bits, and a binary value is obtained by setting corresponding binary data for each identifier bit.
[0044] In this embodiment, the identifier sequence includes multiple identifier bits. The identifier sequence is used to locate the position of each identifier bit in the identifier, so that each identifier bit has the same positional relationship as each identifier bit in the identifier sequence.
[0045] In this embodiment, the identifier bit sequence corresponds to each bit identifier, and each bit identifier has an identifier bit corresponding to the identifier bit sequence. After each entity in the entity represented by the field to be upgraded corresponds to the identifier bit in the identifier bit sequence, the identifier bit of each bit identifier also corresponds to each entity, used to identify each entity. For example, if the identifier bit sequence is (ab), for a field identifier, its bit identifier is: 01 11. This field identifier has two bit identifiers, each of which adopts the (ab) format. The zeroth identifier bit of this field identifier corresponds to the entity represented by the field identifier, and this bit identifier is set to 1.
[0046] In this embodiment, the entities in the entity set of the field to be upgraded can be entities that need to be added to the online table to expand the online table, based on the original entities in the initial online table. The original entities are obtained earlier than the entities that need to be added. For example, the original entities in the initial online table are entity E. In order to modify the field to be upgraded, entity F needs to be added based on the original entities. Therefore, entity F is obtained later than entity E.
[0047] In this embodiment, the bit identifier is an identifier identified by a bit data type. Bit data types have two possible values: 0 and 1, and are 1 bit long. When a value other than 0 is input, the system treats it as 1. This data type is commonly used as a logical variable to represent binary choices such as true, false, OR, or no.
[0048] In this embodiment, the preset binary data can be either 0 or 1. After obtaining the binary value of the first field identifier, the corresponding preset binary data can be determined. All field identifiers, upon obtaining their binary values, need to have the preset binary data assigned to their corresponding identifier bits. For example, the field identifier set includes a first field identifier and a second field identifier. The first field identifier is assigned a 1 to the identifier bit of the entity corresponding to it, resulting in the binary value of the first field identifier. Similarly, the second field identifier also needs to be assigned a 1 to the identifier bit of the entity corresponding to it, resulting in the binary value of the second field identifier.
[0049] The method for determining binary values provided in the embodiments of this disclosure first determines the identifier bit sequence based on the number of entities, and then assigns each identifier bit in the identifier bit sequence to each entity based on the order in which the entities in the entity set are obtained. The identifier bit of each field identifier is determined through the identifier bit sequence, and a preset binary value is assigned to the corresponding identifier bit of the identifier bit to obtain the binary value of each field identifier. This provides an optional implementation method for obtaining the field value of each subfield identifier.
[0050] Optionally, the aforementioned field identifier set includes multiple field identifiers, and the aforementioned entity set includes multiple entities. Based on the number of entities and the field identifier set, obtaining the binary value of the field to be upgraded includes: determining a sequence of identifier bits with a fixed length based on the number of entities; sorting all entities in the entity set, and assigning each identifier bit in the identifier bit sequence to each entity in turn based on the sorting order of each entity, so that each identifier bit in the identifier bit sequence represents the corresponding entity; for each field identifier, determining the number of bit identifiers of that field identifier based on the identifier bit sequence, and setting the corresponding identifier bits in all bit identifiers of that field identifier to preset binary data, thereby obtaining the binary value corresponding to that field identifier.
[0051] Optionally, the above-mentioned field identifier set includes multiple field identifiers, the above-mentioned entity set includes multiple entities, and the above-mentioned obtaining the binary value of the field to be upgraded based on the number of entities and the field identifier set includes: pre-setting the correspondence between the entity, the identifier bit, and each field identifier in the field identifier set so that each field identifier has a corresponding bit identifier, and the identifier bits in the bit identifier correspond one-to-one with the entities in the entity set; determining the number of bit identifiers of the field identifier based on the number of entities, entities, and each field identifier, and making the corresponding identifier bits in all the bit identifiers of the field identifier preset binary data to obtain the binary value corresponding to the field identifier.
[0052] In some optional implementations of this embodiment, the above-mentioned determination of the number of bit identifiers of each field identifier based on the identifier bit sequence, and setting the corresponding identifier bits of all bit identifiers of the field identifier to preset binary data to obtain the binary value corresponding to the field identifier includes: for each field identifier, in response to the field identifier representing an entity, determining that there are multiple bit identifiers of the field identifier through the identifier bit sequence, assigning preset binary data to the identifier bits of the multiple bit identifiers corresponding to the entity, and obtaining the binary value corresponding to the field identifier.
[0053] In this optional implementation, the field identifier can be an identifier representing one entity or an identifier representing multiple entities. For example, if a field identifier is characterized as belonging only to entity E, then the entity represented by the field identifier is one, and the field identifier has one entity meaning.
[0054] In this optional implementation, the bit identifier is represented by a bit data type. Each bit of the bit identifier can be 0 or 1. When there are multiple bit identifiers for a field identifier, all bit identifiers except those representing the entity of the field identifier have been assigned the values 0 and 1.
[0055] The following is an explanation using specific examples:
[0056] The entity set includes entity E and entity F. The field identifier set has two field identifiers. One field identifier represents entity E (entity E corresponds to the first bit of the identifier bit sequence, and entity F corresponds to the second bit of the identifier bit sequence). This field identifier has multiple bit identifiers, namely (1b) and (0b). The b in the multiple bit identifiers is assigned the preset binary data 1. Then the binary values corresponding to this field identifier are 11 and 01 respectively.
[0057] This optional implementation provides a method for determining binary values. In a field identifier representing an entity, the method determines that there are multiple bit identifiers for the field identifier through the identifier bit sequence. The method assigns preset binary data to the corresponding bit of the entity among the multiple bit identifiers to obtain the binary value corresponding to the field identifier. This provides a reliable way to obtain the binary value of the field identifier and also makes the obtained binary data compatible with field identifiers with different entity meanings, ensuring the difference between different field identifiers.
[0058] In some optional implementations of this disclosure, for each subfield identifier, based on the identifier bit sequence, the number of bit identifiers for that field identifier is determined, and the corresponding identifier bits in all the bit identifiers of that field identifier are set to preset binary data, resulting in the following binary value corresponding to that field identifier:
[0059] For each field identifier, in response to the fact that the field identifier represents multiple entities, the identifier of the field identifier is determined by the identifier bit sequence. The corresponding identifier bit of the entity in the identifier is assigned the preset binary data to obtain the binary value corresponding to the field identifier.
[0060] The following is an explanation using specific examples:
[0061] The entity set includes entity E and entity F. The field identifier set has two field identifiers. One field identifier represents entity E and entity F (entity E corresponds to the first bit of the identifier bit sequence, and entity F corresponds to the second bit of the identifier bit sequence). This field identifier has one bit identifier, which is (ab). If the bit identifier 'a' is assigned the preset binary data 1 and the bit identifier 'b' is assigned the preset binary data 1, then the binary values corresponding to this field identifier are 11.
[0062] In this optional implementation, the field identifier representing multiple entities means that the field identifier can involve multiple entities at the same time. For example, if a field identifier belongs to both entity E and entity F, then the field identifier represents two entities and has the meaning of two entities.
[0063] The optional implementation provides a method for determining binary values. In a field identifier that represents multiple entities, the method determines that there is only one identifier bit in the field identifier by using the identifier bit sequence. The corresponding identifier bit of the entity in the identifier is assigned a preset binary data value to obtain the binary value corresponding to the field identifier. This provides a reliable implementation method for obtaining the binary value of the field identifier and also makes the obtained binary data compatible with field identifiers that have only one entity meaning, thus ensuring the difference between different field identifiers.
[0064] In some embodiments of this disclosure, the above-described allocation of each identifier bit in the identifier bit sequence to each entity based on the order in which the entities in the entity set are obtained includes: for the entity obtained first in the entity set, allocating the least significant bit of the identifier bit sequence to the entity obtained first, so that the least significant bit corresponds to the entity obtained first; for the entity obtained in the middle of the entity set, allocating the middle significant bit of the identifier bit sequence to the entity obtained in the middle, so that the middle significant bit corresponds to the entity obtained in the middle; and for the entity obtained last in the entity set, allocating the most significant bit of the identifier bit sequence to the entity obtained last, so that the most significant bit corresponds to the entity obtained last.
[0065] In this embodiment, the identifier bit sequence is used to represent the position information of each identifier bit in the bit identifier. Once the identifier bit sequence is determined, the number of bit identifiers corresponding to each entity is determined accordingly. Since a bit identifier is an identifier represented by a bit data type, after the identifier bits of the bit identifier correspond to the entity, by assigning preset binary data to the identifier bits corresponding to each entity, the bit identifier can fully represent the field identifier.
[0066] In this embodiment, the entities in the entity set can be added sequentially according to the tabulation requirements of the executing entity. After obtaining the entities at the current time, the time of obtaining each entity in the entity set is analyzed to determine the order of the entities. For entities obtained at the same time in the entity set, an identifier bit can be randomly assigned to each entity obtained at the same time.
[0067] The identifier allocation method provided in this embodiment allocates the least significant bit of the identifier sequence to the first entity obtained, the middle bit of the identifier sequence to the intermediate entities obtained in the middle, and the most significant bit of the identifier sequence to the last entity obtained. This provides a reliable way to allocate identifiers reasonably and improves the reliability of data upgrades.
[0068] Optionally, the above-mentioned allocation of each identifier bit in the identifier bit sequence to each entity based on the chronological order of each entity in the entity set includes: determining the time points of each entity in the entity set, determining the chronological order of the time points based on the time points; randomly sorting the order of the time points for entities with the same time point, and allocating the identifier bits in the identifier bit sequence in sequence according to the position of the time points in the time point sequence.
[0069] In one example, the entity set can be a collection representing the data source, and the field identifiers in the field identifier set represent the range of different entities. The entity set specifically includes: a first source and a second source that is obtained after the first source in a time lag. The above-mentioned assignment of each identifier bit in the identifier bit sequence to each entity based on the order in which the entities in the entity set are obtained, so that each identifier bit in the identifier bit sequence represents the corresponding entity, includes: assigning the zeroth identifier bit of the identifier bit sequence to the first source; and assigning the first identifier bit of the identifier bit sequence to the second source.
[0070] The above-mentioned determination of the number of bit identifiers for each field identifier based on the identifier bit sequence, and setting the corresponding identifier bits in all the bit identifiers of the field identifier to preset binary data to obtain the binary value corresponding to the field identifier includes: For the first field identifier related to the first source, the identifier bit sequence determines that the first field identifier has two bit identifiers, and the first bit of both first field identifiers is assigned to 1. At this time, the second bit of one of the two first field identifiers is 1, and the second bit of the other field identifier is 0, thus obtaining the binary value of the first field identifier; For the second field identifier related to the second source, the identifier bit sequence determines that the second field identifier has two bit identifiers, and the second bit of both second field identifiers is assigned to 1. At this time, the first bit of one of the two second field identifiers is 1, and the first bit of the other field identifier is 0, thus obtaining the binary value of the second source identifier.
[0071] Specifically, for the online table to be upgraded whose data source is the field to be upgraded, the field identifier set under the data source field to be upgraded has five field identifiers T1 to T5. Each field identifier represents a different entity range, as shown in Table 1. The entity includes first source A and second source B. Second source B lags behind first source A. First source A is the original entity of the initial online table, and second source B is the added entity of the upgraded online table. In Table 1, each identifier bit in the bit identifier is represented by binary bits. Bit identifiers are assigned to each entity from low bit to high bit (from right to left), and the query conditions for the field value of each field identifier can be obtained through AND operation.
[0072] Data source Field values (tags) Bit ID Query conditions T1 (derived from A) 1,3 01,11 tags&1=1 T2 (not derived from A) 0,2 00,10 tags&1=0 T3 (derived from B) 2,3 10,11 tags&2=2 T4 (not derived from B) 0,1 00,01 tags&2=0 T5 (derived from both A and B) 3 11 tags&3=3 T6 (neither derived from A nor from B) 0 00 tags&3=0
[0073] In this embodiment, only the table field names need to be modified, without modifying any additional logic code. Downstream users hardly need to make any changes. New business users can retrieve the corresponding field values according to the query conditions as needed to obtain the table content of the upgraded online table for the queried field values, thus reducing the cost of online table upgrades.
[0074] In some embodiments of this disclosure, the data upgrade method further includes: detecting whether the data type of the field to be upgraded is an integer type; in response to detecting that the data type of the field to be upgraded is an integer type, determining the number of bytes corresponding to the integer type; detecting whether the number of bytes is greater than the number of entities; in response to the number of bytes being greater than the number of entities, obtaining the binary value of the field to be upgraded based on the entity set, the number of entities, and the field identifier set.
[0075] The data upgrade method provided in this embodiment includes: determining the field to be upgraded in the initial online table, the field identifier set of the field to be upgraded, and the number of entities in the entity set represented by the field identifier set; detecting whether the data type of the field to be upgraded is an integer type; in response to detecting that the data type of the field to be upgraded is an integer type, determining the number of bytes corresponding to the integer type; detecting whether the number of bytes is greater than the number of entities; in response to the number of bytes being greater than the number of entities, obtaining the binary value of the field to be upgraded based on the entity set, the number of entities, and the field identifier set; obtaining the field value of the field to be upgraded based on the binary value; obtaining the upgraded online table based on the field value and the initial online table; and sending the upgraded online table, field value, and field identifier set to the business party so that the business party can query the upgraded online table based on the field identifier set and field value to obtain the query results.
[0076] In this embodiment, the conversion between binary values and integer values is the most effective. For integer fields to be upgraded, the data upgrade method disclosed herein is also the most effective. Therefore, limiting the fields to be upgraded to integer types can provide a reliable basis for expanding the field identifiers of the fields to be upgraded.
[0077] In this embodiment, the integer type can be any one of Smallint, Mediumint, Int, and Bigint. The byte ranges corresponding to Smallint, Mediumint, Int, and Bigint are completely different; for example, Smallint corresponds to two bytes, Mediumint to three bytes, Int to four bytes, and Bigint to eight bytes. If the determined number of entities is less than or equal to the number of bytes of the integer type field to be upgraded, then the process of obtaining the binary value of the field to be upgraded can proceed.
[0078] Optionally, if the number of bytes is less than the number of entities, the data upgrade process is terminated and no binary value is obtained.
[0079] The data upgrade method provided in this embodiment first determines the data type of the field to be upgraded before obtaining the binary value. If the data type is an integer, the number of bytes of the integer type is determined. If the number of bytes is greater than the number of entities, the binary value of the field to be upgraded is obtained based on the entity set, the number of entities, and the field identifier set, thus ensuring the reliability of the obtained binary value.
[0080] In some embodiments of this disclosure, after sending the upgrade online table, field values, and field identifier set to the business party, the above data upgrade method further includes: receiving the addition identifier of the field to be upgraded; updating the entity quantity based on the entity represented by the addition identifier, and obtaining a new binary value based on the updated entity set, the updated entity quantity, the addition identifier, and the field identifier set; obtaining the field value of the field to be upgraded based on the new binary value; obtaining a re-upgrade table based on the field value of the field to be upgraded and the upgrade online table; and sending the addition identifier, the field value of the addition identifier, and the re-upgrade table to the business party, so that the business party can query the re-upgrade table based on the addition identifier, the field identifier set, and the field value of the addition identifier to obtain the query result of the corresponding field to be upgraded.
[0081] In this embodiment, an additional identifier is added to characterize the entities in the upgraded online table and the identifiers of the added entity range. The updated entity set is equal to the entity set corresponding to the upgraded online table and the added entities. The updated entity count is equal to the entity count of the upgraded online table plus the number of added entities.
[0082] Based on the updated entity set, the updated number of entities, the added identifier, and the field identifier set, the new binary value is obtained by: determining a new identifier bit sequence of fixed length based on the updated number of entities; assigning each identifier bit in the new identifier bit sequence to each entity based on the order in which the entities in the updated entity set were obtained, so that each identifier bit in the new identifier bit sequence represents the corresponding entity; for each field identifier in the new field identifier set obtained from the field identifier set and the added identifier, based on the identifier bit sequence, determining the number of bit identifiers for that field identifier, and setting the corresponding identifier bits in all bit identifiers of that field identifier to preset binary data, thereby obtaining the binary value corresponding to that field identifier.
[0083] In this embodiment, field values correspond to field identifiers. Each field identifier in the new field identifier set is obtained from the field identifier set and the added identifier, and each field identifier corresponds to a field value. After obtaining the field values of the new field identifier set, the field values of the added identifiers can be obtained accordingly. Sending the added identifiers and their field values to the business side allows the business side to perform detailed queries on the added identifiers, improving the efficiency of querying fields to be upgraded.
[0084] This disclosure provides a data query method suitable for scenarios where specific fields in an initial online table can be modified to allow data from multiple sources to be entered without requiring any operations from downstream business parties or adding any new fields. Figure 2 A flow 200 is shown as an embodiment of the data query method according to this disclosure, the data query method including the following steps:
[0085] Step 201: Receive the upgrade online table and the field identifier and field value of the field to be upgraded in the upgrade online table.
[0086] In this embodiment, the upgrade online table is a data table that can change field identifiers and field values of field identifiers in real time. By receiving the field identifiers of the upgrade online table, the range of entities corresponding to the field identifiers in the field to be upgraded can be determined; by the field values, the specific values of the entities corresponding to each field identifier in the field to be upgraded can be determined.
[0087] In this embodiment, the upgraded online table, field identifier set, and field values are obtained by upgrading the initial online table using the data upgrade method described in the above embodiment.
[0088] Step 202: Based on the field identifier set and field value, query the online upgrade table to obtain the query results for the corresponding fields to be upgraded.
[0089] In this embodiment, the field identifier set includes at least two field identifiers. Each field identifier represents the scope of an entity, and the field value is the value of each field identifier in the field type of the field to be upgraded. The entity scope can be determined through the field identifiers in the field identifier set, thus enabling the business party to clearly identify the entity to be queried. After determining the entity to be queried, the field value corresponding to that entity is selected from the field values, and the field value is queried from the online upgrade table to obtain the query results for the field to be upgraded corresponding to the scope of the entity to be queried.
[0090] In this embodiment, step 202 includes: determining the field identifier to be queried based on the field identifier set; determining the field value of the field identifier to be queried based on the field identifier and the field value; detecting the field value in the upgrade online table that is the same as the field value of the field identifier to be queried, obtaining the table content containing only the field identifier to be queried, and using the table content as the query result of the field to be upgraded.
[0091] The data query method provided in this disclosure first receives an online upgrade table and the field identifiers and field values of the fields to be upgraded in the online upgrade table; finally, it queries the online upgrade table based on the set of field identifiers and field values to obtain the query results for the corresponding fields to be upgraded. Thus, downstream business units can query the corresponding field identifiers in the fields to be upgraded using the obtained field identifier values, improving the convenience of data querying.
[0092] When querying the online upgrade table, if the field value of the field identifier to be queried is directly used as the query condition, the resulting query results with the field identifier to be queried only contain the table content of the field identifier to be queried, and cannot comprehensively query all related entities in the field identifier to be queried. In some optional implementations of this embodiment, the above-mentioned querying the online upgrade table based on the field identifier set and field value to obtain the query result for the corresponding field to be upgraded includes: determining the field identifier to be queried corresponding to the query condition from the field identifier set; determining the field value corresponding to the field identifier to be queried based on the field identifier to be queried; performing a bitwise AND operation between the field value of the field to be upgraded in the online upgrade table and the field value of the field identifier to be queried to obtain the bitwise AND operation result of the field identifier in the field to be upgraded; and using the operation result as the query result for the corresponding field to be upgraded.
[0093] In this embodiment, the field value of the field to be upgraded in the online table is ANDed with the field value of the field identifier to be queried. The result of the AND operation on the field identifier in the field to be upgraded can be either the field value of the field identifier to be queried or zero. If the preset binary data assigned to the bit identifier corresponding to the entity represented by the field identifier to be queried is 1, then the result of the AND operation is the field value of the field identifier to be queried; if the preset binary data assigned to the bit identifier corresponding to the entity represented by the field identifier to be queried is 0, then the result of the AND operation is zero.
[0094] As shown in Table 1, downstream businesses can use a bitwise AND operation to determine whether a record belongs to a specified source (first source A or second source B) by checking if the corresponding bit is 1 (or 0). Table 1 uses two entities, first source A and second source B, as examples. If data that is neither first source A nor second source B is needed (the first and second bits of the corresponding field identifier are both 0), performing a bitwise AND operation with `tags` (3 and `tags`) will result in a value of 0. If the result is 0, it means the last two bits of `tags` are 00, indicating that it is neither A nor B. The same logic applies to other field identifiers to be queried.
[0095] This optional implementation provides a method for obtaining query results that effectively avoids duplicate data statistics when downstream users access mutually exclusive data sources after a bitwise AND operation is performed between the field value of the field to be upgraded and the field value of the field identifier to be queried. For example, if a field identifier to be queried belongs to both entity A and entity B, setting the field value of the field identifier to the value of the field with the query field identifier will prevent duplicate statistics when downstream users directly perform a bitwise AND operation between the field values of all field identifiers in the field to be upgraded in the online table and the field value of the field identifier to be queried.
[0096] Further reference Figure 3As an implementation of the data upgrade method shown in the above figures, this disclosure provides an embodiment of a data upgrade device, which is similar to... Figure 1 Corresponding to the method embodiments shown, this device can be specifically applied to various electronic devices.
[0097] like Figure 3 As shown, the data upgrade device 300 provided in this embodiment includes: a field determination unit 301, a value acquisition unit 302, a field acquisition unit 303, a table acquisition unit 304, and a sending unit 305. The field determination unit 301 can be configured to determine the field to be upgraded, the field identifier set of the field to be upgraded, and the number of entities in the entity set represented by the field identifier set in the initial online table. The value acquisition unit 302 can be configured to obtain the binary value of the field to be upgraded based on the entity set, the number of entities, and the field identifier set. The field acquisition unit 303 can be configured to obtain the field value of the field to be upgraded based on the binary value. The table acquisition unit 304 can be configured to obtain the upgraded online table based on the field value and the initial online table. The sending unit 305 can be configured to send the upgraded online table, field value, and field identifier set to the business party, so that the business party can query the upgraded online table based on the field identifier set and field value to obtain query results.
[0098] In this embodiment, the specific processing and technical effects of the data upgrade device 300, including the field determination unit 301, the value acquisition unit 302, the field acquisition unit 303, the table acquisition unit 304, and the sending unit 305, can be found in the following references: Figure 1 The relevant descriptions of steps 101, 102, 103, 104, and 105 in the corresponding embodiments will not be repeated here.
[0099] In some optional implementations of this embodiment, the aforementioned field identifier set includes multiple field identifiers, the aforementioned entity set includes multiple entities, and the value obtaining unit 302 includes: a bit identifier module (not shown in the figure), an allocation module (not shown in the figure), and a value determining module (not shown in the figure). The aforementioned bit identifier module can be configured to determine a fixed-length identifier bit sequence based on the number of entities. The aforementioned allocation module can be configured to allocate each identifier bit in the identifier bit sequence to each entity based on the order in which the entities in the entity set are obtained, so that each identifier bit in the identifier bit sequence represents the corresponding entity. The aforementioned value determining module can be configured to, for each field identifier, determine the number of bit identifiers for that field identifier based on the identifier bit sequence, and set the corresponding identifier bits in all bit identifiers of that field identifier to preset binary data to obtain the binary value corresponding to that field identifier, where the bit identifiers are represented using bit data types.
[0100] In some optional implementations of this embodiment, the above-mentioned value determination module is further configured to: for each field identifier, in response to the field identifier representing an entity, determine that there are multiple bit identifiers of the field identifier through the identifier bit sequence, assign preset binary data to the corresponding bit of the entity among the multiple bit identifiers, and obtain the binary value corresponding to the field identifier.
[0101] In some optional implementations of this embodiment, the above-mentioned value determination module is further configured to: for each field identifier, in response to the field identifier representing multiple entities, determine that there is one bit identifier of the field identifier through the identifier bit sequence, assign the corresponding identifier bit of the entity in the bit identifier to preset binary data, and obtain the binary value corresponding to the field identifier.
[0102] In some optional implementations of this embodiment, the allocation module is further configured to: allocate the least significant bit of the identifier bit sequence to the first entity obtained in the entity set, so that the least significant bit corresponds to the first entity obtained; allocate the middle bit of the identifier bit sequence to the middle entity obtained in the entity set, so that the middle bit corresponds to the middle entity obtained; and allocate the most significant bit of the identifier bit sequence to the last entity obtained in the entity set, so that the most significant bit corresponds to the last entity obtained.
[0103] In some optional implementations of this embodiment, the device 300 further includes: a type detection unit (not shown in the figure), a number determination unit (not shown in the figure), and a quantity detection unit (not shown in the figure). The type detection unit can be configured to detect whether the data type of the field to be upgraded is an integer type. The number determination unit can be configured to determine the number of bytes corresponding to the integer type in response to detecting that the data type of the field to be upgraded is an integer type. The quantity detection unit can be configured to detect whether the number of bytes is greater than the number of entities; and when the number of bytes is greater than the number of entities, to control the value obtaining unit to operate.
[0104] In some optional implementations of this embodiment, the apparatus 300 further includes: an identifier receiving unit (not shown in the figure), an update unit (not shown in the figure), a new value obtaining unit (not shown in the figure), an upgrade unit (not shown in the figure), and a distribution unit (not shown in the figure). The identifier receiving unit can be configured to receive the added identifier of the field to be upgraded. The update unit can be configured to update the entity count based on the entity represented by the added identifier, and obtain a new binary value based on the updated entity set, the updated entity count, the added identifier, and the field identifier set. The new value obtaining unit can be configured to obtain the field value of the field to be upgraded based on the new binary value. The upgrade unit can be configured to obtain a re-upgrade table based on the field value of the field to be upgraded and the upgrade online table. The distribution unit can be configured to send the added identifier, the field value of the added identifier, and the re-upgrade table to the business party, so that the business party can query the re-upgrade table based on the added identifier, the field value of the added identifier, and the field identifier set to obtain the query result for the corresponding field to be upgraded.
[0105] The data upgrade apparatus provided in the embodiments of this disclosure firstly involves a field determination unit 301 determining the field to be upgraded, the field identifier set of the field to be upgraded, and the number of entities in the entity set represented by the field identifier set in the initial online table. Secondly, a value obtaining unit 302 obtains the binary value of the field to be upgraded based on the entity set, the number of entities, and the field identifier set. Thirdly, a field obtaining unit 303 obtains the field value of the field to be upgraded based on the binary value. Fourthly, a table obtaining unit 304 obtains the upgraded online table based on the field value and the initial online table. Finally, a sending unit 305 sends the upgraded online table, field value, and field identifier set to the business party, enabling the business party to query the upgraded online table based on the field identifier set and field value to obtain the query result. Thus, when upgrading the initial online table, a binary value is obtained based on the entity represented by the field identifier and the number of entities, and the binary value is converted into a field value. Only the field identifier of the field to be upgraded needs to be modified; no additional logic code needs to be modified, and no additional fields need to be added. Furthermore, the downstream business party only needs to obtain the field value to query the corresponding field identifier in the field to be upgraded, improving the convenience of data upgrade operations and saving data upgrade costs.
[0106] Further reference Figure 4 As an implementation of the data query methods shown in the above figures, this disclosure provides an embodiment of a data query device, which is similar to... Figure 2 Corresponding to the method embodiments shown, this device can be specifically applied to various electronic devices.
[0107] like Figure 4As shown, the data query device 400 provided in this embodiment includes: a data receiving unit 401 and a query unit 402. The data receiving unit 401 can be configured to receive an online upgrade table and field identifiers and field values of fields to be upgraded in the online upgrade table. The online upgrade table, field identifier set, and field values are obtained through the data upgrade device described in this embodiment. The query unit 402 can be configured to query the online upgrade table based on the field identifier set and field values to obtain query results for the corresponding fields to be upgraded.
[0108] In this embodiment, the specific processing of the data receiving unit 401 and the query unit 402 in the data query device 400 and the resulting technical effects can be referred to respectively. Figure 2 The relevant descriptions of steps 201 and 202 in the corresponding embodiments will not be repeated here.
[0109] In some optional implementations of this embodiment, the query unit 402 is further configured to: determine the field identifier to be queried corresponding to the query condition from the field identifier set; determine the field value corresponding to the field identifier to be queried based on the field identifier to be queried; perform a bitwise AND operation between the field value of the field to be upgraded in the upgrade online table and the field value of the field identifier to be queried to obtain the bitwise AND operation result of the field identifier in the field to be upgraded; and use the operation result as the query result of the corresponding field to be upgraded.
[0110] The collection, storage, use, processing, transmission, provision, and disclosure of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0111] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0112] Figure 5 A schematic block diagram of an example electronic device 500 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0113] like Figure 5As shown, device 500 includes a computing unit 501, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 502 or a computer program loaded into random access memory (RAM) 503 from storage unit 508. RAM 503 may also store various programs and data required for the operation of device 500. The computing unit 501, ROM 502, and RAM 503 are interconnected via bus 504. Input / output (I / O) interface 505 is also connected to bus 504.
[0114] Multiple components in device 500 are connected to I / O interface 505, including: input unit 506, such as keyboard, mouse, etc.; output unit 507, such as various types of monitors, speakers, etc.; storage unit 508, such as disk, optical disk, etc.; and communication unit 509, such as network card, modem, wireless transceiver, etc. Communication unit 509 allows device 500 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0115] The computing unit 501 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 501 performs the various methods and processes described above, such as data upgrade methods or data query methods. For example, in some embodiments, the data upgrade method or data query method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 508. In some embodiments, part or all of the computer program may be loaded and / or installed on device 500 via ROM 502 and / or communication unit 509. When the computer program is loaded into RAM 503 and executed by the computing unit 501, one or more steps of the data upgrade method or data query method described above may be performed. Alternatively, in other embodiments, the computing unit 501 may be configured to perform a data upgrade method or a data query method by any other suitable means (e.g., by means of firmware).
[0116] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0117] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to the processor or controller of a general-purpose computer, special-purpose computer, or other programmable data upgrade or data query device, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0118] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0119] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0120] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0121] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other.
[0122] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0123] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A data upgrade method, the method comprising: Determine the fields to be upgraded in the initial online table, the field identifier set of the fields to be upgraded, and the number of entities in the entity set represented by the field identifier set; Based on the entity set, the number of entities, and the field identifier set, the binary value of the field to be upgraded is obtained; Based on the binary value, the field value of the field to be upgraded is obtained; Based on the field values and the initial online table, an upgraded online table is obtained; The upgrade online table, the field values, and the field identifier set are sent to the business party so that the business party can query the upgrade online table based on the field identifier set and the field values to obtain the query results; The query results are obtained through the following steps: Receive the addition identifier of the field to be upgraded; Based on the entities represented by the added identifier, the number of entities is updated, and a new binary value is obtained based on the updated entity set, the updated number of entities, the added identifier, and the field identifier set; Based on the new binary value, the field value of the field to be upgraded is obtained; Based on the field values of the fields to be upgraded and the online upgrade table, a re-upgrade table is obtained; Send the added identifier, the field value of the added identifier, and the upgrade table to the business party so that the business party can query the upgrade table based on the added identifier, the field identifier set, and the field value of the added identifier to obtain the query result corresponding to the field to be upgraded; The binary value of the field to be upgraded is obtained through the following steps: Check whether the data type of the field to be upgraded is an integer type; In response to detecting that the data type of the field to be upgraded is an integer type, the number of bytes corresponding to the integer type is determined; Detect whether the number of bytes is greater than the number of entities; In response to the fact that the number of bytes is greater than the number of entities, the binary value of the field to be upgraded is obtained based on the entity set, the number of entities, and the field identifier set.
2. The method according to claim 1, wherein, The field identifier set includes multiple field identifiers, the entity set includes multiple entities, and obtaining the binary value of the field to be upgraded based on the entity set, the number of entities, and the field identifier set includes: Based on the number of entities, a sequence of identifier bits with a fixed length is determined; Based on the order in which the entities in the entity set are obtained, each identifier bit in the identifier bit sequence is assigned to each entity so that each identifier bit in the identifier bit sequence represents the corresponding entity; For each field identifier, based on the identifier bit sequence, the number of bit identifiers for that field identifier is determined, and the corresponding identifier bits in all the bit identifiers of that field identifier are preset binary data to obtain the binary value corresponding to that field identifier. The bit identifiers are represented using bit data types.
3. The method according to claim 2, wherein, For each field identifier, based on the identifier bit sequence, the number of bit identifiers for that field identifier is determined, and the corresponding identifier bits in all the bit identifiers of that field identifier are set to preset binary data, to obtain the binary value corresponding to that field identifier, including: For each field identifier, in response to the field identifier representing an entity, the number of bit identifiers of the field identifier is determined by the identifier bit sequence. The corresponding bit of the entity in the multiple bit identifiers is assigned a preset binary data value to obtain the binary value corresponding to the field identifier.
4. The method according to claim 2, wherein, For each field identifier, based on the identifier bit sequence, the number of bit identifiers for that field identifier is determined, and the corresponding identifier bits in all the bit identifiers of that field identifier are set to preset binary data, to obtain the binary value corresponding to that field identifier, including: For each field identifier, in response to the field identifier representing multiple entities, the identifier bit sequence determines that there is one bit identifier for the field identifier, and the corresponding identifier bit of the entity in the bit identifier is assigned preset binary data to obtain the binary value corresponding to the field identifier.
5. The method according to claim 2, wherein, The step of assigning each identifier bit in the identifier bit sequence to each entity based on the order obtained from the entities in the entity set includes: For the first entity obtained in the entity set, the least significant bit of the identifier bit sequence is assigned to the first entity obtained, so that the least significant bit corresponds to the first entity obtained. For an entity obtained intermediately from the entity set, the middle bit of the identifier bit sequence is assigned to the intermediate entity so that the middle bit corresponds to the intermediate entity; For the last entity obtained in the entity set, the highest bit of the identifier bit sequence is assigned to the last obtained entity so that the highest bit corresponds to the last obtained entity.
6. A data query method, the method comprising: The system receives an online upgrade table and the field identifiers and field values of the fields to be upgraded in the online upgrade table, wherein the online upgrade table, the set of field identifiers, and the field values are obtained by the data upgrade method according to any one of claims 1-5. Based on the field identifier set and the field value, query the upgrade online table to obtain the query result corresponding to the field to be upgraded.
7. The method according to claim 6, wherein, The step of querying the online upgrade table based on the field identifier set and the field value to obtain the query result corresponding to the field to be upgraded includes: From the set of field identifiers, determine the field identifier to be queried that corresponds to the query condition; Based on the field identifier to be queried, determine the field value corresponding to the field identifier to be queried; Perform a bitwise AND operation between the field value of the field to be upgraded in the online upgrade table and the field value of the field identifier to be queried, and obtain the bitwise AND operation result of the field identifier in the field to be upgraded; The result of the operation is used as the query result for the corresponding field to be upgraded.
8. A data upgrade apparatus, the apparatus comprising: The field determination unit is configured to determine the field to be upgraded in the initial online table, the field identifier set of the field to be upgraded, and the number of entities in the entity set represented by the field identifier set; The numerical value obtaining unit is configured to obtain the binary value of the field to be upgraded based on the entity set, the number of entities, and the field identifier set; The field obtaining unit is configured to obtain the field value of the field to be upgraded based on the binary value; The table obtains a unit, which is configured to obtain an upgraded online table based on the field values and the initial online table; The sending unit is configured to send the upgrade online table, the field values, and the field identifier set to the business party, so that the business party can query the upgrade online table based on the field identifier set and the field values to obtain the query results; The device further includes: The identifier receiving unit is configured to receive the added identifier of the field to be upgraded; The update unit is configured to update the entity count based on the entity represented by the added identifier, and obtain a new binary value based on the updated entity set, the updated entity count, the added identifier, and the field identifier set; The new value acquisition unit is configured to obtain the field value of the field to be upgraded based on the new binary value; The upgrade unit is configured to obtain a re-upgrade table based on the field value of the field to be upgraded and the upgrade online table; The distribution unit is configured to send the addition identifier, the field value of the addition identifier, and the upgrade table to the business party, so that the business party can query the upgrade table based on the addition identifier, the field value of the addition identifier, and the field identifier set to obtain the query result corresponding to the field to be upgraded; The device further includes: The type detection unit is configured to detect whether the data type of the field to be upgraded is an integer type; The number determination unit is configured to determine the number of bytes corresponding to the integer type in response to detecting that the data type of the field to be upgraded is an integer type; The quantity detection unit is configured to detect whether the number of bytes is greater than the number of entities; and when the number of bytes is greater than the number of entities, control the value obtaining unit to work.
9. The apparatus according to claim 8, wherein, The field identifier set includes multiple field identifiers, the entity set includes multiple entities, and the value acquisition unit includes: The bit identifier module is configured to determine a sequence of identifier bits of fixed length based on the number of entities. The allocation module is configured to allocate each identifier bit in the identifier bit sequence to each entity based on the order obtained from the entities in the entity set, so that each identifier bit in the identifier bit sequence represents the corresponding entity; The value determination module is configured to determine the number of bit identifiers of each field identifier based on the identifier bit sequence, and set the corresponding identifier bits of all bit identifiers of the field identifier to preset binary data to obtain the binary value corresponding to the field identifier. The bit identifiers are represented using bit data types.
10. The apparatus according to claim 9, wherein, The value determination module is further configured to: for each field identifier, in response to the field identifier representing an entity, determine that there are multiple bit identifiers of the field identifier through the identifier bit sequence, assign preset binary data to the identifier bits of the multiple bit identifiers that correspond to the entity, and obtain the binary value corresponding to the field identifier.
11. The apparatus according to claim 9, wherein, The value determination module is further configured to: for each field identifier, in response to the field identifier representing multiple entities, determine that there is one bit identifier for the field identifier through the identifier bit sequence, assign the corresponding identifier bit of the entity in the bit identifier to preset binary data, and obtain the binary value corresponding to the field identifier.
12. The apparatus according to claim 9, wherein, The allocation module is further configured to: allocate the least significant bit of the identifier sequence to the first entity obtained in the entity set, so that the least significant bit corresponds to the first entity obtained; allocate the middle significant bit of the identifier sequence to the middle entity obtained in the entity set, so that the middle significant bit corresponds to the middle entity obtained; and allocate the most significant bit of the identifier sequence to the last entity obtained in the entity set, so that the most significant bit corresponds to the last entity obtained.
13. A data query device, the device comprising: The data receiving unit is configured to receive an online upgrade table and field identifiers and field values of fields to be upgraded in the online upgrade table, wherein the online upgrade table, the set of field identifiers, and the field values are obtained by the data upgrade device according to any one of claims 8-12; The query unit is configured to query the online upgrade table based on the field identifier set and the field value to obtain the query result corresponding to the field to be upgraded.
14. The apparatus according to claim 13, wherein, The query unit is further configured to: determine the field identifier to be queried corresponding to the query condition from the field identifier set; determine the field value corresponding to the field identifier to be queried based on the field identifier to be queried; perform a bitwise AND operation between the field value of the field to be upgraded in the upgrade online table and the field value of the field identifier to be queried to obtain the bitwise AND operation result of the field identifier in the field to be upgraded; and use the operation result as the query result corresponding to the field to be upgraded.
15. An electronic device, characterized in that, include: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-7.
16. A non-transitory computer-readable storage medium storing computer instructions, characterized in that, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-7.
17. A computer program product comprising a computer program that, when executed by a processor, implements the method of any one of claims 1-7.
Citation Information
Patent Citations
Data retrieval method and device
CN110321363A