Method, device, equipment, medium and product for processing data based on row logic sequence number

By introducing the product calculation of the weight value list and the serial number value, the performance loss problem caused by inserting data from non-tailed rows in the table is solved, and efficient row logical serial number maintenance and data processing are achieved.

CN120448384APending Publication Date: 2025-08-08SHANGHAI DAMENG DATABASE
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510522467.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-24
Publication Date
2025-08-08

AI Technical Summary

Technical Problem

When inserting non-tailed row data into existing tables, it is necessary to perform self-incremental calculations on all row logical numbers, resulting in serious performance losses, especially when the data volume is large, maintenance efficiency is inefficient.

Method used

Use a list of weight values, the power of integers with a weight value of 2 and is arranged in descending order, the minimum weight value is 1, the corresponding sequence number value of each row in the table is a specific design integer, and the logical sequence number of the row is the product of the sequence number value and the weight value. Only the logical sequence number of the inserted row is updated, and no other rows are updated.

Benefits of technology

The maintenance process of row logical serial numbers is simplified, the table data processing performance is improved, and the performance loss is reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120448384A_ABST
    Figure CN120448384A_ABST
Patent Text Reader

Abstract

The invention discloses a data processing method, device and equipment based on a line logic sequence number, a medium and a product. The method comprises the following steps: determining a row logic sequence number corresponding to each row in a table; inserting or deleting row data in the table according to the row logic sequence number corresponding to each row, and determining the row logic sequence number of the inserted row; weight values in a weight value list corresponding to the table are integer power of 2 and are arranged in a descending order, the minimum weight value is 1, and a serial number value corresponding to each row is an integer specifically designed through calculation; each row corresponds to a corresponding weight value subscript sequence number; the line logic serial number corresponding to any line is the product of the serial number value corresponding to the line and the weight value corresponding to the line. According to the method, the serial number value and the weight value are used for designing the line logic serial number of each line in the table, the line logic serial number is mainly determined for the changed line during data change, the line logic serial numbers of other lines do not need to be updated, maintenance of the line logic serial 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] The embodiments of the present application relate 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 Art

[0002] In data display and analysis, tables are a very commonly used graphical component. Common operations users perform on tables include querying, inserting, deleting, and modifying data. Deleting and modifying also require querying the target data first. Therefore, being able to efficiently query table data is a necessary function. When there are a large number of rows of data in a table, querying and maintaining the data are more time-consuming, and in actual use, it is more likely to cause lag. In order to achieve efficient row data search, a row logical sequence number is usually generated when inserting row data to uniquely identify and track the row data. The row logical sequence number is unique and ordered in the table, so a binary search can be used based on the row logical sequence number, greatly improving the search efficiency.

[0003] Common table row logical numbers are derived from an auto-incrementing sequence starting at 0 and incrementing by 1. For example, if a table contains five rows, the row logical numbers are 0, 1, 2, 3, and 4. When inserting a row at the end, a logical number "5" is generated for the new row. When inserting a row at a non-last row, the row logical number of the inserted row is assigned to the previous row, and the logical numbers of all subsequent rows are incremented by 1. For example: when a new row of data is inserted between the third row and the third row in a table, the logical sequence number of the newly inserted row is 2, the logical sequence number of the old third row. After the row is inserted, the logical sequence numbers of all subsequent rows (starting from the old third row) are increased by 1. At this time, the logical sequence numbers of the 6 rows of data in the table are 0 (the original row logical sequence number is 0, which remains unchanged), 1 (the original row logical sequence number is 1, which remains unchanged), 2 (the newly inserted row), 3 (the original row logical sequence number is 2, plus 1), 4 (the original row logical sequence number is 3, plus 1), 5 (the original row logical sequence number is 4, plus 1), and 6 (the original row logical sequence number is 5, plus 1).

[0004] As can be seen from the above example, the current method of generating logical sequence numbers for table rows has a drawback: inserting data into a non-last row in a table causes the logical sequence numbers of all rows after the inserted row to be incremented. When the amount of data in the table is large, maintaining the logical sequence numbers of the rows also requires a large number of operations, which is very performance-depleting. Summary of the Invention

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

[0006] In a first aspect, an embodiment of the present application provides a method for processing data based on row logical sequence numbers, comprising:

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

[0008] 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;

[0009] 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, the smallest weight value is 1, and the weight value subscript serial numbers corresponding to the weight values are integers that increase one by one starting from 0;

[0010] The serial number value corresponding to each row in the table is an integer specifically designed through calculation; each row corresponds to a corresponding weight value subscript serial number, and the weight value subscript serial number is used to indicate the position of the weight value corresponding to the corresponding row in the weight value list;

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

[0012] In a second aspect, an embodiment of the present application further provides a device for processing data based on row logical sequence numbers, comprising:

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

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

[0015] 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, the smallest weight value is 1, and the weight value subscript serial numbers corresponding to the weight values are integers that increase one by one starting from 0;

[0016] The serial number value corresponding to each row in the table is an integer specifically designed through calculation; each row corresponds to a corresponding weight value subscript serial number, and the weight value subscript serial number is used to indicate the position of the weight value corresponding to the corresponding row in the weight value list;

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

[0018] In a third aspect, an embodiment of the present application provides an electronic device, including:

