Data processing method and device based on row logical sequence number, equipment, medium and product

By introducing a combination of weight value list and sequence number value to calculate the row logical sequence number, the performance loss problem caused by inserting non-tail row data in the existing technology is solved, and efficient row logical sequence number maintenance and table data processing are achieved.

CN120448384BActive Publication Date: 2026-11-06SHANGHAI DAMENG DATABASE
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510522467.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-24
Publication Date
2026-11-06
Estimated Expiration
2045-04-24

AI Technical Summary

Technical Problem

When inserting non-tail row data into an existing table, it is necessary to increment the logical sequence number of all rows, resulting in severe performance loss, especially when the data volume is large, leading to low maintenance efficiency.

Method used

A list of weight values ​​is used, with weights being integer powers of 2, arranged in descending order. The row logical number is calculated by combining the serial number and the subscript of the weight value. Only the serial number and the subscript of the weight value of the inserted row are updated, while the logical numbers of other rows remain unchanged.

Benefits of technology

It simplifies the maintenance process of row logical numbers, improves the performance of table data processing, and reduces the performance overhead of maintaining row logical numbers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120448384B_ABST
    Figure CN120448384B_ABST
Patent Text Reader

Abstract

The application discloses a data processing method and device based on row logical sequence numbers, equipment, medium and products. The method comprises the following steps: determining the row logical sequence number corresponding to each row in a table; inserting or deleting row data in the table according to the row logical sequence number corresponding to each row, and determining the row logical sequence number of the inserted row; the weight values in the weight value list corresponding to the table are arranged in descending order and are powers of 2, and the minimum weight value is 1; the sequence number value corresponding to each row is a specific designed integer after calculation; each row corresponds to a corresponding weight value index sequence number; the row logical sequence number corresponding to any row is the product of the sequence number value corresponding to the row and the weight value corresponding to the row. The row logical sequence numbers of the rows in the table are designed by using the sequence number value and the weight value, the row logical sequence number of the changed row is determined when the data is changed, and the row logical sequence numbers of other rows do not need to be updated, so that the maintenance of the row logical sequence numbers is simplified, and the table data processing performance is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, and in particular to a method, apparatus, device, medium and product for processing data based on row logical sequence numbers. Background Technology

[0002] In data display and analysis, tables are a widely used graphical component. Common user operations on tables include querying, inserting, deleting, and modifying data, with deletion and modification requiring the target data to be retrieved first. Therefore, efficient querying of table data is an essential function. When a table contains a large number of rows, data querying and maintenance become more time-consuming, and lag is more likely to occur during actual use. To achieve efficient row data retrieval, a logical row number is typically generated when inserting row data to uniquely identify and track that row. This logical row number is unique and ordered within the table, allowing for binary search based on the row logical number, thus greatly improving search efficiency.

[0003] Currently, the common row logical numbers used in tables are sequentially selected from an auto-incrementing sequence with an initial value of 0 and a step size of 1. Assuming a table has 5 rows of data, the row logical numbers would be 0, 1, 2, 3, and 4. When inserting a row at the end, a logical number "5" needs to be generated for the new row; when inserting a row outside the last row, the logical number of the inserted row corresponds to the logical number of the row at the insertion position, and the logical numbers of all subsequent rows are incremented by 1. For example, when inserting a new row of data between the third row and the third row in the table, the logical index of the newly inserted row is taken as the logical index 2 of the old third row. After inserting this row, the logical index of all subsequent rows (starting from the old third row) is incremented by 1. At this time, the logical indexes of the 6 rows of data in the table are 0 (the original row's logical index is 0, which remains unchanged), 1 (the original row's logical index is 1, which remains unchanged), 2 (the newly inserted row), 3 (the original row's logical index is 2, which is incremented by 1), 4 (the original row's logical index is 3, which is incremented by 1), 5 (the original row's logical index is 4, which is incremented by 1), and 6 (the original row's logical index is 5, which is incremented by 1).

[0004] As can be seen from the above examples, the current method of generating logical row numbers in tables has a drawback: inserting data into a row other than the last row in the table will cause the logical row numbers of all rows after the inserted row to be incremented. When the amount of data in the table is large, maintaining the logical row numbers also requires a lot of calculations, which is very performance-intensive. Summary of the Invention

[0005] This application provides a method, apparatus, device, medium, and product for processing data based on row logical sequence numbers, so as to simplify the maintenance of row logical sequence numbers and improve the performance of table data processing.

[0006] In a first aspect, embodiments of this application provide a method for processing data based on row logical sequence numbers, including:

[0007] Determine the row logical number corresponding to each row in the table;

[0008] Insert or delete row data in the table according to the row logical number corresponding to each row, and determine the row logical number of the inserted row;

[0009] The table corresponds to a list of weight values, where the weight values ​​in the list are integer powers of 2, and the weight values ​​in the list are arranged in descending order, with the smallest weight value being 1. The corresponding weight value index is an integer that starts from 0 and increases sequentially.

[0010] The serial number of each row in the table is a calculated integer; each row corresponds to a weight value index, which indicates the position of the weight value in the weight value list corresponding to the corresponding row.

[0011] The row logical number corresponding to any row is the product of the row's corresponding number value and the row's corresponding weight value.

[0012] Secondly, embodiments of this application also provide a data processing device based on row logical sequence numbers, including:

[0013] The row logical number determination module is used to determine the row logical number corresponding to each row in the table;

[0014] The data processing module is used to insert or delete row data in the table according to the row logical number corresponding to each row, and to determine the row logical number of the inserted row;

[0015] The table corresponds to a list of weight values, where the weight values ​​in the list are integer powers of 2, and the weight values ​​in the list are arranged in descending order, with the smallest weight value being 1. The corresponding weight value index is an integer that starts from 0 and increases sequentially.

[0016] The serial number of each row in the table is a calculated integer; each row corresponds to a weight value index, which indicates the position of the weight value in the weight value list corresponding to the corresponding row.

[0017] The row logical number corresponding to any row is the product of the row's corresponding number value and the row's corresponding weight value.

[0018] Thirdly, embodiments of this application provide an electronic device, including:

[0019] One or more processors;

[0020] Storage device for storing one or more programs;

[0021] When the one or more programs are executed by the one or more processors, the one or more processors implement the data processing method based on row logical sequence numbers as described in the first aspect.

[0022] Fourthly, embodiments of this application also provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the data processing method based on row logical sequence numbers as described in the first aspect.