[0019] one or more processors;

[0020] a 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 method for processing data based on row logical sequence numbers as described in the first aspect.

[0022] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method for processing data based on row logical sequence numbers as described in the first aspect.

[0023] In a fifth aspect, an embodiment of the present application further provides a computer program product, comprising a computer program and / or instructions, which, when executed by a processor, implements the method for processing data based on row logical sequence numbers as described in any of the above embodiments.

[0024] An embodiment of the present application provides a method, apparatus, device, medium and product for processing data based on row logical numbers, the method for processing data based on row logical numbers comprising: determining the row logical number corresponding to each row in a table; 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; 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, the smallest weight value is 1, and the weight value subscript numbers corresponding to the respective weight values are integers that increase one by one starting from 0; the serial number value corresponding to each row in the table is an integer that has been specifically designed through calculation; each row corresponds to a corresponding weight value subscript serial number, and the weight value subscript serial number is used to indicate the position of the weight value corresponding to the corresponding row in the weight value list; the row logical serial number corresponding to any row is the product of the serial number value corresponding to the row and the weight value corresponding to the row. The above technical solution uses serial number values and weight values to design the row logical numbers of each row in the table. When the data changes, the row logical numbers are mainly determined for the changed rows, and there is no need to update the row logical numbers of other rows. This simplifies the maintenance of row logical numbers and improves the table data processing performance. BRIEF DESCRIPTION OF THE DRAWINGS

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

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

[0027] Figure 2 A schematic diagram of a process for determining a row logical sequence number provided by an embodiment;

[0028] Figure 3 A schematic diagram of the structure of a device for processing data based on row logical sequence numbers provided in an embodiment of the present application;

[0029] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0030] The present application will be further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are intended only to illustrate the present application and are not intended to limit the present application. It should also be noted that, for ease of description, the accompanying drawings only illustrate portions of the present application, not all of the structures.

[0031] Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow charts describe the steps as sequential processes, many of the steps can be implemented in parallel, concurrently, or simultaneously. In addition, the order of the steps can be rearranged. The process can be terminated when its operation is completed, but can also have additional steps not included in the accompanying drawings. The process can correspond to a method, function, procedure, subroutine, subprogram, 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 or interdependence of the functions performed by these devices, modules, units or other objects.

[0033] In addition, the embodiments and features in the embodiments of the present application may be combined with each other unless there is any conflict.

[0034] The acquisition, storage, use, and processing of data in this application's technical solution comply with relevant national laws and regulations.

[0035] It should be noted that in the embodiments of the present application, certain software, components, models and other existing solutions in the industry may be mentioned. They should be regarded as exemplary. Their purpose is only to illustrate the feasibility of implementing the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the relevant content of the solution.

[0036] Figure 1A flowchart of a method for processing data based on row logical sequence numbers is provided in an embodiment of the present application. This embodiment is applicable to the case of processing table data or row data. Specifically, the method for processing data based on row logical sequence numbers can be performed by a device for processing data based on row logical sequence numbers, which can be implemented by software and / or hardware and integrated into an electronic device. Electronic devices include but are not limited to computers, smart phones, servers, and other devices with computing functions, and can also be central processing units (CPUs), system-on-chips (SoCs), computers, field-programmable gate arrays (FPGAs), or server microcontrollers (MCUs).

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

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

[0039] Here, a table can be understood as a table to be processed, which usually contains at least one row of data, each row has its own corresponding row logical sequence number, and the row logical sequence numbers of each row are different and arranged in increasing order. It should be noted that in the embodiment of the present application, it is not required that the row logical sequence numbers of each row be incremented in equal steps.

[0040] The row logical sequence numbers in the embodiments of the present application are different from the row logical sequence numbers used in previous tables (that is, they are not taken in sequence from an auto-increment sequence with an initial value of 0 and a step size of 1), but a new value-taking method is adopted. Specifically, a weight value list (denoted as id_weight_list) is introduced for the table, and the weight value list can be understood as a list composed of the weight values of the row logical sequence numbers in the table. The 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, and the smallest weight value is 1. For example, there is only one weight value in the weight value list, which is 1; for another example, there are 4 weight values in the weight value list, which are 8, 4, 2, and 1, respectively.

[0041] In addition, to facilitate the description of the position of the weight value in the weight value list and to uniquely identify and track the weight value, the weight value subscript serial number (denoted as id_weight_index) is introduced. The weight value (id_weight) is the value of the id_weight_index position in the weight list of the table, that is, id_weight_list[id_weight_index]. The weight value subscript serial numbers corresponding to each weight value in the weight value list are integers that increase one by one starting from 0. For example, there is only one weight value in the weight value list, and the weight value is 1, and the corresponding weight value subscript serial number is 0; for another example, there are 4 weight values in the weight value list, which are 8, 4, 2, and 1, respectively, and the corresponding weight value subscript serial numbers are 0, 1, 2, and 3, respectively.

[0042] The serial number value (denoted as id) corresponding to each row in the table is a specially designed integer. For an initial table, the serial number values corresponding to each row can be integers that increase one by one starting from 0. For example, if there are 3 rows of data in the table, the serial numbers corresponding to these 3 rows are 0, 1, and 2 respectively. Each row corresponds to a corresponding weight value subscript serial number, and the weight value subscript serial number is used to indicate the position of the weight value corresponding to the corresponding row in the weight value list.

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

[0044] Based on the above, 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, that is, the row logical sequence number can be expressed as id*id_weight or id*id_weight_list[id_weight_index].

[0045] As a reference example, there are 3 rows of data in the table. The corresponding serial number value, weight value subscript serial number, weight value and row logical serial number of each row are:

[0046] Row 1: The sequence number is 0, the weight subscript sequence number is 0, the weight value is 1, and the row logical sequence number is 0*1=0;

[0047] Row 2: The serial number is 1, the weight subscript is 0, the weight is 1, and the row logic number is 1*1=1;

[0048] Row 3: The serial number value is 2, the weight subscript serial number is 0, the weight value is 1, and the row logical serial 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 indicate the importance of the sequence number value to the finally determined row logical sequence number.

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

[0051] Furthermore, in the reference example above, as a known initial table, the importance of each row is consistent, so the weight value is 1, and the value of the row logical sequence number is also consistent with the sequence number value of each row. Based on this logic, when subsequently modifying the table, for example, when inserting data, the row logical sequence number of the existing row can be left unchanged. Instead, the row logical sequence number is determined primarily for the inserted row, and the value of the row logical sequence number may be inconsistent with the sequence number value of the corresponding row.

[0052] S120, inserting or deleting row data in the table according to the row logical serial number corresponding to each row, and determining the row logical serial number of the inserted row;

[0053] Among them, based on the above-mentioned row logical sequence number value logic, while ensuring the uniqueness and order of the row logical sequence number, the performance loss of maintaining the row logical sequence number is greatly reduced. When changing the row data in the table, the sequence number value and weight value subscript sequence number of the inserted row can be determined, and the corresponding weight value can be determined according to the weight value subscript sequence number, and then the row logical sequence number can be determined according to its sequence number value and weight value. In this process, the row logical sequence number is mainly determined for the row that has been changed, and generally there is no need to update the row logical sequence numbers of other rows, which reduces the workload of maintaining the row logical sequence number and improves data processing efficiency.

[0054] It should be noted that in the embodiments of the present application, when changing row data in a 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. In addition, the above method for determining the row logical sequence number is also applicable to other similar functional scenarios that require unique and ordered logical sequence numbers.

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

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

[0057] As shown in the reference example above, there are three rows of data in the table. The corresponding serial number value, weight value subscript serial number, weight value and row logical serial number of each row are:

[0058] Row 1: The sequence number is 0, the weight subscript sequence number is 0, the weight value is 1, and the row logical sequence number is 0*1=0;

[0059] Row 2: The serial number is 1, the weight subscript is 0, the weight is 1, and the row logic number is 1*1=1;

[0060] Row 3: The serial number value is 2, the weight subscript serial number is 0, the weight value is 1, and the row logical serial number is 2*1=2.

[0061] In one embodiment, row data is inserted or deleted in a table according to the row logical serial number corresponding to each row, and the row logical serial number of the inserted row is determined, including: 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 increases one by one starting from 0, and the weight value subscript serial number corresponding to each inserted row is 0. For each inserted row, the row logical serial number of the inserted row is the product of the weight value corresponding to the weight value subscript serial number corresponding to the inserted row and the serial number value corresponding to the inserted row; wherein n is a positive integer.

[0062] For example, if there is no data in the table (i.e., the table is empty), when n rows of data are inserted into the table, the serial number value corresponding to each inserted row is 0, 1, 2...n-1, the weight value subscript serial number corresponding to each inserted row is 0, the weight value is 1, and the row logical serial number corresponding to each inserted row is 0, 1, 2...n-1. Taking the case of n=1 as an example, the serial number value (id) of the inserted row is 0, the weight value subscript serial number (id_weight_index is 0), on this basis, the weight value is 1, and the row logical serial number is 0*1=0. Taking the case of n=2 as an example, the ids of the two inserted rows are 0 and 1 respectively, the weight value subscript serial number (id_weight_index is 0), the weight value is 1, and the row logical serial numbers are 0*1=0 and 1*1=1 respectively.

[0063] In one embodiment, the row data in the table is changed according to the row logical serial number corresponding to each row, and the row logical serial number of the inserted row is determined, including: when a row of data is inserted before the first row in the table, the serial number value corresponding to the inserted row is the serial number value corresponding to the original first row minus 1, the weight value subscript serial number corresponding to the inserted row is the weight value subscript serial number corresponding to the original first row, and the product of the weight value corresponding to the weight value subscript serial number corresponding to the inserted row and the serial number value corresponding to the inserted row is used as the row logical serial number of the inserted row.

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

[0065] The serial number value (id) of the inserted row is the id value of the original first row of data minus 1 (as in the reference example above, the id value of the original first row of data is 0, then the serial number value of the inserted row is -1), and the weight value subscript serial number (id_weight_index) of the inserted row is the id_weight_index of the original first row (as in the reference example above, the id_weight_index of the original first row of data is 0, then the id_weight_index of the inserted row is 0), then it can be determined that the weight value of the inserted row is 1, and the row logical serial number value is -1*1=-1.