[0023] Fifthly, embodiments of this application also provide a computer program product, including a computer program and / or instructions, which, when executed by a processor, implement the data processing method based on row logical sequence numbers as described in any of the above embodiments.

[0024] This application provides a method, apparatus, device, medium, and product for processing data based on row logical sequence numbers. The method includes: determining the row logical sequence number corresponding to each row in a table; inserting or deleting row data in the table according to the row logical sequence number corresponding to each row, and determining the row logical sequence number of the inserted row; wherein the table corresponds to a weight value list, the weight values ​​in the weight value list are integer powers of 2, and the weight values ​​in the weight value list are arranged in descending order, with the smallest weight value being 1, and the corresponding weight value subscript numbers are integers starting from 0 and increasing sequentially; the sequence number corresponding to each row in the table is a calculated, specifically designed integer; each row corresponds to a corresponding weight value subscript number, which is used to indicate the position of the weight value corresponding to the corresponding row in the weight value list; the row logical sequence number corresponding to any row is the product of the corresponding sequence number value and the corresponding weight value of the row. The above technical solution uses sequence values ​​and weight values ​​to design the row logical sequence number of each row in the table. When the data is changed, the row logical sequence number is mainly determined for the row that is changed, without needing to update the row logical sequence numbers of other rows. This simplifies the maintenance of row logical sequence numbers and improves the performance of table data processing. Attached Figure Description

[0025] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.

[0026] Figure 1 A flowchart illustrating a data processing method based on row logical sequence numbers, provided in an embodiment of this application;

[0027] Figure 2 This is a schematic diagram of a process for determining a row logical sequence number, provided as an embodiment.

[0028] Figure 3 A schematic diagram of a data processing device based on row logical sequence number is provided for an embodiment of this application;

[0029] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0030] The present application will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the application and not intended to limit it. Furthermore, it should be noted that, for ease of description, the accompanying drawings show only the parts relevant to the present application, not the entire structure.

[0031] Before discussing the exemplary embodiments in more detail, it should be noted that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts describe the steps as sequential processes, many of these steps can be performed in parallel, concurrently, or simultaneously. Furthermore, the order of the steps can be rearranged. The process can be terminated when its operation is complete, but may also have additional steps not included in the figures. The process can correspond to a method, function, procedure, subroutine, subroutine, etc.

[0032] It should be noted that the concepts of "first" and "second" mentioned in the embodiments of this application are only used to distinguish different devices, modules, units or other objects, and are not used to limit the order of functions performed by these devices, modules, units or other objects or their interdependencies.

[0033] Furthermore, the embodiments and features described in this application may be combined with each other, unless otherwise specified.

[0034] The acquisition, storage, use, and processing of data in this application all comply with the relevant provisions of national laws and regulations.

[0035] It should be noted that in the embodiments of this application, certain software, components, models and other existing solutions in the industry may be mentioned. These should be regarded as exemplary and are only intended to illustrate the feasibility of implementing the technical solution of this application. However, it does not mean that the applicant has used or necessarily used the relevant content of the solution.

[0036] Figure 1This document provides a flowchart of a data processing method based on row logical sequence numbers, applicable to the processing of table data or row data. Specifically, this method can be executed by a data processing device based on row logical sequence numbers. This device can be implemented in software and / or hardware and integrated into an electronic device. The electronic device includes, but is not limited to, devices with computing capabilities such as computers, smartphones, or servers. It can also be a Central Processing Unit (CPU), a System-on-Chip (SoC) computer, a Field-Programmable Gate Array (FPGA), or a Micro Controller Unit (MCU).

[0037] like Figure 1 As shown, the method specifically includes the following steps:

[0038] S110. Determine the row logical number corresponding to each row in the table.

[0039] Here, the table can be understood as a table to be processed. The table usually contains at least one row of data, and each row has its own corresponding row logical number. The row logical numbers of each row are different and are arranged in ascending order. It should be noted that, in the embodiments of this application, it is not required that the row logical numbers of each row increase by the same step size.

[0040] The row logical numbers in this embodiment differ from those used in previous tables (i.e., they are not sequentially selected from an auto-incrementing sequence with an initial value of 0 and a step size of 1). Instead, a new method of value selection is employed. Specifically, a weight value list (denoted as id_weight_list) is introduced for the table. This weight value list can be understood as a list composed of the weight values ​​of the row logical numbers in the table. This weight value list contains at least one weight value (denoted as id_weight), each weight value is an integer power of 2, and the weight values ​​in the weight value list are arranged in descending order, with the smallest weight value being 1. For example, the weight value list may contain only one weight value, which is 1; or it may contain four weight values, namely 8, 4, 2, and 1.

[0041] Furthermore, to facilitate describing the position of weight values ​​in the weight value list and to uniquely identify and track weight values, a weight value index (denoted as id_weight_index) is introduced. The weight value (id_weight) is the value at the id_weight_index position in the weight list of the table, i.e., id_weight_list[id_weight_index]. The weight value indexes for each weight value in the weight value list are integers that start from 0 and increment sequentially. For example, if there is only one weight value in the weight value list, and that weight value is 1, the corresponding weight value index is 0; or if there are four weight values ​​in the weight value list, namely 8, 4, 2, and 1, the corresponding weight value indexes are 0, 1, 2, and 3, respectively.

[0042] Each row in the table has a corresponding serial number (denoted as id). Each serial number is a calculated, specifically designed integer. For an initial table, the serial numbers for each row can be sequentially incremented from 0. For example, if the table has 3 rows of data, the serial numbers for these 3 rows would be 0, 1, and 2, respectively. Each row also corresponds to a weight value index, which indicates the position of the weight value in the weight value list corresponding to the row.

[0043] It should be noted that the serial number value can be negative. For example, if a row is inserted before the first row in the table above, the serial number value of that row can be -1; similarly, if two rows are inserted before the first row, the serial numbers of those two rows can be -1 and -2 respectively. Furthermore, the serial numbers of each row can be non-adjacent, unequally spaced, not necessarily increasing, and there can be cases where different rows have the same serial number value. For example, if two rows of data are inserted between the first and second rows in the table above, the serial numbers of these two rows can be 1 and 2.

[0044] Based on the above, the row logical index of any row is the product of the index value and the weight value of the row. That is, the row logical index can be represented as id*id_weight or id*id_weight_list[id_weight_index].

[0045] As a reference example, the table contains 3 rows of data. The corresponding sequence number, weight index, weight value, and row logical number for each row are as follows:

[0046] Line 1: The sequence number is 0, the weight index is 0, the weight is 1, and the row logical sequence number is 0*1=0;

[0047] Line 2: The sequence number is 1, the weight index is 0, the weight is 1, and the line logical sequence number is 1*1=1;

[0048] Line 3: The sequence number is 2, the weight index is 0, the weight is 1, and the row logical sequence number is 2*1=2.

[0049] Therefore, the weight value can be understood as a parameter used to "weight" the sequence number value, which can represent the importance of the sequence number value to the final determined row logical sequence number.

[0050] It should be noted that the row logical sequence number determined by the sequence number value and weight value is unique for each row and in ascending order.

[0051] Furthermore, in the above example, as a known initial table, the importance of each row is consistent, so the weight value is 1, and the row logical number is consistent with the row number value. Based on this logic, when subsequently modifying the table, such as when inserting data, the existing row logical numbers do not need to be changed; instead, the row logical number of the inserted row needs to be determined. The value of the row logical number may not be consistent with the corresponding row number value.

[0052] S120. Insert or delete row data in the table according to the row logical number corresponding to each row, and determine the row logical number of the inserted row;

[0053] Based on the aforementioned row logical number retrieval logic, the performance overhead of maintaining row logical numbers is significantly reduced while ensuring their uniqueness and order. When modifying row data in a table, the index of the inserted row can be determined, and its corresponding weight value can be determined based on the index of the weight value. Then, its row logical number can be determined based on its index and weight value. This process primarily focuses on determining the row logical number of the row that has been modified, generally eliminating the need to update the row logical numbers of other rows. This reduces the workload of maintaining row logical numbers and improves data processing efficiency.

[0054] It should be noted that, in this embodiment of the application, when changing the row data in the table, the information and structure of the row logical sequence number can be maintained, but the calculated row logical sequence number value does not need to be recorded. Furthermore, the above method for determining the row logical sequence number is also applicable to other similar functional scenarios requiring unique and ordered logical sequence numbers.

[0055] In one embodiment, determining the row logical number corresponding to each row in the table includes:

[0056] Initialize the weight value list. The initial weight value list includes a weight value of 1. If there is data in the table, the corresponding index value of each row is taken from the auto-incrementing sequence with an initial value of 0 and a step size of 1. The index of the corresponding weight value of each row is 0, and the weight value of each row is 1.

[0057] As shown in the example above, the table contains 3 rows of data. The corresponding sequence number, weight index, weight value, and row logical number for each row are as follows:

[0058] Line 1: The sequence number is 0, the weight index is 0, the weight is 1, and the row logical sequence number is 0*1=0;

[0059] Line 2: The sequence number is 1, the weight index is 0, the weight is 1, and the line logical sequence number is 1*1=1;

[0060] Line 3: The sequence number is 2, the weight index is 0, the weight is 1, and the row logical sequence number is 2*1=2.

[0061] In one embodiment, inserting or deleting rows of data in a table according to the row logical number corresponding to each row, and determining the row logical number of the inserted row, includes: when the table is empty and n rows of data are inserted into the table, the serial number value corresponding to each inserted row is an integer that increments sequentially from 0, and the subscript number of the corresponding weight value of each inserted row is 0. For each inserted row, the row logical number of the inserted row is the product of the weight value corresponding to the subscript number of the weight value of the inserted row and the serial number value corresponding to the inserted row; where n is a positive integer.

[0062] For example, if the table has no data (i.e., the table is empty), when inserting n rows of data into the table, the sequence number of each inserted row is 0, 1, 2...n-1, the weight index of each inserted row is 0, the weight value is 1, and the row logical number is 0, 1, 2...n-1. Taking n=1 as an example, the sequence number (id) of the inserted row is 0, the weight index (id_weight_index) is 0, the weight value is 1, and the row logical number is 0*1=0. Taking n=2 as an example, the ids of the two inserted rows are 0 and 1 respectively, the weight indexes (id_weight_index) are both 0, the weight values ​​are both 1, and the row logical numbers are 0*1=0 and 1*1=1 respectively.

[0063] In one embodiment, changing the row data in the table according to the row logical number corresponding to each row and determining the row logical number of the inserted row includes: when inserting a row of data before the first row in the table, the value of the index corresponding to the inserted row is the original index value corresponding to the first row minus 1, the index of the weight value corresponding to the inserted row is the original index of the weight value corresponding to the first row, and the product of the weight value corresponding to the index of the weight value corresponding to the inserted row and the index value corresponding to the inserted row is used as the row logical number of the inserted row.

[0064] Specifically, if the table already contains data, the process of determining the logical row number of the inserted row when inserting a single row before the first row in the table is as follows:

[0065] The index (id) of the inserted row is taken as the id value of the original first row of data minus 1 (as in the reference example above, if the id value of the original first row of data is 0, then the index value of the inserted row is -1). The index of the weight value (id_weight_index) of the inserted row is taken as the id_weight_index of the original first row (as in the reference example above, if the id_weight_index of the original first row of data is 0, then the id_weight_index of the inserted row is 0). Therefore, the weight value of the inserted row is 1, and the row logical index value is -1*1 = -1.

[0066] In one embodiment, modifying the row data in the table according to the row logical number corresponding to each row and determining the row logical number of the inserted row includes: when inserting n rows of data into the first row of the table, inserting the n rows of data in reverse order; where n is an integer greater than 1; for each inserted row of data, the index value corresponding to the inserted row is the original index value corresponding to the first row minus 1, the subscript index of the corresponding weight value of the inserted row is the original subscript index of the corresponding weight value of the first row, and the product of the weight value corresponding to the subscript index of the corresponding weight value of the inserted row and the index value corresponding to the inserted row is used as the row logical number of the inserted row.

[0067] Specifically, if you want to insert data in batches before the first row of a table, for example, inserting n rows of data (n is an integer greater than 1), it is equivalent to inserting n rows of data before the first row of the table, one row at a time, and these n rows are inserted in reverse order. That is, the first insertion is to insert the nth row of n rows before the first row of the table, the second insertion is to insert the (n-1)th row of n rows before the first row of the table, and so on, and the last insertion is to insert the first row of n rows before the first row of the table.