[0066] In one embodiment, the row data in the table is changed according to the row logical serial number corresponding to each row, and the row logical serial number of the inserted row is determined, including: when n rows of data are inserted into the first row of the table, the n rows of data are inserted in reverse order; wherein n is an integer greater than 1; for each time a row of data is inserted, the serial number value corresponding to the inserted row is the serial number value corresponding to the original first row minus 1, the weight value subscript serial number corresponding to the inserted row is the weight value subscript serial number corresponding to the original first row, and the product of the weight value corresponding to the weight value subscript serial number corresponding to the inserted row and the serial number value corresponding to the inserted row is used as the row logical serial number of the inserted row.

[0067] Specifically, if you insert data in batches before the first row in a table, for example, inserting n rows of data (n is an integer greater than 1), it is equivalent to inserting n times before the first row of the table, inserting one row of data each 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-1th row of n rows before the first row of the table, and so on. The last insertion is to insert the 1st row of n rows before the first row of the table.

[0068] In one embodiment, row data is inserted or deleted in the table according to the row logical serial number corresponding to each row, and the row logical serial number of the inserted row is determined, including: in the case of inserting n rows of data after the last row in the table, performing the operation of inserting a row of data after the last row in the table n times; each operation of inserting a row of data after the last row in the table includes: the serial number value corresponding to the inserted row is the serial number value corresponding to the original last row plus 1, the weight value subscript serial number corresponding to the inserted row is the weight value subscript serial number corresponding to the original last row, and the product of the weight value corresponding to the weight value subscript serial number corresponding to the inserted row and the serial number value corresponding to the inserted row is used as the row logical serial number of the inserted row; wherein n is a positive integer.

[0069] Specifically, if there is already data in the table, inserting n rows of data after the last row in the table is equivalent to inserting a row of data into the last row of the table n times. For each insertion of a single row of data, the process of determining the row logical sequence number of the inserted row is as follows:

[0070] The serial number value (id) of the inserted row is the id value of the original first row of data plus 1 (as in the reference example above, the id value of the original last row of data is 2, then the serial number value of the inserted row is 3), and the weight value subscript serial number (id_weight_index) of the inserted row is the id_weight_index of the original last row (as in the reference example above, the id_weight_index of the original last row of data is 0, then the id_weight_index of the inserted row is 0), then it can be determined that the weight value of the inserted row is 1, and the row logical serial number value is 3*1=3.

[0071] If there is no data in the table (the table is empty), then inserting n rows of data to the end of the table is equivalent to inserting a single row of data into the empty table once and inserting a row of data into the last row of the table n-1 times. The process of determining the row logical sequence number of the inserted row each time can be referred to the above embodiment. In this case, the sequence number value corresponding to each inserted row is an integer that increases one by one starting from 0, and the weight value subscript number corresponding to each inserted row is 0. For each inserted row, the row logical sequence number of the inserted row is the product of the weight value corresponding to the weight value subscript number of the inserted row and the sequence number value corresponding to the inserted row.

[0072] In one embodiment, row data in a table is modified according to the row logical sequence number corresponding to each row, and the row logical sequence number of the inserted row is determined, including: when n rows of data are inserted before the xth row in the table, determining the difference between the absolute value of the first row logical sequence number and the absolute value of the second row logical sequence number, and taking the absolute value of the difference; if the xth row is not the first row, the first row logical sequence number is the row logical sequence number of the x-1th row, and the second row logical sequence number is the original row logical sequence number of the xth row;

[0073] According to the relationship between the result of taking the absolute value minus 1 and n, determine the serial number value corresponding to the inserted row and the weight value subscript number corresponding to the inserted row, and use the product of the weight value corresponding to the weight value subscript number corresponding to the inserted row and the serial number value corresponding to the inserted row as the row logical serial 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 and row x is not the first row can be understood as inserting row data into the middle part of the table, which excludes the two cases of inserting before the first row and inserting after the last row.

[0075] When inserting a single row of data into the middle of a table, the logical sequence number of the inserted row is determined as follows:

[0076] Step A. Calculate the row logical sequence numbers of the two rows before and after the inserted row. Assuming the position of the inserted row is insert_index, calculate the row logical sequence number value of the original position insert_index-1 (recorded as prev_id) and the row logical sequence number value of the original position insert_index (recorded 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, that is, diff = ||next_id|-|prev_id||;

[0078] Step C. Compare the absolute value minus 1 (diff-1, where the purpose of subtracting 1 is to remove the boundary value) with n, and use this to further determine the sequence number corresponding to the inserted row and the subscript number of the weight value corresponding to the inserted row, and then determine the weight value corresponding to the inserted row, and ultimately determine the row logical sequence number of the inserted row. The relationship between diff-1 and n can determine whether to trigger the expansion of the weight value list (including expanding existing weight values and adding new weight values).

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

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

[0081] If diff-1 ≥ n, the inserted row's index (id) is taken from the n+1 points that divide the logical numbers of the rows before and after it. That is, the id of the i-th inserted row is prev_id+1+(diff-1)*i / (n+1), rounding down if (diff-1)*i / (n+1) is not divisible. The inserted row's weight subscript index (id_weight_index) is the length of the weight list id_weight_list minus 1, meaning its weight is the last weight in the weight list (which is also the minimum weight, 1).

[0082] As an example, if n = 1, the sequence number value (id) of the inserted row takes the middle value of the row logical sequence numbers of the two adjacent rows, that is, prev_id + 1 + (diff - 1) / 2, and when (diff - 1) / 2 cannot be divided evenly, it is rounded down.

[0083] In one embodiment, according to the magnitude relationship between the result of subtracting 1 from the absolute value taken and n, the sequence number value corresponding to the inserted row and the index number of the weight value corresponding to the inserted row are determined, including:

[0084] Let the multiplier (mul) be 1. If the result of subtracting 1 from the absolute value taken is less than n, then both the absolute value and the multiplier are doubled to obtain a new absolute value and a new multiplier;

[0085] If the result of subtracting 1 from the new absolute value is less than n, the doubling operation is repeatedly performed 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;

[0086] In the case where the result of subtracting 1 from the new absolute value is greater than or equal to n, for the i-th inserted row: all the weight values in the weight value list are expanded by the corresponding multiple according to the new multiplier, and a new weight value of 1 is newly added at the end of the weight value list to obtain a new weight value list. The 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 equally dividing the result of subtracting 1 from the absolute value into n + 1 parts, and the index number of the weight value corresponding to the i-th row is the length of the new weight value list minus 1.

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

[0088] Based on steps A, B, and C, in the case where diff - 1 < n, for the i-th inserted row, the determination process of the row logical sequence number of the inserted row is as follows:

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

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

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

[0092] Step C4: When diff-1 ≥ n, the serial number (id) of the inserted row is taken as the corresponding n+1 equal-division point of the row logical serial numbers 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 by an integer, it is rounded down. The weight subscript serial number (id_weight_index) of the inserted row is taken as the length of the weight value list id_weight_list minus 1. That is, its weight value is the last weight value in the weight value list (i.e., the minimum weight value 1).

[0093] As an example, if n=1, the serial number value (id) of the inserted row is the middle value of the logical serial numbers of the two rows before and after it, that is, prev_id+1+(diff-1) / 2. If (diff-1) / 2 cannot be divided evenly, it is rounded down.

[0094] As shown in the reference example above, there is only one weight in the weight value list, which is 1. The original three rows of information are as follows:

[0095] Row 1: The sequence number is 0, the weight subscript sequence number is 0, the weight value is 1, and the row logical sequence number is 0*1=0;

[0096] Row 2: The serial number is 1, the weight subscript is 0, the weight is 1, and the row logic number is 1*1=1;

[0097] Row 3: The serial number value is 2, the weight subscript serial number is 0, the weight value is 1, and the row logical serial number is 2*1=2.

[0098] For example, if a row is inserted between the first and second rows, then 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 expanded to 2), and a new weight value 1 is added. Then, the new weight value list includes two weights 2 and 1, and prev_id is recalculated, that is, the row logical sequence number of the original row 1 is recalculated. According to the new weight value list, the information of the original row 1 has been updated to: sequence number 0, weight value subscript sequence number 0, weight value 2, and row logical sequence number 0*2=0; therefore, prev_id is 0; the sequence number of the inserted row in step C4 is Its row logical sequence number is 1*1=1.

[0099] It can be understood that when calculating the row logical sequence number of the inserted row, the doubling operation and the expansion operation of the weight value list need to be performed only when diff-1 is less than n. In this case, the row logical sequence number of the existing row will be updated; if diff-1 is greater than or equal to n, it is only necessary to determine the row logical sequence number of the inserted row.

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

[0101] If, according to the new multiplier, all the weight values in the weight value list are expanded by the corresponding multiples, and the maximum weight value, the maximum row logical sequence number and / or the minimum row logical sequence number exceed the corresponding set threshold, the weight value list is reinitialized, and the initialized weight value list includes a weight value, which is 1; the sequence number value corresponding to each row in the table is taken in sequence from the auto-increment sequence with an initial value of 0 and a step size of 1, and the corresponding weight value subscript sequence number of each row is 0, and the corresponding weight value of each row is 1.

[0102] Among them, the set threshold can be understood as a limit value set for the weight value and / or the row logical sequence number, for example, the weight value cannot exceed 10000, and the maximum row logical sequence number cannot exceed 10000, and the minimum cannot exceed -10000, etc. Through the above embodiment, it can be seen that in the case of inserting a row into the middle of a table, if the difference between the row logical sequence numbers before and after the insertion is too small, it will trigger a doubling operation and an expansion operation of the weight value list. If the maximum weight value, the maximum row logical sequence number and / or the minimum row logical sequence number exceed the corresponding set threshold during the expansion process, that is, an integer overflow occurs. In this case, the weight value list can be reinitialized so that there is only one weight value, which is 1, and then the information of all rows in the table is updated according to the initialized weight value list, that is, the id value of each row is taken from an auto-increment sequence with a starting value of 0 and a step size of 1, and the id_weight_index value is 0. On this basis, the row logical sequence number of each row can be rearranged to start from 0 and increase in steps of 1, and subsequent change operations can be continued to effectively increase the capacity of the table.

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