[0068] In one embodiment, inserting or deleting row data in the table according to the row logical number corresponding to each row, and determining the row logical number of the inserted row, includes: when inserting n rows of data after the last row of the table, performing n operations to insert one row of data after the last row of the table; each operation to insert one row of data after the last row of the table includes: the value of the index corresponding to the inserted row is the original index corresponding to the last row plus 1, the index of the weight value corresponding to the inserted row is the original index of the weight value corresponding to the last row, and the product of the weight value corresponding to the index of the weight value corresponding to the inserted row and the index value corresponding to the inserted row is used as the row logical number of the inserted row; where n is a positive integer.

[0069] Specifically, if the table already contains data, inserting n rows of data after the last row is equivalent to inserting one row of data into the last row of the table n times. For each inserted row, the process of determining the logical index of the inserted row is as follows:

[0070] The id value of the inserted row is taken as the id value of the original first row plus 1 (as in the reference example above, the id value of the original last row is 2, so the id value of the inserted row is 3). The weight index of the inserted row is taken as the id_weight_index of the original last row (as in the reference example above, the id_weight_index of the original last row is 0, so the id_weight_index of the inserted row is 0). Therefore, the weight value of the inserted row is 1, and the row logical index value is 3*1=3.

[0071] If the table is empty, n rows of data are inserted at the end of the table. This is equivalent to inserting a single row into an empty table once and inserting a row into the last row of the table n-1 times. The process of determining the logical index of the inserted row for each insertion can be found in the example above. In this case, the index value corresponding to each inserted row is an integer starting from 0 and incrementing sequentially. The index of the corresponding weight value for each inserted row is 0. For each inserted row, the logical index is the product of the weight value corresponding to the index of the weight value and the index value of the inserted row.

[0072] In one embodiment, the row data in the table is changed according to the row logical number corresponding to each row, and the row logical number of the inserted row is determined, including: when inserting n rows of data before the x-th row in the table, the difference between the absolute value of the first row logical number and the absolute value of the second row logical number is determined, and the absolute value of the difference is taken. Since the x-th row is not the first row, the first row logical number is the row logical number of the (x-1)-th row, and the second row logical number is the original row logical number of the x-th row.

[0073] Based on the relationship between the absolute value minus 1 and n, determine the index value of the inserted row and the index number of the corresponding weight value of the inserted row. The product of the weight value corresponding to the index number of the inserted row and the index value of the inserted row is used as the row logical number of the inserted row; where n is a positive integer and the multiplier is n.

[0074] It should be noted that inserting row data before row x, where row x is not the first row, can be understood as inserting row data into the middle part of the table, thus excluding the two cases of inserting before the first row and after the last row.

[0075] When inserting a single row of data into the middle of a table, the process for determining the logical index of the inserted row is as follows:

[0076] Step A. Calculate the logical index values ​​of the rows before and after the inserted row. Assuming the position of the inserted row is insert_index, calculate the logical index value of the row at the original position of insert_index-1 (denoted as prev_id) and the logical index value of the row at the original position of insert_index (denoted as next_id);

[0077] Step B. Calculate the absolute value of the difference between the absolute value of next_id and the absolute value of prev_id (denoted as diff), that is, take the absolute value of next_id and the absolute value of prev_id, and subtract the smaller value from the larger value, i.e., diff = ||next_id| - |prev_id||.

[0078] Step C. Compare the absolute value minus 1 (i.e., diff-1, the purpose of subtracting 1 is to remove boundary values) with n. Based on this, further determine the sequence number of the inserted row and the corresponding weight index of the inserted row, thereby determining the corresponding weight value of the inserted row, and finally determining the row logical sequence number of the inserted row. Among them, the relationship between diff-1 and n can determine whether to trigger the expansion of the weight value list (including the expansion of existing weight values ​​and the addition of new weight values).

[0079] In one embodiment, the sequence number of the inserted row and the corresponding weight index of the inserted row are determined based on the relationship between the result of subtracting 1 from the absolute value and n. This includes: when the result of subtracting 1 from the absolute value is greater than or equal to n, for the i-th row to be inserted: the sequence number of the i-th row is the sum of the logical sequence number of the first row plus 1 and the i-th division point, wherein the i-th division point is obtained by dividing the result of subtracting 1 from the absolute value into n+1 equal parts, and the corresponding weight index of the i-th row is the length of the weight value list minus 1.

[0080] Based on steps A, B, and C, and assuming the result of subtracting 1 from the absolute value is greater than or equal to n (i.e., diff-1≥n), the process for determining the logical index of the inserted row for the i-th row is as follows:

[0081] If diff-1 ≥ n, the index (id) of the inserted row is taken from the corresponding division point of the (n+1)th division point of the logical index of the two rows before and after it. That is, the id of the i-th row is prev_id+1 + (diff-1)*i / (n+1), and (diff-1)*i / (n+1) is rounded down if it is not divisible. The index of the weight value of the inserted row (id_weight_index) is taken from the length of the weight value list id_weight_list minus 1, that is, its weight value is taken from the last weight value in the weight value list (i.e., the smallest weight value 1).

[0082] As an example, if n=1, the sequence number value (id) of the inserted row takes the intermediate value of the logical sequence numbers of the two rows before and after it, that is, prev_id+1+(diff-1) / 2, and when (diff-1) / 2 is not divisible, the result is rounded down.

[0083] In an embodiment, determining the sequence number value corresponding to the inserted row and the subscript sequence number of the corresponding weight value of the inserted row according to the magnitude relationship between the result of the taken absolute value minus 1 and n includes:

[0084] Let the multiplier (mul) be 1, and if the result of the taken absolute value minus 1 is less than n, double the absolute value and the multiplier respectively to obtain a new absolute value and a new multiplier;

[0085] If the result of the new absolute value minus 1 is less than n, the doubling operation is repeated on the new absolute value and the new multiplier until the result of the new absolute value minus 1 is greater than or equal to n;

[0086] Under the condition that the result of the new absolute value minus 1 is greater than or equal to n, for the i-th inserted row: all weight values in the weight value list are enlarged by a corresponding multiple according to the new multiplier, and a weight value of 1 is newly added at the last position in the weight value list to obtain a new weight value list, a new first row logical number is calculated according to the new weight value list, the sequence number value corresponding to the i-th row is the sum of the new first row logical sequence number plus 1 and the i-th equal division point, the i-th equal division point is obtained by dividing the result of the absolute value minus 1 into n+1 equal parts, and the subscript sequence number of the corresponding weight value of the i-th row is the length of the new weight value list minus 1.

[0087] Herein, the multiplier can be understood as the scale when performing the amplification operation on the weight value list.

[0088] On the basis of step A, step B and step C, in the case of diff-1<n, for the i-th inserted row, the process of determining the row logical sequence number of the inserted row is as follows:

[0089] Step C1: If diff-1<n, first perform a synchronous doubling operation on diff and mul, that is, diff takes the value of diff*2, and mul takes the value of mul*2, then re-judge whether diff-1≥n is satisfied; if not satisfied, execute step C2; if satisfied, execute step C3 and step C4;

[0090] Step C2: Continue to perform the synchronous doubling operation on diff and mul until diff-1≥n;

[0091] Step C3: Expand all weight values ​​in the weight value list (id_weight_list) by a multiple of the current mul value, and then add a weight value of 1 to the end of id_weight_list. This process can be understood as an expansion operation of the weight value list. Then, recalculate prev_id based on the new weight value list.

[0092] Step C4: When diff-1 ≥ n, the index (id) of the inserted row is taken from the corresponding division point of the (n+1)th division point of the logical index of the two rows before and after it. That is, the id of the i-th inserted row is prev_id+1 + (diff-1)*i / (n+1). If (diff-1)*i / (n+1) is not divisible, it is rounded down. The index of the weight value of the inserted row (id_weight_index) is taken from the length of the weight value list id_weight_list minus 1. That is, its weight value is taken from the last weight value in the weight value list (i.e., the smallest weight value 1).

[0093] As an example, if n=1, the index value (id) of the inserted row is taken as the midpoint of the logical index of the two rows before and after it, i.e., prev_id+1+(diff-1) / 2, and (diff-1) / 2 is not divisible by the index, so it is rounded down.

[0094] As shown in the example above, the weight value list contains only one weight of 1, and the original three rows of information are as follows:

[0095] Line 1: The sequence number is 0, the weight index is 0, the weight is 1, and the row logical sequence number is 0*1=0;

[0096] Line 2: The sequence number is 1, the weight index is 0, the weight is 1, and the line logical sequence number is 1*1=1;

[0097] Line 3: The sequence number is 2, the weight index is 0, the weight is 1, and the row logical sequence number is 2*1=2.

[0098] For example, when inserting a row between the first and second rows, in step A, `prev_id` is 0 and `next_id` is 1; in step B, `diff` = 1, and `diff-1` is less than 1; in step C1, `diff` and `mul` are doubled, `diff` is updated to 2, `mul` is updated to 2, and `diff-1` ≥ 1; in step C3, the weights in the weight value list are doubled (the original weight value 1 is increased to 2), and a new weight value 1 is added. The new weight value list includes two weights, 2 and 1. `prev_id` is recalculated, which means the row logical number of the original first row is recalculated. According to the new weight value list, the information of the original first row has been updated as follows: the index value is 0, the weight value index is 0, the weight value is 2, and the row logical number is 0*2 = 0; therefore, `prev_id` is 0; in step C4, the index value of the inserted row is... Its row logical number is 1*1=1.

[0099] It is understandable that when calculating the row logical number of an inserted row, the doubling operation and the expansion operation of the weight value list are only required if diff-1 < n. In this case, the row logical number of the existing row will be updated. If diff-1 ≥ n, then it is only necessary to determine the row logical number of the inserted row.

[0100] In one embodiment, the method of determining the sequence number of the inserted row and the corresponding weight index of the inserted row based on the relationship between the result of subtracting 1 from the absolute value and n further includes:

[0101] If, after multiplying all weight values ​​in the weight value list by the corresponding factor according to the new multiplier, the maximum weight value, the maximum row logical number, and / or the minimum row logical number exceed the corresponding set threshold, then the weight value list is re-initialized. The initialized weight value list includes one weight value with a weight value of 1. The index value corresponding to each row in the table is taken sequentially from the auto-incrementing sequence with an initial value of 0 and a step size of 1, and the index number of the corresponding weight value in each row is 0, and the weight value corresponding to each row is 1.

[0102] The threshold setting can be understood as a limit set for the weight value and / or row logical number. For example, the weight value cannot exceed 10000, and the maximum row logical number cannot exceed 10000, and the minimum cannot exceed -10000. As shown in the above examples, when inserting a row into the middle of the table, if the difference between the row logical numbers before and after the insertion is too small, a doubling operation and an expansion operation of the weight value list will be triggered. If the maximum weight value, maximum row logical number, and / or minimum row logical number exceed the corresponding set threshold during the expansion process, i.e., an integer overflow occurs, the weight value list can be reinitialized so that it contains only one weight value of 1. Then, the information of all rows in the table is updated according to this initialized weight value list. That is, the id value of each row is sequentially taken from an auto-incrementing sequence starting from 0 with a step size of 1, and the id_weight_index value is 0 for each row. Based on this, the row logical numbers of each row can be reorganized into a form starting from 0 and increasing with a step size of 1, allowing subsequent modification operations to continue, effectively increasing the table's capacity.

[0103] Figure 2 This is a schematic diagram illustrating a process for determining a row logical sequence number, provided as an embodiment. Figure 2 As shown, this process is triggered when a row of data is inserted into the table, where N represents the number of rows to be inserted.

[0104] It should be noted that when deleting rows from a table, the row number can be deleted directly, and the list of row numbers and weight values ​​for the remaining rows does not need to be changed, nor does the corresponding row logical number.

[0105] The following is a specific example of maintaining row logical numbers:

[0106] 1) Initialize a table with no data, and the id_weight_list column contains only one weight value "1";

[0107] 2) Insert one row of data into the table. The information of this row is as follows:

[0108] id is 0, id_weight_index is 0, id_weight is 1, and the row logical index is 0*1=0;

[0109] 3) The table already has one row of data. Inserting two rows after this row is equivalent to inserting two rows, each time after the last row. The information in the first inserted row is as follows:

[0110] With id = 1, id_weight_index = 0, id_weight = 1, and row logical number = 1*1 = 1;

[0111] The information in the second inserted row is as follows:

[0112] With id = 2, id_weight_index = 0, id_weight = 1, and row logical number = 2 * 1 = 2;

[0113] At this point, the table contains 3 rows of data, and the information for each row is as follows:

[0114] Line 1: The sequence number is 0, the weight index is 0, the weight is 1, and the row logical sequence number is 0*1=0;

[0115] Line 2: The sequence number is 1, the weight index is 0, the weight is 1, and the line logical sequence number is 1*1=1;