[0104] It should be noted that when deleting a row from a table, the sequence number value of the deleted row can be directly deleted, and the sequence number values and weight value lists of the remaining rows do not need to be changed, and the corresponding row logical sequence numbers remain unchanged.

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

[0106] 1) Initialize a table with no data in it. The id_weight_list has only one column, which contains a weight value of "1".

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

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

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

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

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

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

[0113] At this point, there are three rows of data in the table, and the information for each row is as follows:

[0114] Row 1: The sequence number is 0, the weight subscript sequence number is 0, the weight value is 1, and the row logical sequence number is 0*1=0;

[0115] Row 2: The serial number is 1, the weight subscript is 0, the weight is 1, and the row logic number is 1*1=1;

[0116] Row 3: The serial number value is 2, the weight subscript serial number is 0, the weight value is 1, and the row logical serial number is 2*1=2.

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

[0118] Then, when inserting for the first time, you can refer to the above example. In step A, prev_id is 0 and next_id is 1; in step B, diff=1, 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; step C2 continues to double diff and mul, diff is updated to 4, mul is updated to 4, and diff-1≥2; step C3 expands the weight in the weight value list by 4 times (the original weight value 1 is expanded to 4), and adds a weight value 1. The new weight value list includes two weights 4 and 1, and recalculates prev_id, that is, recalculates the row logical sequence number of the original first row. According to the new weight value list, the information of the original first row has been updated to: sequence value 0, weight value subscript sequence 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 inserted is id_weight_index is the length of id_weight_list minus 1, which is 1. If the weight value is 1, the row logical number value is 2*1=1; the number value of the second row inserted is If id_weight_index is 1 and the weight value is 1, then the row logical sequence number value is 3*1=3.

[0120] The method of maintaining row logical sequence numbers in the embodiment of the present application can ensure that the generated row logical sequence numbers meet the basic requirements of uniqueness and orderliness. Specifically, during initialization, the id value of each row of data is taken from the auto-increment sequence with an initial value of 0 and a step size of 1, and the id_weight_index is all 0. At this time, the row logical sequence 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 original first row id, and the weight value is the same, which can ensure that the row logical sequence number of the newly inserted row data is smaller than the first row logical sequence number value; when inserting data into the end of the table, the id of the newly inserted row is larger than the original last row id, and the weight value is the same, which can ensure that the row logical sequence number value of the newly inserted row data is greater than the last row logical sequence number value; when inserting data into the middle of the table, the id takes the value at the n+1 equal-division point of the row logical sequence numbers of the two rows before and after, and the id_weight takes 1. The generated row logical sequence number must be between the row logical sequence number values of the two rows before and after the insertion. In this way, the uniqueness and orderliness of the row logical sequence numbers can be fully guaranteed.

[0121] In addition, this method can effectively improve the data processing efficiency and performance of the table. Specifically, when inserting data into the first or last row of the table, the id_weight_index in the row logical sequence number structure is fixed, and only the id of the newly inserted row needs to be calculated, and the amount of calculation is negligible; when inserting data into the middle part of the table, in addition to calculating the row logical sequence number for the newly inserted row, it is only necessary to trigger the doubling and expansion operations of the weight value list when diff-1 < n, and the size of the weight value list will not be large (the number of weight values therein will not be too many), and the amount of calculation is mainly related to the number of triggers; and when determining the row logical sequence number value of the inserted row, the row logical sequence number of the previous row is mainly used. Since the information of each row is independent and there is no specific rule that restricts or affects each other (such as not needing to increase according to a specific step size or requiring the values to be adjacent, etc.), the row logical sequence number of the previous row can be used for separate calculation, without considering or updating the row logical sequence numbers of all other rows, so the efficiency is significantly improved, especially when there are a lot of row data in the table, the performance improvement brought by this method is significant.

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

[0123] A row logical sequence number determination module 210 is used to determine the row logical sequence 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 sequence number corresponding to each row, and determine the row logical sequence number of the inserted row;

[0125] 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, the smallest weight value is 1, and the weight value subscript serial numbers corresponding to the weight values are integers that increase one by one starting from 0;

[0126] The serial number value corresponding to each row in the table is an integer specifically designed through calculation; each row corresponds to a corresponding weight value subscript serial number, and the weight value subscript serial number is used to indicate the position of the weight value corresponding to the corresponding row in the weight value list;

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

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

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

[0130] Initialize the weight value list, the initialized weight value list includes a weight value, and the weight value is 1;

[0131] If there is data in the table, the serial number value corresponding to each row is taken from the auto-increment sequence with an initial value of 0 and a step size of 1, and the subscript serial number of the weight value corresponding to each row is 0, and the weight value corresponding to each row is 1.

[0132] Based on any of the above embodiments, 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 includes:

[0133] When a row of data is inserted before the first row in the table, the serial number value corresponding to the inserted row is the serial number value corresponding to the original first row minus 1, the weight value subscript serial number corresponding to the inserted row is the weight value subscript serial number corresponding to the original first row, and the product of the weight value corresponding to the weight value subscript serial number corresponding to the inserted row and the serial number value corresponding to the inserted row is used as the row logical serial number of the inserted row.

[0134] Based on any of the above embodiments, 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 includes:

[0135] In the case of 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 serial number value corresponding to the inserted row is the serial number value corresponding to the original last row plus 1, the weight value subscript serial number corresponding to the inserted row is the weight value subscript serial number corresponding to the original last row, and the product of the weight value corresponding to the weight value subscript serial number corresponding to the inserted row and the serial number value corresponding to the inserted row is used as the row logical serial number of the inserted row.

[0136] Based on any of the above embodiments, 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 includes:

[0137] When n rows of data are inserted before the xth 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. If the xth row is not the first row, the first row logical number is the row logical number of the x-1th row, and the second row logical number is the row logical number of the original xth row.

[0138] According to the relationship between the absolute value minus 1 and n, the sequence number corresponding to the inserted row and the subscript number of the weight value corresponding to the inserted row are determined;

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

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

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

[0142] The serial number value corresponding to the i-th row is the sum of the logical serial number of the first row plus 1 and the i-th equal division point, and the i-th equal division point is obtained by dividing the result after subtracting 1 from the absolute value by n+1 equal divisions, and the weight value subscript serial number corresponding to the i-th row is the length of the weight value list minus 1.

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

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

[0145] If the result of the new absolute value minus 1 is less than n, repeatedly performing the doubling operation 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;

[0146] When the result of the new absolute value minus 1 is greater than or equal to n, for the inserted i-th row:

[0147] According to the new multiplier, all weight values in the weight value list are expanded by corresponding multiples, and a weight value of 1 is added to the last position in the weight value list to obtain a new weight value list, and the new first row logic number is calculated according to the new weight value list. The serial number value corresponding to the i-th row is the sum of the new first row logic serial number plus 1 and the i-th equal division point. The i-th equal division point is obtained by dividing the result after subtracting 1 from the absolute value by n+1 equal divisions. The weight value subscript serial number corresponding to the i-th row is the length of the new weight value list minus 1.

[0148] Based on any of the above embodiments, determining the sequence number corresponding to the inserted row and the weight subscript sequence number corresponding to the inserted row based on the relationship between the result of taking the absolute value minus 1 and n further includes:

[0149] If, after all weight values in the weight value list are expanded by corresponding multiples according to the new multiplier, the maximum weight value, the maximum row logical sequence number and / or the minimum row logical sequence number exceed the corresponding set thresholds, the weight value list is reinitialized, and the initialized weight value list includes a weight value, which is 1;

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

[0151] Based on any of the above embodiments, 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 includes:

[0152] When inserting n rows of data into the first row of the table, the n rows of data are inserted in reverse order;

[0153] Wherein, n is an integer greater than 1;

[0154] For each row of data inserted, the serial number value corresponding to the inserted row is the serial number value corresponding to the original first row minus 1, the weight value subscript serial number corresponding to the inserted row is the weight value subscript serial number corresponding to the original first row, and the product of the weight value corresponding to the weight value subscript serial number corresponding to the inserted row and the serial number value corresponding to the inserted row is used as the row logical serial number of the inserted row.

[0155] The apparatus for processing data based on row logical sequence numbers provided in an embodiment of the present application can be used to execute the method for processing data based on row logical sequence numbers 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 that can be used to implement embodiments of the present 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 can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, user equipment, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are provided for example only and are not intended to limit the implementation of the present application as 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, a random access memory (RAM) 13, etc., which is communicatively connected to the at least one processor 11. The memory stores a computer program that can be executed by the at least one processor. The processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 into the random access memory (RAM) 13. Various programs and data required for the operation of the electronic device 10 can also be stored in the RAM 13. The processor 11, ROM 12, and RAM 13 are connected to each other via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

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

[0159] The processor 11 may be any general-purpose and / or specialized processing component with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above.

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

[0161] Various embodiments of the systems and techniques described 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), system-on-chip systems (SOCs), programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0162] Computer programs for implementing the methods of the present 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 the computer program is executed by the processor, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The computer program may be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0163] In the context of the present application, a computer-readable storage medium can be a tangible medium that can contain or store a computer program for use by an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. A computer-readable storage medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, 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 having: 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 can provide input to the electronic device 10. Other types of devices can also be used to provide interaction with the user; for example, the 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 acoustic input, voice input, or tactile input).

[0165] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end 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 techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0166] A computing system may include clients and servers. The clients and servers are typically remote from each other and typically interact via a communication network. This client-server relationship arises through computer programs running on the respective computers, creating a client-server relationship. The server may be a cloud server, also known as a cloud computing server or cloud host. This server is a hosting product within the cloud computing service ecosystem that addresses the management difficulties and limited scalability of traditional physical hosting and VPS services.

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

[0168] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this application can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution of this application can be achieved. This is not limited herein.

[0169] The above specific embodiments do not constitute a limitation on the scope of protection of this application. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application shall be included within the scope of protection of this application.

Claims

1. A method for processing data based on row logical sequence numbers, characterized in that: include: Determine the row logical sequence number corresponding to each row in the 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, the smallest weight value is 1, and the weight value subscript serial numbers corresponding to the weight values are integers that increase one by one starting from 0; The serial number value corresponding to each row in the table is an integer specifically designed through calculation; each row corresponds to a corresponding weight value subscript serial number, and the weight value subscript serial number 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 sequence number value corresponding to the row and the weight value corresponding to the row.