[0116] Line 3: The sequence number is 2, the weight index is 0, the weight is 1, and the row logical sequence number is 2*1=2.

[0117] 4) Insert two rows of data at once between the first and second rows in the table (i.e., before the second row), i.e., n=2;

[0118] For the first insertion, refer to the example above. In step A, prev_id is 0 and next_id is 1; in step B, diff = 1 and diff-1 < 2; in step C1, diff and mul are doubled, diff is updated to 2, mul is updated to 2, and diff-1 < 2; in step C2, diff and mul are doubled again, diff is updated to 4, mul is updated to 4, and diff-1 ≥ 2; in step C3, the weights in the weight value list are multiplied by 4 (the original weight value 1 is multiplied to 4), and a new weight value 1 is added. The new weight value list includes two weights, 4 and 1. prev_id is recalculated, that is, the original row logical sequence number of the first row is recalculated. According to the new weight value list, the information of the original first row has been updated to: sequence number 0, weight value index number 0, weight value 4, and row logical sequence number 0*4 = 0; therefore, prev_id is 0.

[0119] In step C4, the sequence number of the first row to be inserted is... `id_weight_index` is the length of `id_weight_list` minus 1, which equals 1. Since the weight value is 1, the row logical index is 2 * 1 = 1. The index of the second inserted row is... If id_weight_index is 1 and the weight value is 1, then the row logical sequence number is 3*1=3.

[0120] The method used in this embodiment to maintain row logical numbers ensures that the generated row logical numbers meet the basic requirements of uniqueness and order. Specifically, during initialization, the id value of each row of data is sequentially selected from an auto-incrementing sequence with an initial value of 0 and a step size of 1, and id_weight_index is always 0. At this time, the row logical numbers are ordered and unique. When inserting data into the first row of the table, the id of the newly inserted row is smaller than the id of the original first row, while the weight values ​​are the same, ensuring that the row logical number of the newly inserted row is less than the first row's logical number value. When inserting data into the end of the table, the id of the newly inserted row is larger than the id of the original last row, while the weight values ​​are the same, ensuring that the row logical number of the newly inserted row is greater than the last row's logical number value. When inserting data into the middle of the table, the id is taken from the value at the (n+1)th division point of the row logical numbers of the preceding and following rows, and id_weight is 1. The generated row logical number must be between the row logical number values ​​of the preceding and following rows. This fully guarantees the uniqueness and order of the row logical numbers.

[0121] Furthermore, this method effectively improves the data processing efficiency and performance of tables. Specifically, when inserting data into the first or last row of a table, the `id_weight_index` in the row logical sequence structure is fixed, and only the `id` needs to be calculated for the newly inserted row, making the computation negligible. When inserting data into the middle of the table, in addition to calculating the row logical sequence for the newly inserted row, only doubling and expansion of the weight value list need to be triggered when `diff-1 < n`. The size of the weight value list is not very large (the number of weight values ​​is not too many), and the computation is mainly related to the number of triggers. Moreover, when determining the row logical sequence value of the inserted row, the row logical sequence of the previous row is mainly used. Since the information of each row is independent and there are no specific rules or influences between them (such as not needing to increase according to a specific step size or needing adjacent values), the row logical sequence of the previous row can be used for calculation alone, without considering or updating the row logical sequences of all other rows. Therefore, efficiency is significantly improved, especially when there are many rows of data in the table, the performance improvement brought by this method is significant.

[0122] Figure 3 This application provides a schematic diagram of the structure of a data processing device based on row logical sequence numbers. The data processing device based on row logical sequence numbers provided in this embodiment includes:

[0123] The row logical number determination module 210 is used to determine the row logical number corresponding to each row in the table;

[0124] The data processing module 220 is used to insert or delete row data in the table according to the row logical number corresponding to each row, and to determine the row logical number of the inserted row;

[0125] The table corresponds to a list of weight values, where the weight values ​​in the list are integer powers of 2, and the weight values ​​in the list are arranged in descending order, with the smallest weight value being 1. The corresponding weight value index is an integer that starts from 0 and increases sequentially.

[0126] The serial number of each row in the table is a calculated integer; each row corresponds to a weight value index, which indicates the position of the weight value in the weight value list corresponding to the corresponding row.

[0127] The row logical number corresponding to any row is the product of the row's corresponding number value and the row's corresponding weight value.

[0128] This device uses sequence values ​​and weight values ​​to design the row logical sequence number of each row in the table. When the data is changed, the row logical sequence number is determined mainly for the row that is changed, without needing to update the row logical sequence numbers of other rows. This simplifies the maintenance of row logical sequence numbers and improves the performance of table data processing.

[0129] Based on any of the above embodiments, determining the row logical number corresponding to each row in the table includes:

[0130] Initialize the list of weight values. The list of initial weight values ​​includes one weight value, which is 1.

[0131] If the table contains data, the corresponding serial number value for each row is taken from the auto-incrementing sequence with an initial value of 0 and a step size of 1, and the corresponding weight value index of each row is 0, and the corresponding weight value of each row is 1.

[0132] Based on any of the above embodiments, the step of inserting or deleting row data in the table according to the row logical number corresponding to each row, and determining the row logical number of the inserted row, includes:

[0133] When inserting a row of data before the first row in the table, the index of the inserted row is the original index of the first row minus 1, and the index of the weight value of the inserted row is the original index of the weight value of the first row. The product of the weight value of the inserted row and the index of the inserted row is used as the logical index of the inserted row.

[0134] Based on any of the above embodiments, the step of inserting or deleting row data in the table according to the row logical number corresponding to each row, and determining the row logical number of the inserted row, includes:

[0135] When inserting n rows of data after the last row in the table, the operation of inserting a row of data after the last row in the table is performed n times. Each operation of inserting a row of data after the last row in the table includes: the sequence number of the inserted row is the original sequence number of the last row plus 1, the subscript number of the weight value of the inserted row is the original subscript number of the weight value of the last row, and the product of the weight value of the inserted row and the sequence number of the inserted row is used as the logical row number of the inserted row.

[0136] Based on any of the above embodiments, the step of inserting or deleting row data in the table according to the row logical number corresponding to each row, and determining the row logical number of the inserted row, includes:

[0137] When inserting n rows of data before the x-th row in the table, determine the difference between the absolute value of the first row's logical index and the absolute value of the second row's logical index, and take the absolute value of the difference. The x-th row is not the first row. The first row's logical index is the row logical index of the (x-1)-th row, and the second row's logical index is the row logical index of the original x-th row.