2. The method according to claim 1, characterized in that Determining the row logical sequence number corresponding to each row in the table includes: Initialize the weight value list, the initialized weight value list includes a weight value, and the weight value is 1; If there is data in the table, the serial number value corresponding to each row is taken from the auto-increment sequence with an initial value of 0 and a step size of 1, and the subscript serial number of the weight value corresponding to each row is 0, and the weight value corresponding to each row is 1.

3. The method according to claim 1, characterized in that Inserting or deleting row data in the table according to the row logical serial number corresponding to each row, and determining the row logical serial 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 increases one by one starting from 0, the weight value subscript serial number corresponding to each inserted row is 0, and for each inserted row, the row logical serial number of the inserted row is the product of the weight value corresponding to the weight value subscript serial number corresponding to the inserted row and the serial number value corresponding to the inserted row; Wherein, n is a positive integer.

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

5. The method according to claim 1, wherein Inserting or deleting row data in the table according to the row logical serial number corresponding to each row, and determining the row logical serial number of the inserted row, includes: When inserting n rows of data into the first row of the table, the n rows of data are inserted in reverse order; Wherein, n is an integer greater than 1; For each row of data inserted, the serial number value corresponding to the inserted row is the serial number value corresponding to the original first row minus 1, the weight value subscript serial number corresponding to the inserted row is the weight value subscript serial number corresponding to the original first row, and the product of the weight value corresponding to the weight value subscript serial number corresponding to the inserted row and the serial number value corresponding to the inserted row is used as the row logical serial number of the inserted row.

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

7. The method according to claim 1, characterized in that Inserting or deleting row data in the table according to the row logical serial number corresponding to each row, and determining the row logical serial number of the inserted row, includes: When n rows of data are inserted before the xth 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. If the xth row is not the first row, the first row logical number is the row logical number of the x-1th row, and the second row logical number is the row logical number of the original xth row. Based on the relationship between the result of taking the absolute value minus 1 and n, determine the serial number value corresponding to the inserted row and the subscript serial number of the weight value corresponding to the inserted row, and use the product of the weight value corresponding to the subscript serial number of the inserted row and the serial number value corresponding to the inserted row as the row logical serial number; Wherein, n is a positive integer.

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

9. The method according to claim 7, characterized in that The determining of the sequence number value corresponding to the inserted row and the weight value subscript sequence number corresponding to the inserted row according to the relationship between the result of taking the absolute value minus 1 and n includes: Let the multiplier be 1. If the result of subtracting 1 from the absolute value is less than n, then the absolute value and the multiplier are doubled to obtain new absolute value and new multiplier respectively. If the result of the new absolute value minus 1 is less than n, repeatedly performing the doubling operation 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; When the result of the new absolute value minus 1 is greater than or equal to n, for the inserted i-th row: According to the new multiplier, all weight values in the weight value list are expanded by corresponding multiples, and a weight value of 1 is added to the last position in the weight value list to obtain a new weight value list, and the new first-row logical number is calculated according to the new weight value list. The serial number value corresponding to the i-th row is the sum of the new first-row logical serial number plus 1 and the i-th equal division point. The i-th equal division point is obtained by dividing the result after subtracting 1 from the absolute value by n+1 equal divisions, and the weight value subscript serial number corresponding to the i-th row is the length of the new weight value list minus 1.

10. The method according to claim 9, characterized in that The step of determining the sequence number corresponding to the inserted row and the weight subscript sequence number corresponding to the inserted row based on the relationship between the result of subtracting 1 from the absolute value and n also includes: If, after all weight values in the weight value list are expanded by corresponding multiples according to the new multiplier, the maximum weight value, the maximum row logical sequence number and / or the minimum row logical sequence number exceed the corresponding set thresholds, the weight value list is reinitialized, and the initialized weight value list includes a weight value, which is 1; The serial number value corresponding to each row in the table is taken in sequence from a self-incrementing sequence with an initial value of 0 and a step size of 1, and the subscript serial number of the weight value corresponding to each row is 0, and the weight value corresponding to each row is 1.

11. A device for processing data based on row logical sequence numbers, characterized in that: include: A row logical sequence number determination module is used to determine the row logical sequence number corresponding to each row in the table; A data processing module, configured to insert or delete row data in the table according to the row logical sequence number corresponding to each row, and determine 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, the smallest weight value is 1, and the weight value subscript serial numbers corresponding to the weight values are integers that increase one by one starting from 0; The serial number value corresponding to each row in the table is an integer specifically designed through calculation; each row corresponds to a corresponding weight value subscript serial number, and the weight value subscript serial number 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 sequence number value corresponding to the row and the weight value corresponding to the row.

12. 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 executable by the at least one processor. The computer program is executed by the at least one processor to enable the at least one processor to perform the method for processing data based on row logical sequence numbers according to any one of claims 1 to 10.

13. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method for processing data based on row logical sequence numbers as claimed in any one of claims 1 to 10 is implemented.

14. A computer program product comprising a computer program and / or instructions, characterized in that When the computer program and / or instructions are executed by a processor, the method for processing data based on row logical sequence numbers according to any one of claims 1 to 10 is implemented.

Citation Information

Patent Citations

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

    CN113435170A

  • Inductive position sensor

    WO2006067420A1