[0138] Based on the relationship between the result of subtracting 1 from the absolute value and the size of n, determine the index value of the inserted row and the corresponding weight value index of the inserted row;

[0139] Where n is a positive integer and the multiplier is n.

[0140] Based on any of the above embodiments, the step of determining the sequence number corresponding to the inserted row and the corresponding weight index number of the inserted row according to the relationship between the result of subtracting 1 from the absolute value and n includes:

[0141] If the result of subtracting 1 from the absolute value is greater than or equal to n, for the i-th row of insertion:

[0142] The index of the i-th row is the sum of the logical index of the first row plus 1 and the i-th division point. The i-th division point is obtained by dividing the result after subtracting 1 from the absolute value into n+1 equal parts. The index of the weight value of the i-th row is the length of the weight value list minus 1.

[0143] Based on any of the above embodiments, the step of determining the sequence number corresponding to the inserted row and the corresponding weight index number of the inserted row according to the relationship between the result of subtracting 1 from the absolute value and n includes:

[0144] Let the multiplier be 1. If the result of subtracting 1 from the absolute value is less than n, then double the absolute value and the multiplier to obtain a new absolute value and a new multiplier.

[0145] If the result of subtracting 1 from the new absolute value is less than n, then the doubling operation is repeated on the new absolute value and the new multiplier until the result of subtracting 1 from the new absolute value is greater than or equal to n.

[0146] If the result of subtracting 1 from the new absolute value is greater than or equal to n, for the i-th row of insertion:

[0147] Based on the new multiplier, all weight values ​​in the weight value list are multiplied by the corresponding factor, and a new weight value of 1 is added to the end of the weight value list to obtain a new weight value list. Based on the new weight value list, a new first row logical number is calculated. The index value corresponding to the i-th row is the sum of the new first row logical index plus 1 and the i-th division point. The i-th division point is obtained by dividing the result after subtracting 1 from the absolute value into n+1 equal parts. The index number of the corresponding weight value in the i-th row is the length of the new weight value list minus 1.

[0148] Based on any of the above embodiments, the step of determining the sequence number corresponding to the inserted row and the corresponding weight index number of the inserted row according to the relationship between the result of subtracting 1 from the absolute value and n further includes:

[0149] If, after multiplying all weight values ​​in the weight value list by the corresponding factor according to the new multiplier, the maximum weight value, the maximum row logical number, and / or the minimum row logical number exceed the corresponding set threshold, then the weight value list is re-initialized. The initialized weight value list includes a weight value of 1.

[0150] The serial number value corresponding to each row in the table is taken sequentially from the auto-incrementing sequence with an initial value of 0 and a step size of 1, and the subscript number of the corresponding weight value of each row is 0, and the weight value of each row is 1.

[0151] Based on any of the above embodiments, the step of inserting or deleting row data in the table according to the row logical number corresponding to each row, and determining the row logical number of the inserted row, includes:

[0152] If n rows of data are inserted into the first row of the table, then the n rows of data are inserted in reverse order.

[0153] Where n is an integer greater than 1;

[0154] For each row of data inserted, the index of the inserted row is the index of the original first row minus 1, and the index of the weight value of the inserted row is the index of the weight value of the original first row. The product of the weight value of the inserted row and the index of the inserted row is used as the logical index of the inserted row.

[0155] The data processing device based on row logical sequence number provided in this application can be used to execute the data processing method based on row logical sequence number provided in any of the above embodiments, and has corresponding functions and beneficial effects.

[0156] Figure 4 A schematic diagram of an electronic device 10, which can be used to implement embodiments of this application, is shown. The electronic device 10 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 10 may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, user equipment, 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 application described and / or claimed herein.

[0157] like Figure 4 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0158] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks and wireless networks.

[0159] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 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 processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above.

[0160] In some embodiments, the methods described above can be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the methods described above can be performed. Alternatively, in other embodiments, processor 11 can be configured to perform the methods of any of the embodiments described above by any other suitable means (e.g., by means of firmware).

[0161] 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.

[0162] Computer programs used to implement the methods of this application may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0163] In the context of this application, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage 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. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. 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.

[0164] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device 10, which includes: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device 10. 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).

[0165] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users 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., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0166] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.

[0167] This application also provides a computer program product, including a computer program and / or instructions, which, when executed by a processor, implement the data processing method based on row logical sequence numbers as described in any of the above embodiments.

[0168] 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 application can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this application can be achieved, and this is not limited herein.

[0169] The specific embodiments described above do not constitute a limitation on the scope of protection of this application. 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 application should be included within the scope of protection of this application.

Claims

1. A method for processing data based on row logical sequence number, characterized in that, include: Determine the row logical number corresponding to each row in the table; Insert or delete row data in the table according to the row logical number corresponding to each row, and determine the row logical number of the inserted row; The table corresponds to a list of weight values, where the weight values ​​in the list are integer powers of 2, and the weight values ​​in the list are arranged in descending order, with the smallest weight value being 1. The index of each weight value is an integer that increases sequentially from 0. The serial number of each row in the table is a calculated integer; each row corresponds to a weight value index, which indicates the position of the weight value in the weight value list corresponding to the corresponding row. The row logical number corresponding to any row is the product of the row's corresponding number value and the row's corresponding weight value; The step of inserting or deleting row data in the table according to the row logical number corresponding to each row, and determining the row logical number of the inserted row, includes: When inserting n rows of data before the x-th row in the table, determine the difference between the absolute value of the first row's logical index and the absolute value of the second row's logical index, and take the absolute value of the difference. The x-th row is not the first row. The first row's logical index is the row logical index of the (x-1)-th row, and the second row's logical index is the row logical index of the original x-th row. Based on the relationship between the result of subtracting 1 from the absolute value and the size of n, determine the sequence number of the inserted row and the index number of the corresponding weight value of the inserted row. The product of the weight value corresponding to the index number of the corresponding weight value of the inserted row and the sequence number of the inserted row is used as the row logical number of the inserted row. Where n is a positive integer.

2. The method according to claim 1, characterized in that, Determining the row logical number corresponding to each row in the table includes: Initialize the list of weight values. The list of initial weight values ​​includes one weight value, which is 1. If the table contains data, the corresponding serial number value for each row is taken sequentially from the auto-incrementing sequence with an initial value of 0 and a step size of 1, and the corresponding weight value index of each row is 0, and the corresponding weight value of each row is 1.

3. The method according to claim 1, characterized in that, The step of inserting or deleting row data in the table according to the row logical number corresponding to each row, and determining the row logical number of the inserted row, includes: When the table is empty and n rows of data are inserted into the table, the sequence number of each inserted row is an integer that increments sequentially from 0, and the subscript number of the weight value of each inserted row is 0. For each inserted row, the row logical number of the inserted row is the product of the weight value corresponding to the subscript number of the weight value of the inserted row and the sequence number value of the inserted row. Where n is a positive integer.

4. The method according to claim 1, characterized in that, The step of inserting or deleting row data in the table according to the row logical number corresponding to each row, and determining the row logical number of the inserted row, includes: When inserting a row of data before the first row in the table, the index of the inserted row is the original index of the first row minus 1, and the index of the weight value of the inserted row is the original index of the weight value of the first row. The product of the weight value of the inserted row and the index of the inserted row is used as the logical index of the inserted row.

5. The method according to claim 1, characterized in that, The step of inserting or deleting row data in the table according to the row logical number corresponding to each row, and determining the row logical number of the inserted row, includes: If n rows of data are inserted into the first row of the table, then the n rows of data are inserted in reverse order. Where n is an integer greater than 1; For each row of data inserted, the index of the inserted row is the index of the original first row minus 1, and the index of the weight value of the inserted row is the index of the weight value of the original first row. The product of the weight value of the inserted row and the index of the inserted row is used as the logical index of the inserted row.

6. The method according to claim 1, characterized in that, The step of inserting or deleting row data in the table according to the row logical number corresponding to each row, and determining the row logical number of the inserted row, includes: In the case of inserting n rows of data after the last row of the table, perform the operation of inserting one row of data after the last row of the table n times; Each operation of inserting a row of data after the last row in the table includes: the sequence number of the inserted row is the original sequence number of the last row plus 1, the subscript number of the weight value of the inserted row is the original subscript number of the weight value of the last row, and the product of the weight value of the inserted row and the sequence number of the inserted row is used as the logical row number of the inserted row. Where n is a positive integer.

7. The method according to claim 1, characterized in that, The step of determining the sequence number of the inserted row and the corresponding weight index of the inserted row based on the relationship between the result of subtracting 1 from the absolute value and n includes: If the result of subtracting 1 from the absolute value is greater than or equal to n, for the i-th row of insertion: The index of the i-th row is the sum of the logical index of the first row plus 1 and the i-th division point. The i-th division point is obtained by dividing the result after subtracting 1 from the absolute value into n+1 equal parts. The index of the weight value of the i-th row is the length of the weight value list minus 1.

8. The method according to claim 1, characterized in that, The step of determining the sequence number of the inserted row and the corresponding weight index of the inserted row based on the relationship between the result of subtracting 1 from the absolute value and n includes: Let the multiplier be 1. If the result of subtracting 1 from the absolute value is less than n, then double the absolute value and the multiplier to obtain a new absolute value and a new multiplier. If the result of subtracting 1 from the new absolute value is less than n, then the doubling operation is repeated on the new absolute value and the new multiplier until the result of subtracting 1 from the new absolute value is greater than or equal to n. If the result of subtracting 1 from the new absolute value is greater than or equal to n, for the i-th row of the insertion: Based on the new multiplier, all weight values ​​in the weight value list are multiplied by the corresponding factor, and a new weight value of 1 is added to the end of the weight value list to obtain a new weight value list. Based on the new weight value list, a new first row logical number is calculated. The index value corresponding to the i-th row is the sum of the new first row logical index plus 1 and the i-th division point. The i-th division point is obtained by dividing the result after subtracting 1 from the absolute value into n+1 equal parts, and the index number of the corresponding weight value in the i-th row is the length of the new weight value list minus 1.

9. The method according to claim 8, characterized in that, The step of determining the sequence number of the inserted row and the corresponding weight index of the inserted row based on the relationship between the result of subtracting 1 from the absolute value and n also includes: If, after multiplying all weight values ​​in the weight value list by the corresponding factor according to the new multiplier, the maximum weight value, the maximum row logical number, and / or the minimum row logical number exceed the corresponding set threshold, then the weight value list is re-initialized. The initialized weight value list includes a weight value of 1. The serial number value corresponding to each row in the table is taken from the auto-incrementing sequence with an initial value of 0 and a step size of 1, and the subscript number of the corresponding weight value of each row is 0, and the weight value of each row is 1.

10. A data processing device based on row logical sequence numbers, characterized in that, include: The row logical number determination module is used to determine the row logical number corresponding to each row in the table; The data processing module is used to insert or delete row data in the table according to the row logical number corresponding to each row, and to determine the row logical number of the inserted row; The table corresponds to a list of weight values, where the weight values ​​in the list are integer powers of 2, and the weight values ​​in the list are arranged in descending order, with the smallest weight value being 1. The index of each weight value is an integer that increases sequentially from 0. The serial number of each row in the table is a calculated integer; each row corresponds to a weight value index, which indicates the position of the weight value in the weight value list corresponding to the corresponding row. The row logical number corresponding to any row is the product of the row's corresponding number value and the row's corresponding weight value; The step of inserting or deleting row data in the table according to the row logical number corresponding to each row, and determining the row logical number of the inserted row, includes: When inserting n rows of data before the x-th row in the table, determine the difference between the absolute value of the first row's logical index and the absolute value of the second row's logical index, and take the absolute value of the difference. The x-th row is not the first row. The first row's logical index is the row logical index of the (x-1)-th row, and the second row's logical index is the row logical index of the original x-th row. Based on the relationship between the result of subtracting 1 from the absolute value and the size of n, determine the sequence number of the inserted row and the index number of the corresponding weight value of the inserted row. The product of the weight value corresponding to the index number of the corresponding weight value of the inserted row and the sequence number of the inserted row is used as the row logical number of the inserted row. Where n is a positive integer.

11. An electronic device, characterized in that, include: At least one processor; A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the data processing method based on row logical sequence number as described in any one of claims 1-9.

12. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the data processing method based on row logical sequence number as described in any one of claims 1-9.

13. A computer program product comprising a computer program and / or instructions, characterized in that, When the computer program and / or instructions are executed by the processor, they implement the data processing method based on row logical sequence numbers as described in any one of claims 1-9.

Citation Information

Patent Citations

  • Data verification method and device, electronic equipment and storage medium

    CN113435170A

  • Inductive position sensor

    WO2006067420A1