Data processing method and device, computer readable storage medium and electronic equipment
By generating data index rows and row data tables, the contradiction between memory overhead and read speed in existing technologies is resolved. This reduces memory usage without affecting read speed and supports data tables with sparse headers, thereby improving query performance.
Patent Information
- Application Number
- CN202211574827.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-08
- Publication Date
- 2026-03-03
- Estimated Expiration
- 2042-12-08
AI Technical Summary
While existing configuration table processing methods can reduce memory overhead, they result in slower read speeds and are difficult to support data tables with sparse headers, thus failing to effectively reduce memory overhead.
By obtaining the data table to be processed, determining the data index row corresponding to each column key, and generating a row data table based on the cell data in each data row, only the data index row and the row data table are stored, reducing memory usage, and data retrieval is performed directly using the data index during querying.
Without affecting read speed, the memory overhead of the configuration table is reduced, supporting data tables with sparse headers and improving the query performance of the data table.
Smart Images

Figure CN115981550B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, specifically to a data processing method, apparatus, computer-readable storage medium, and electronic device. Background Technology
[0002] Game development involves a significant amount of configuration work, with the configuration data ultimately stored in configuration tables. These tables are typically presented as dictionaries within the game. During gameplay, data is frequently retrieved from these configuration tables. Therefore, minimizing the memory overhead associated with reading these tables is crucial.
[0003] However, while existing configuration table processing methods can reduce the memory overhead when reading configuration tables, they can lead to slower reading speeds. Summary of the Invention
[0004] The purpose of this application is to provide a data processing method, apparatus, computer-readable storage medium, and electronic device to reduce the memory overhead when reading configuration tables without affecting the reading speed.
[0005] This application provides a data processing method, including:
[0006] Obtain the data table to be processed. The data table includes at least one column key and at least one data row. Each data row includes at least one cell of data, and each cell of data corresponds to a column key.
[0007] Determine the data index row corresponding to each column key. The data index row includes at least one data index. Each data index corresponds to at least one data row, and each data index is used to index the cell data in its corresponding data row that corresponds to the same column key.
[0008] Generate a row data table corresponding to each data row based on the data of each cell in each data row;
[0009] Store the data index rows and the corresponding row data table for each data row.
[0010] This application also provides a data processing apparatus, including:
[0011] The acquisition module is used to acquire a data table to be processed. The data table to be processed includes at least one column key and at least one data row. Each data row includes at least one cell of data, and each cell of data corresponds to a column key.
[0012] The first determining module is used to determine the data index row corresponding to each column key. The data index row includes at least one data index, each data index corresponds to at least one data row, and each data index is used to index the cell data in its corresponding data row that corresponds to the same column key.
[0013] The generation module is used to generate a row data table corresponding to each data row based on the data in each cell of each data row.
[0014] The storage module is used to store the data index rows and the row data table corresponding to each data row.
[0015] This application also provides a computer-readable storage medium storing a computer program adapted for loading by a processor to execute any of the above-described data processing methods.
[0016] This application also provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes any of the above-described data processing methods by calling the computer program stored in the memory.
[0017] The data processing method, apparatus, computer-readable storage medium, and electronic device provided in this application acquire a data table to be processed, which includes at least one column key and at least one data row. Each data row includes at least one cell of data, and each cell of data corresponds to a column key. A data index row is determined for each column key, and the data index row includes at least one data index. Each data index corresponds to at least one data row, and each data index is used to index the cell of data in its corresponding data row that corresponds to the same column key. Then, a row data table corresponding to each data row is generated based on the cell data in each data row, and the data index row and the row data table corresponding to each data row are stored. Therefore, when storing the data table to be processed, only the data index row corresponding to each column key and the row data table corresponding to each data row of the data table need to be stored in memory, without having to store each data row of the data table as a separate key-value pair. This reduces the memory overhead when storing the data table. Furthermore, when performing query operations on the data table, it is only necessary to determine the data index corresponding to the data row to be queried from the data index row corresponding to the column key of the column to be queried. This data index can then be used directly to index the corresponding cell data from the row data table corresponding to the data row to be queried. Compared to the conventional method of indexing the corresponding value from the key-value pair corresponding to the data row to obtain the query result using the column key, this does not sacrifice the data table's read performance. Therefore, data table compression can be achieved without affecting read speed, thereby reducing the memory overhead occupied during data table read operations. Attached Figure Description
[0018] The technical solution and other beneficial effects of this application will become apparent from the following detailed description of specific embodiments in conjunction with the accompanying drawings.
[0019] Figure 1 This is a schematic diagram of a data processing system provided in an embodiment of this application;
[0020] Figure 2 This is a flowchart illustrating the data processing method provided in an embodiment of this application;
[0021] Figure 3 This is a schematic diagram of the structure of the data table to be processed provided in the embodiments of this application;
[0022] Figure 4 This is a schematic diagram of the structure of the data index table provided in an embodiment of this application;
[0023] Figure 5 This is another structural diagram of the data index table provided in the embodiments of this application;
[0024] Figure 6 This is another schematic flowchart of the data processing method provided in the embodiments of this application;
[0025] Figure 7 This is another schematic flowchart of the data processing method provided in the embodiments of this application;
[0026] Figure 8 This is a schematic diagram of the structure of the row data table provided in the embodiments of this application;
[0027] Figure 9 This is another schematic flowchart of the data processing method provided in the embodiments of this application;
[0028] Figure 10 This is a schematic diagram of the structure of the data processing apparatus provided in the embodiments of this application;
[0029] Figure 11 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0030] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0031] Game development involves extensive configuration work, with the configuration data ultimately stored in configuration tables. In games developed using Python as a scripting language, this data is typically stored as a two-dimensional dictionary (dict). During gameplay, the configuration table is frequently accessed. Therefore, games place high demands on the configuration table's performance in terms of both read speed and memory usage.
[0032] However, since mobile games often have limited memory budgets due to device constraints, existing data table compression schemes typically focus more on compressing memory usage, which can lead to varying degrees of performance loss in configuration table reads.
[0033] For example, a data table compression scheme may include: when storing the data table, pre-defining and determining the order of the column headers of all columns of the two-dimensional data table to be stored as a header definition table; then organizing all data values in each data row of the two-dimensional data table into a list according to the order of the column headers to obtain the value list of each data row; subsequently, when querying the data table, given the row key of the row to be queried and the column key of the column to be queried, the pre-stored value list of that row is retrieved through the row key of the row to be queried, and then, in conjunction with the header definition table, a key-value pair dictionary is regenerated, and the value corresponding to the column key of the column to be queried is obtained from the key-value pair dictionary as the query result.
[0034] It should be noted that when using this data table compression scheme to store data tables, since the resident memory overhead is only the global table header definition table and the value list of each data row (rather than key-value pairs), the memory overhead of this data table compression scheme will be lower than the memory overhead of the conventional method of storing each data row of the data table using key-value pairs.
[0035] However, when using this data table compression scheme to query the data table, there are many steps involved, which leads to poor data table query performance. This is because a key-value pair dictionary needs to be generated based on the current row to be queried, the table header definition table, and the value list before the data value of a certain table header in a row can be queried.
[0036] Furthermore, this data table compression scheme has a problem in supporting data tables with sparse headers. For example, for a data table with 200 column keys, but each data row only contains 5 of those column keys, if this data table compression scheme is used for storage, it will result in 195 null values in the value list of each data row. This will cause a sharp increase in the memory overhead of the data structure (or data description method), and it cannot be guaranteed that the memory overhead can be effectively reduced.
[0037] To address the aforementioned issues, embodiments of this application provide a data processing method, apparatus, computer-readable storage medium, and electronic device to improve existing data table compression schemes. The improved data table compression schemes can support data tables with sparse headers and effectively reduce memory overhead without affecting read performance.
[0038] Please see Figure 1 , Figure 1This is a schematic diagram of a data processing system provided in an embodiment of this application. The data processing system may include any of the data processing devices provided in the embodiments of this application. The data processing device may be integrated into electronic devices such as terminals or servers. The terminal may be a smartphone, tablet computer, smart Bluetooth device, laptop computer, or personal computer (PC). The server may be a single server or a server cluster composed of multiple servers.
[0039] The electronic device can acquire a data table to be processed, which includes at least one column key and at least one data row. Each data row includes at least one cell of data, and each cell of data corresponds to a column key. It can determine the data index row corresponding to each column key. The data index row includes at least one data index, and each data index corresponds to at least one data row. Each data index is used to index the cell of data in its corresponding data row that corresponds to the same column key. It can generate a row data table corresponding to each data row based on the cell of data in each data row. It can store the data index row and the row data table corresponding to each data row.
[0040] The data table to be processed can be a two-dimensional table with multiple rows and columns. Each row of the data table can have a row key for indexing, and each column can have a column key for indexing the data in each cell of that row. The first row of the data table can be the header row, and from the second row onwards, each row can be a data row. The header of each column indicates the data type of that column. Cells in the same column belong to the same data type and can correspond to the column key of that column. Each data row can have multiple cells, each of which can store one cell of data or be empty (i.e., no cell data is stored). For each column key, the corresponding data index row can indicate the cell data in all data rows corresponding to that column key. For each data row, the row data table corresponding to that data row can store all the cell data of that data row.
[0041] In one example, such as Figure 1As shown, the aforementioned data processing system may include a terminal and a server communicatively connected to the terminal. Specifically, when a user wants to read or perform other operations on the data in the aforementioned data table to be processed, they can send a data processing request to the server through their terminal. The server can then receive the data processing request, obtain the aforementioned data table to be processed based on the request, and determine the data index rows corresponding to each column key of the data table to be processed. Subsequently, the server can generate a row data table corresponding to each data row based on the data in each cell of each data row, and store the data index rows corresponding to each column key and the row data tables corresponding to each data row. Then, the server can perform data processing operations such as reading, deleting, and replacing related to the aforementioned data table to be processed based on the stored data index rows and row data tables.
[0042] Please see Figure 2 , Figure 2 This is a flowchart illustrating the data processing method provided in an embodiment of this application. The specific flow of the data processing method can be as follows:
[0043] S101. Obtain the data table to be processed. The data table to be processed includes at least one column key and at least one data row. Each data row includes at least one cell of data, and each cell of data corresponds to a column key.
[0044] In this embodiment, the data table to be processed can be a two-dimensional data table, such as a configuration table. In one example, the data table to be processed can be a two-dimensional data table derived from a set of configuration data during game development. The cell data can be text, numbers, images, or link addresses, etc.
[0045] Specifically, the aforementioned data table to be processed may have at least one row and at least one column, and each row of the aforementioned data table to be processed may have a row key for indexing, and each column of the aforementioned data table to be processed may have a column key for indexing the data of each cell in each row.
[0046] In some embodiments, the data table to be processed may have multiple rows and at least one column. The first row of the data table may be a header row, and each subsequent row may consist entirely of data rows. The header of each column indicates the data type of that column. Cell data within the same column belong to the same data type and can correspond to the column key of that column. In one example, the row key of each row in the data table to be processed may be the row number of that row. In another example, the column key of each column in the data table to be processed may be the header information of that column (e.g., the header name).
[0047] Specifically, each data row in the aforementioned data table can correspond to a single row of data content within that table. Each data row can have multiple cells, and each cell can store one data point or be empty (i.e., no data is stored). The number of cells in each data row can be less than or equal to the number of column keys in the aforementioned data table. In the aforementioned data table, cells belonging to the same data row correspond to the same row key, cells belonging to different data rows correspond to different row keys, and different cells belonging to the same data row correspond to different column keys.
[0048] In a specific example, the aforementioned data table to be processed can be as follows: Figure 3 As shown, the data table to be processed is a two-dimensional data table with 11 rows and 9 columns. The first row of the data table to be processed is the header row, and the second to 11th rows are all data rows. The row keys of the data rows of the data table to be processed can be defined from top to bottom as "row key 1", "row key 2", "row key 3", "row key 4", "row key 5", "row key 6", "row key 7", "row key 8", "row key 9" and "row key 10". The header row of the data table to be processed includes the header names of each column, namely "BasicGraph", "DieGraph", "Models", "Modelslist", "ModelslistWeight", "Pparams", "Ptype", "Skeleton", and "animIndex". The column key of each column can be the header name of that column. Specifically, the data rows in the second, fifth, and seventh rows each contain eight cells of data, while the data rows in the third, fourth, sixth, eighth, ninth, tenth, and eleventh rows each contain six cells of data.
[0049] S102. Determine the data index row corresponding to each column key. The data index row includes at least one data index. Each data index corresponds to at least one data row, and each data index is used to index the cell data in its corresponding data row that corresponds to the same column key.
[0050] In this embodiment, for each column key, the data index row corresponding to that column key can indicate the cell data in all data rows corresponding to that column key. Different cell data belonging to the same data row can correspond to different data indices. Furthermore, it is understood that for each data index, the data index, the column key corresponding to the data index, and the row key of the data row corresponding to the data index can all be used to index the corresponding cell data.
[0051] In one example, with Figure 3 Taking the data table to be processed as an example, the data index rows corresponding to each column key of the data table to be processed can be as follows: Figure 4 As shown. For ease of understanding, the following is an example. Figure 4 Taking the column key "BasicGraph" as an example, the data indices in the data index row corresponding to the column key "BasicGraph" can be: x00; x00; x00; x00; x00; x00; x00; x00; x00. Furthermore, each data index in the data index row corresponding to the column key "BasicGraph" can correspond one-to-one with each of the aforementioned data rows.
[0052] In another example, with Figure 3 Taking the data table to be processed as an example, the data index rows corresponding to each column key of the data table to be processed can also be as follows: Figure 5 As shown. For ease of understanding, the following is an example. Figure 5 Taking the column key "BasicGraph" as an example, the data indices in the data index row corresponding to the column key "BasicGraph" can be x00; x00; x00. Furthermore, the first data index "x00" in the data index row corresponding to the column key "BasicGraph" can correspond to the data row belonging to row key 1; the second data index "x00" can correspond to the data rows belonging to row key 2, row key 3, row key 5, row key 7, row key 8, row key 9, and row key 10; and the third data index "x00" can correspond to the data rows belonging to row key 4 and row key 6.
[0053] In some embodiments, such as Figure 6 As shown, the above S102 can specifically include:
[0054] S1021. Determine the first arrangement order of each column key.
[0055] Specifically, the data processing device can sort the multiple column keys according to the column number of the column to which each column key belongs, thereby obtaining a first arrangement order of the column keys. Each column key can have a unique sorting number in the first arrangement order, and in one example, for each column key, the smaller the column number of the column to which the column key belongs, the earlier the arrangement number of the corresponding column key can be.
[0056] by Figure 3 Taking the data table to be processed as an example, the first sorting order of the column keys of the data table to be processed can be "BasicGraph-"DieGraph"-"Models"-"Modelslist"-"ModelslistWeight"-"Pparams"-"Ptype"-"Skeleton"-"animIndex".
[0057] S1022. Based on the first arrangement order and the column key corresponding to each cell data in each data row, determine the data index column corresponding to each data row. The data index column includes at least one data index corresponding to at least one column key.
[0058] In this embodiment, each data row can correspond to a data index column, and the data index columns corresponding to different data rows can be the same or different. For each column key, there can be a data index corresponding to that column key in the data index column corresponding to each data row. Furthermore, the data indexes corresponding to the same column key in the data index columns corresponding to different data rows can be the same or different.
[0059] Specifically, for each data row, if the number of cells in the data row is equal to the number of column keys in the data table to be processed, then all column keys in the data table to be processed can be indexed to corresponding cells in that data row. Furthermore, for each data row, if the number of cells in the data row is less than the number of column keys in the data table to be processed, then some column keys in the data table to be processed will not be indexed to corresponding cells in that data row.
[0060] Furthermore, to ensure that each cell in each data row can be indexed by its corresponding column key, the data indices of the column keys corresponding to the data data in the corresponding data index column of each data row can be different. In practice, for each data row, the data processing device can determine the data index of the column key corresponding to each cell in the data row based on its sequence number in the first sorting order, thereby obtaining the corresponding data index column.
[0061] In one example, to obtain the data index column corresponding to each data row, S1022 above can specifically include:
[0062] S1-1. Determine the second arrangement order of the data in each cell of each data row based on the first arrangement order.
[0063] Specifically, for each data row, the data processing device can sort the data in each cell of the data row according to the arrangement number of the column key corresponding to each cell in the first arrangement order, thereby obtaining a second arrangement order of the data in the data row. For each data row, in the second arrangement order of the data in the data row, each cell in the data row can correspond to a unique sorting number, and in one example, the earlier the arrangement number of the column key corresponding to each cell in the data row is in the first arrangement order, the earlier the arrangement number of each cell in the data row can be.
[0064] S1-2. Based on the second arrangement order and the column key corresponding to each cell data in each data row, determine the data index column corresponding to each data row.
[0065] Specifically, for each data row, the data processing device can determine the data index of the column key corresponding to each cell in the data row based on the second sorting order of the data in the data row. In one example, for each data row, the data index of the column key corresponding to each cell in the data row can be specifically the sequence number of each cell in the data row.
[0066] In some embodiments, for each data row, when the number of cell data included in the data row is less than the number of column keys included in the data table to be processed, that is, when some column keys of the data table to be processed cannot be indexed to the corresponding cell data in the data row, the data processing device can use a preset index as the data index of the column keys that cannot be indexed to the corresponding cell data in the data row, thereby obtaining a data index column corresponding to the data row composed of the data indexes of each column key of the data table to be processed in the data row.
[0067] Furthermore, to ensure that each cell in each data row can be accurately indexed by its corresponding column key, the data index of a column key that cannot be indexed in that data row (e.g., the preset index mentioned above) can be different from the data index of a column key that can be indexed in that data row. In one example, the preset index can be a numerical value, such as 0xFF.
[0068] Specifically, with Figure 3 Taking the data table to be processed as an example, if the first sorting order of the column keys of the data table to be processed is defined as "BasicGraph-"DieGraph"-"Models"-"Modelslist"-"ModelslistWeight"-"Pparams"-"Ptype"-"Skeleton"-"animIndex", then in the data table to be processed:
[0069] The second sorting order of the data in the data row belonging to row key 1 can be "A1XX-"C1XX"-"D1XX"-"E1XX"-"F1XX"-"G1XX"-"H1XX"-"I1XX";
[0070] The second sorting order of the data in the data row belonging to row key 2 can be "A2XX-"B2XX"-"C2XX"-"D2XX"-"E2XX"-"H2XX";
[0071] The second sorting order of the data in the data row belonging to row key 3 can be "A3XX-"B3XX"-"C3XX"-"D3XX"-"E3XX"-"H3XX";
[0072] The second sorting order of the data in the data row belonging to row key 4 can be "A4XX-"B4XX"-"C4XX"-"D4XX"-"E4XX"-"F4XX"-"G4XX"-"H4XX";
[0073] The second sorting order of the data in the data row belonging to row key 5 can be "A5XX-"B5XX"-"C5XX"-"D5XX"-"E5XX"-"H5XX";
[0074] The second sorting order of the data in the data row belonging to row key 6 can be "A6XX-"B6XX"-"C6XX"-"D6XX"-"E6XX"-"F6XX"-"G6XX"-"H6XX";
[0075] The second sorting order of the data in the data row belonging to row key 7 can be "A7XX-"B7XX"-"C7XX"-"D7XX"-"E7XX"-"H7XX";
[0076] The second sorting order of the data in the data row belonging to row key 8 can be "A8XX-"B7XX"-"C8XX"-"D8XX"-"E8XX"-"H8XX";
[0077] The second sorting order of the data in the data row belonging to row key 9 can be "A9XX-"B9XX"-"C9XX"-"D9XX"-"E9XX"-"H9XX";
[0078] The second sorting order of the data in the data row belonging to row key 10 can be "A10XX-"B10XX"-"C10XX"-"D10XX"-"E10XX"-"H10XX".
[0079] Furthermore, if for each data row, the second arrangement order of the cell data in that data row is defined, from front to back, as "x00", "x01", "x02", "x03", ..., "x0n", where (n+1) equals the number of cells included in that data row, then as follows... Figure 4 As shown in the data table to be processed:
[0080] The data indices in the data index column corresponding to the data row to which row key 1 belongs can be x00, xff, x01, x02, x03, x04, x05, x06, x07 respectively;
[0081] The data indices in the data index column corresponding to the data row to which row key 2 belongs can be x00, x01, x02, x03, x04, xff, xff, x05, xff;
[0082] The data indices in the data index column corresponding to the data row to which row key 3 belongs can be x00, x01, x02, x03, x04, xff, xff, x05, xff respectively;
[0083] The data indices in the data index column corresponding to the data row to which row key 4 belongs can be x00, x01, x02, x03, x04, x05, x06, x07, and xff, respectively.
[0084] The data indices in the data index column corresponding to the data row to which row key 5 belongs can be x00, x01, x02, x03, x04, xff, xff, x05, xff respectively;
[0085] The data indices in the data index column corresponding to the data row to which row key 6 belongs can be x00, x01, x02, x03, x04, x05, x06, x07, and xff, respectively.
[0086] The data indices in the data index column corresponding to the data row to which row key 7 belongs can be x00, x01, x02, x03, x04, xff, xff, x05, xff;
[0087] The data indices in the data index column corresponding to the data row to which row key 8 belongs can be x00, x01, x02, x03, x04, xff, xff, x05, xff;
[0088] The data indices in the data index column corresponding to the data row to which row key 9 belongs can be x00, x01, x02, x03, x04, xff, xff, x05, xff;
[0089] The data indices in the data index column corresponding to the data row to which row key 10 belongs can be x00, x01, x02, x03, x04, xff, xff, x05, and xff, respectively.
[0090] S1023. Determine the data index row corresponding to each column key based on the data index column corresponding to each data row.
[0091] Specifically, after obtaining the data index columns corresponding to each data row, the aforementioned data processing device can determine the data index of each column key in each data row based on the data index of each column key in each data row, thereby obtaining the data index row corresponding to each column key. Furthermore, it can be understood that for each column key, the data index row corresponding to that column key can be composed of the data indexes of that column key in each data row.
[0092] In some specific embodiments, in order to obtain a more compact data structure or data description method after compressing the above-mentioned data table, such as... Figure 7 As shown, S1022 above can specifically include:
[0093] S2-1. Determine the column key corresponding to each cell data in each data row to obtain the set of column keys corresponding to each data row.
[0094] Specifically, for each data row, each column key in the corresponding column key set can be indexed to a unique cell data in that data row.
[0095] For example, with Figure 3Taking the data table to be processed as an example, in this data table:
[0096] The set of column keys corresponding to the data row to which row key 1 belongs can be {"BasicGraph"; "Models"; "Modelslist"; "ModelslistWeight"; "Pparams"; "Ptype"; "Skeleton"; "animIndex"};
[0097] The set of column keys corresponding to the data row to which row key 2 belongs can be {"BasicGraph"; "DieGraph"; "Models"; "Modelslist"; "ModelslistWeight"; "Skeleton"};
[0098] The set of column keys corresponding to the data row to which row key 3 belongs can be {"BasicGraph"; "DieGraph"; "Models"; "Modelslist"; "ModelslistWeight"; "Skeleton"};
[0099] The set of column keys corresponding to the data row to which row key 4 belongs can be {"BasicGraph"; "DieGraph"; "Models"; "Modelslist"; "ModelslistWeight"; "Pparams"; "Ptype"; "Skeleton"};
[0100] The set of column keys corresponding to the data row to which row key 5 belongs can be {"BasicGraph"; "DieGraph"; "Models"; "Modelslist"; "ModelslistWeight"; "Skeleton"};
[0101] The set of column keys corresponding to the data row to which row key 6 belongs can be {"BasicGraph"; "DieGraph"; "Models"; "Modelslist"; "ModelslistWeight"; "Pparams"; "Ptype"; "Skeleton"};
[0102] The set of column keys corresponding to the data row to which row key 7 belongs can be {"BasicGraph"; "DieGraph"; "Models"; "Modelslist"; "ModelslistWeight"; "Skeleton"};
[0103] The set of column keys corresponding to the data row to which row key 8 belongs can be {"BasicGraph"; "DieGraph"; "Models"; "Modelslist"; "ModelslistWeight"; "Skeleton"};
[0104] The set of column keys corresponding to the data row to which row key 9 belongs can be {"BasicGraph"; "DieGraph"; "Models"; "Modelslist"; "ModelslistWeight"; "Skeleton"};
[0105] The set of column keys corresponding to the data row to which row key 10 belongs can be {"BasicGraph"; "DieGraph"; "Models"; "Modelslist"; "ModelslistWeight"; "Skeleton"}.
[0106] S2-2. Group data rows with the same corresponding column key set into one category.
[0107] Specifically, after grouping data rows with the same set of column keys into one category, at least one type of data rows can be obtained. Each type of data row can contain one or more rows, and all data rows of the same type contain the same number of cells, with the corresponding column keys being identical.
[0108] Continuing from the previous example, in Figure 3 In the data table shown, the column key sets corresponding to the data rows belonging to row key 2, row key 3, row key 5, row key 7, row key 8, and row key 9 are the same. Therefore, the data rows belonging to row key 2, row key 3, row key 5, row key 7, row key 8, row key 9, and row key 10 belong to the same type of data rows (e.g., the first type of data rows). The column key sets corresponding to the data rows belonging to row key 4 and row key 6 are the same. Therefore, the data rows belonging to row key 4 and row key 6 belong to the same type of data rows (e.g., the second type of data rows). The data rows belonging to row key 1 belong to another type of data rows that are different from the first two types (e.g., the third type of data rows).
[0109] S2-3. Based on the first arrangement order and the set of column keys corresponding to each type of data row, determine the data index column corresponding to each type of data row.
[0110] In this embodiment, the data index columns corresponding to each data row of the same type can be the same. Therefore, the data index column corresponding to any data row of each type is obtained, that is, the data index column corresponding to the data row of each type is obtained.
[0111] Specifically, in order to obtain the data index column corresponding to each type of data row, S2-3 above can specifically include:
[0112] S2-3-1. Determine the third arrangement order of the data in each cell of a data row for each type based on the first arrangement order.
[0113] Specifically, the specific implementation of S2-3-1 can refer to the specific implementation of S1-1. The specific implementation of S1-1 only requires replacing each data row with a data row of each type and replacing the second arrangement order with the third arrangement order to obtain the specific implementation of S2-3-1. Therefore, it will not be described in detail here.
[0114] S2-3-2. Based on the third arrangement order and the column keys corresponding to the data in each cell of a data row of each type, determine the data index column corresponding to a data row of each type.
[0115] Specifically, the specific implementation of S2-3-2 can refer to the specific implementation of S1-2. The specific implementation of S1-2 only requires replacing each data row with one data row of each type and replacing the second arrangement order with the third arrangement order to obtain the specific implementation of S2-3-2. Therefore, it will not be described in detail here.
[0116] Continuing from the previous example, such as Figure 5 As shown, in Figure 3 The table of data to be processed shown below:
[0117] The data indices in the data index column corresponding to the data rows of the first type can be x00, x01, x02, x03, x04, xff, xff, x05, xff;
[0118] The data indices in the data index column corresponding to the data rows of the second type can be x00, x01, x02, x03, x04, x05, x06, x07, and xff, respectively.
[0119] The data indices in the data index column corresponding to the data rows of the third category can be x00, xff, x01, x02, x03, x04, x05, x06, and x07, respectively.
[0120] In the embodiments where S1022 includes S2-1, S2-2, and S2-3, as shown above... Figure 4 As shown, S1023 can specifically include: determining the data index column row corresponding to each column key based on the data index column corresponding to each type of data row. Specifically, after obtaining the data index column corresponding to one data row of each type, that is, after obtaining the data index column corresponding to each type of data row, the data processing device can determine the data index of each column key in each type of data row based on the data index of each column key in each type of data row, thereby obtaining the data index row corresponding to each column key. Furthermore, it can be understood that for each column key, the data index row corresponding to that column key can be composed of the data indexes of that column key in each type of data row, and the data index of that column key is the same in each data row of the same type. Therefore, when compressing the above-mentioned data table to be processed, it is only necessary to determine the data index column corresponding to one data row of each type, without having to determine the data index columns corresponding to all data rows separately, thus improving memory compression ratio and data processing efficiency.
[0121] S103. Generate a row data table corresponding to each data row based on the data of each cell in each data row.
[0122] In this embodiment, each data row can correspond to a unique row data table, and the data of each cell included in each data row will be stored in its corresponding row data table. Thus, when performing related operations on the above-mentioned data table to be processed, the above-mentioned row data table can be used to replace the corresponding data row in the above-mentioned data to be processed, thereby reducing the memory consumption occupied when performing related operations on the above-mentioned data table to be processed.
[0123] Specifically, after obtaining the row data table corresponding to each data row in the aforementioned data table to be processed, each row data table can represent the corresponding data row in the aforementioned data table to perform relevant operations. Accordingly, in the aforementioned data index rows, each data index can correspond to at least one row data table, and each data index can be specifically used to index the cell data in its corresponding row data table that corresponds to the same column key.
[0124] In the above embodiment where the data index row corresponding to each column key is determined based on the data index column corresponding to each data row, each data row corresponds to a data index column, each data index column can have a unique column number, and for each data row, the column number of the data index column corresponding to that data row can be stored in the row data table. Therefore, when querying a column of a row in the above-mentioned data table to be processed, the row key of the row to be queried can be directly used to index the row data table and data index column corresponding to that row. Furthermore, the column key of the column to be queried can be directly used to index the data index corresponding to the row and column to be queried from the indexed data index column. Thus, the corresponding cell data can be found based on the indexed data, thereby improving the data table query performance of the client / server.
[0125] In some embodiments, for each data row, the row data table corresponding to that data row can be indexed by the row key of that data row. Thus, when querying a row of the data table to be processed, the row key of the row to be queried can be used directly to index the row data table corresponding to that row, thereby reducing the impact on read speed.
[0126] In some specific embodiments, S103 may specifically include: generating a row data table corresponding to each data row based on the second arrangement order and the data of each cell in each data row. Specifically, for each data row, the data processing device may, according to the second arrangement order of the data of each cell in the data row, sequentially store the data of each cell in the data row into a preset data table to obtain the row data table corresponding to the data row.
[0127] In some examples, such as Figure 8 As shown, for each data row, the corresponding row data table can be a one-dimensional data table, i.e., a row data table. For example, it can be a one-dimensional data table with one column and multiple rows. Furthermore, the data of each cell in the data row can be stored in the rows of the row data table in the second arrangement order from top to bottom as value_0, value_1, value_2, ..., value_n, where (n+1) equals the number of cells included in the data row.
[0128] In some specific examples, such as Figure 8 As shown, for each data row, the column number of the data index column corresponding to that data row can be stored as a row record (e.g., "Py_ssize_t profileID") in the row data table corresponding to that data row.
[0129] In some specific implementations, for each data row, the corresponding row data table can be a Python object, and the Python object can serve as an encapsulation of the data content and behavior of that data row to represent it. This allows data querying, traversal, and modification behaviors to be encapsulated into high-performance, transparent custom Python objects.
[0130] S104. Store the data index rows and the row data table corresponding to each data row.
[0131] Specifically, the aforementioned data processing device can store the data index rows corresponding to each column key of the data table to be processed, as well as the row data tables corresponding to each row of the data table to be processed, to realize the export and storage of the data table to be processed, and its import and construction at runtime. Thus, the data processing device can perform data processing operations such as reading, deleting, and replacing the data table to be processed based on the stored data index rows and row data tables.
[0132] In this embodiment, each column key of the data table to be processed corresponds to a data index row, and each data row of the data table to be processed corresponds to a row data table. Because the data table to be processed specifically has at least one column key and at least one data row, the data table to be processed is stored in at least one data index row and at least one row data table. Moreover, each data row stores only the value and not the key, which can better support data tables with sparse headers, and the total memory overhead is lower than other mainstream compression schemes.
[0133] Furthermore, it is understandable that, compared to some embodiments where, during storage, all column headers are predefined and their order determined before being stored as a header definition table, and then all values in each data row are organized into a list according to the column header order to obtain the value list for each data row; during querying, the row key of the row to be queried and the column key of the column to be queried are used to retrieve the pre-stored value list for that row, and then, in conjunction with the header definition table, a key-value pair dictionary is regenerated and returned as the result to complete subsequent column query operations. This approach has the problem of difficulty supporting data tables with sparse headers and low data read performance. The compressed storage scheme for the data table to be processed described in S101 to S104 of this embodiment can better support data tables with sparse headers, more effectively reduce memory overhead, and maintain normal data read performance without loss. In addition, read performance can be further improved under specific conditions.
[0134] In some specific embodiments, S104 may specifically include:
[0135] S1041. Generate a data index table based on the data index columns corresponding to each column key.
[0136] Specifically, such as Figure 4 and Figure 5 As shown, the aforementioned data index table can store all column keys of the data table to be processed and the corresponding data index rows for each column key. That is, for the aforementioned data table to be processed that includes at least one column key, the corresponding data index table will include at least one column key and at least one data index row, and in this data index table, each column key corresponds one-to-one with each data index row.
[0137] In one specific embodiment, the aforementioned data index table can be a conventional key-value pair dictionary. This key-value pair dictionary includes all column keys of the aforementioned data table to be processed and the data index rows corresponding to each column key. Furthermore, in this key-value pair dictionary, each column key and its corresponding data index row are stored in a key-value pair storage manner, so that during a query, the value corresponding to the given column key (i.e., the aforementioned data index row) can be retrieved from the key-value pair dictionary.
[0138] Furthermore, in practical implementation, in key-value pairs where each column key is the key and the corresponding data index row is the value, the data index row corresponding to each column key can be mapped to a string to further reduce memory overhead.
[0139] S1042. Associate the row data table and data index table corresponding to each data row, and store the associated row data table and data index table.
[0140] It is understandable that in this embodiment, the row data table corresponding to each data row of the data table to be processed is associated with the data index table. The purpose is to ensure that the cell data corresponding to the data index can be found from the row data table corresponding to the data index through the data index in the data index table.
[0141] Furthermore, by generating a data index table based on the data index columns corresponding to each column key, associating the row data table corresponding to each data row with the data index table, and storing the associated row data table and data index table, when performing storage operations on the aforementioned data table to be processed, it is only necessary to store one data index table corresponding to the data table to be processed and the row data table corresponding to each data row in memory, without having to store each data row of the data table to be processed as key-value pairs. Therefore, the memory overhead occupied when performing storage operations on the data table can be reduced.
[0142] Specifically, the aforementioned data processing device can associate the data index table corresponding to the data table to be processed with the row data table corresponding to each data row of the data table to be processed through preset fields. Furthermore, in specific implementations, the preset fields can be stored in the data index table corresponding to the data table to be processed and all row data tables to achieve the association between the row data table corresponding to each data row and the data index table.
[0143] In one example, for the same table of data to be processed, such as Figure 8 As shown, the identifier (e.g., name) of the data index table generated based on the data table to be processed can be stored as a row record (e.g., "PyObject*metakey") in the row data table corresponding to each data row generated based on the data table to be processed. Therefore, during a query, the column key to be queried can first be passed to the data index table (i.e., metakey) to obtain the data index row corresponding to that column key. Then, the row data table corresponding to the row key to be queried (e.g., ...) can be used... Figure 8 The column number (i.e., profileID) of the corresponding data index column recorded in the table (as shown) is used to obtain the data index of the column key to be queried in the row to be queried from the data index row corresponding to the column key to be queried. Then, the corresponding cell data can be obtained from the corresponding row data table as the query result using the data index.
[0144] In the above embodiments, such as Figure 9 As shown, the above data processing method may further include:
[0145] S105. Receive a data query request, which includes the target row key and target column key of the data table to be processed.
[0146] Specifically, the target row key can be the row key of the row containing the cell data to be queried in the data table to be processed, and the target column key can be the column key of the column containing the cell data to be queried in the data table to be processed.
[0147] S106. Determine the row data table corresponding to the target row key as the target row data table.
[0148] Specifically, the target row data table mentioned above can be the row data table corresponding to the data row to which the target row key belongs.
[0149] S107. Determine the data indexes corresponding to the target row key and target column key as the target data indexes.
[0150] Specifically, the target data index can be a data index corresponding to the data row to which the target row key belongs and the target column key.
[0151] Furthermore, in the above embodiment where the column number of the data index column corresponding to each data row is stored in the row data table corresponding to each data row, after determining the target row data table, the data processing device can obtain the column number of the data index column corresponding to the data row to which the target row key belongs from the target row data table, and determine the data index column corresponding to the data row to which the target row key belongs from the data index table based on the column number. Then, the data processing device can determine the data index of the target column key in the data row to which the target row key belongs based on the data index column corresponding to the data row to which the target row key belongs, and thus obtain the target data index.
[0152] S108. Determine the cell data corresponding to the target data index from the target row data table as the query result.
[0153] It is understood that the above query results are the cell data in the data table to be processed, located in the row containing the target row key and the column containing the target column key. Furthermore, the target data index indicates the storage location of the cell data corresponding to the target row key and the target column key in the target row data table.
[0154] Specifically, when the target data index is the preset index, the query result can be determined to be null; when the target data index is not the preset index, the corresponding cell data can be indexed from the target row data table based on the target data index to obtain the query result.
[0155] As can be seen from the above, the data processing method provided in this embodiment obtains a data table to be processed, which includes at least one column key and at least one data row. Each data row includes at least one cell of data, and each cell of data corresponds to a column key. A data index row is determined for each column key, and each data index row includes at least one data index. Each data index corresponds to at least one data row, and each data index is used to index the cell of data in its corresponding data row that corresponds to the same column key. Then, a row data table corresponding to each data row is generated based on the cell data in each data row, and the data index row and the row data table corresponding to each data row are stored. Therefore, data table compression can be achieved without affecting the read speed, thereby reducing the memory overhead occupied when reading the data table.
[0156] Based on the methods described in the above embodiments, this embodiment will be further described from the perspective of a data processing device. Please refer to [link / reference]. Figure 10 , Figure 10 The present application provides a data processing apparatus, which includes: an acquisition module 301, a first determination module 302, a generation module 303, and a storage module 304.
[0157] (1) Obtain module 301
[0158] The acquisition module 301 is used to acquire a data table to be processed. The data table to be processed includes at least one column key and at least one data row. Each data row includes at least one cell of data, and each cell of data corresponds to a column key.
[0159] (2) First Determination Module 302
[0160] The first determining module 302 is used to determine the data index row corresponding to each column key. The data index row includes at least one data index, each data index corresponds to at least one data row, and each data index is used to index the cell data in its corresponding data row that corresponds to the same column key.
[0161] In some embodiments, the first determining module 302 described above may include:
[0162] The first determining unit is used to determine the first arrangement order of each column key;
[0163] The second determining unit is used to determine the data index column corresponding to each data row according to the first arrangement order and the column key corresponding to each cell data in each data row. The data index column includes at least one data index corresponding to at least one column key.
[0164] The third determining unit is used to determine the data index row corresponding to each column key based on the data index column corresponding to each data row.
[0165] In some specific embodiments, the second determining unit described above can be specifically used for:
[0166] Determine the column key corresponding to each cell in each data row to obtain the set of column keys for each data row;
[0167] Group data rows with the same column key set into one category;
[0168] Based on the first sorting order and the set of column keys corresponding to each type of data row, determine the data index column corresponding to each type of data row.
[0169] Furthermore, the aforementioned third determining unit can be specifically used for:
[0170] Based on the data index columns corresponding to each type of data row, determine the data index column row corresponding to each column key.
[0171] In other specific embodiments, the second determining unit described above may be specifically used for:
[0172] The second arrangement order of the data in each cell of each data row is determined based on the first arrangement order;
[0173] Based on the second sorting order and the column keys corresponding to the data in each cell of each data row, determine the data index column corresponding to each data row.
[0174] (3) Generation module 303
[0175] The generation module 303 is used to generate a row data table corresponding to each data row based on the data of each cell in each data row.
[0176] In some embodiments, the generation module 303 described above can be specifically used for:
[0177] Generate a row data table corresponding to each data row based on the second arrangement order and the data of each cell in each data row.
[0178] (4) Storage module 304
[0179] Storage module 304 is used to store the data index rows and the row data table corresponding to each data row.
[0180] In some embodiments, the storage module 304 described above may be specifically used for:
[0181] Generate a data index table based on the data index columns corresponding to each column key;
[0182] Associate the row data table and the data index table corresponding to each row of data, and store the associated row data table and data index table.
[0183] In the above embodiments, the data processing apparatus may further include:
[0184] (5) Receiving module
[0185] The receiving module is used to receive data query requests, which include the target row key and target column key of the data table to be processed.
[0186] (6) Second determination module
[0187] The second determination module is used to determine the row data table corresponding to the target row key as the target row data table.
[0188] (7) Third Determination Module
[0189] The third determination module is used to determine the data indexes corresponding to the target row key and the target column key as the target data indexes.
[0190] (8) Fourth Determination Module
[0191] The fourth determination module is used to determine the cell data corresponding to the target data index from the target row data table as the query result.
[0192] In practice, each of the above units and modules can be implemented as an independent entity or can be arbitrarily combined to be implemented as the same or several entities. For the specific implementation of each of the above units and modules, please refer to the previous method implementation examples, which will not be repeated here.
[0193] As can be seen from the above, the data processing apparatus provided in this embodiment includes an acquisition module for acquiring a data table to be processed, the data table including at least one column key and at least one data row, each data row including at least one cell data, and each cell data corresponding to a column key; a first determination module for determining a data index row corresponding to each column key, the data index row including at least one data index, each data index corresponding to at least one data row, and each data index used to index the cell data in its corresponding data row that corresponds to the same column key; a generation module for generating a row data table corresponding to each data row based on the cell data in each data row; and a storage module for storing the data index rows and the row data table corresponding to each data row. Thus, data table compression can be achieved without affecting the reading speed, thereby reducing the memory overhead occupied when reading the data table.
[0194] Accordingly, this application also provides an electronic device, which can be a terminal or a server. The terminal can be a smartphone, tablet computer, laptop computer, touch screen, game console, personal computer, personal digital assistant (PDA), or other terminal device. Figure 11 As shown, Figure 11 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. The electronic device 400 includes a processor 401 with one or more processing cores, a memory 402 with one or more computer-readable storage media, and a computer program stored in the memory 402 and executable on the processor. The processor 401 and the memory 402 are electrically connected. Those skilled in the art will understand that the electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0195] The processor 401 is the control center of the electronic device 400. It connects various parts of the electronic device 400 through various interfaces and lines. By running or loading software programs and / or modules stored in the memory 402, and calling data stored in the memory 402, it performs various functions of the electronic device 400 and processes data, thereby monitoring the electronic device 400 as a whole.
[0196] In this embodiment, the processor 401 in the electronic device 400 loads the instructions corresponding to the processes of one or more applications into the memory 402 according to the following steps, and the processor 401 runs the applications stored in the memory 402 to realize various functions:
[0197] Obtain the data table to be processed. The data table includes at least one column key and at least one data row. Each data row includes at least one cell of data, and each cell of data corresponds to a column key.
[0198] Determine the data index row corresponding to each column key. The data index row includes at least one data index. Each data index corresponds to at least one data row, and each data index is used to index the cell data in its corresponding data row that corresponds to the same column key.
[0199] Generate a row data table corresponding to each data row based on the data of each cell in each data row;
[0200] Store the data index rows and the corresponding row data table for each data row.
[0201] In one example, determining the data index row corresponding to each column key includes:
[0202] Determine the initial sorting order of each column key;
[0203] Based on the first arrangement order and the column key corresponding to each cell data in each data row, determine the data index column corresponding to each data row. The data index column includes at least one data index corresponding to at least one column key.
[0204] Determine the data index row corresponding to each column key based on the data index column corresponding to each data row.
[0205] In one example, based on the first sort order and the column keys corresponding to the data in each cell of each data row, the data index column corresponding to each data row is determined, including:
[0206] Determine the column key corresponding to each cell in each data row to obtain the set of column keys for each data row;
[0207] Group data rows with the same column key set into one category;
[0208] Based on the first sorting order and the set of column keys corresponding to each type of data row, determine the data index column corresponding to each type of data row;
[0209] Based on the data index columns corresponding to each data row, determine the data index row corresponding to each column key, including:
[0210] Based on the data index columns corresponding to each type of data row, determine the data index column row corresponding to each column key.
[0211] In one example, based on the first sort order and the column keys corresponding to the data in each cell of each data row, the data index column corresponding to each data row is determined, including:
[0212] The second arrangement order of the data in each cell of each data row is determined based on the first arrangement order;
[0213] Based on the second sorting order and the column keys corresponding to the data in each cell of each data row, determine the data index column corresponding to each data row.
[0214] In one example, a row data table is generated for each data row based on the data in each cell of that row, including:
[0215] Generate a row data table corresponding to each data row based on the second arrangement order and the data of each cell in each data row.
[0216] In one example, the data index rows and the corresponding row data tables for each data row are stored, including:
[0217] Generate a data index table based on the data index rows corresponding to each column key;
[0218] Associate the row data table and the data index table corresponding to each row of data, and store the associated row data table and data index table.
[0219] In one example, after storing the data index rows and the corresponding row data tables for each data row, the process also includes:
[0220] Receive data query requests, which include the target row key and target column key of the data table to be processed;
[0221] Determine the row data table corresponding to the target row key as the target row data table;
[0222] Determine the data indexes corresponding to the target row key and target column key as the target data index;
[0223] The query result is the cell data corresponding to the target data index in the target row data table.
[0224] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0225] Optional, such as Figure 11As shown, the electronic device 400 also includes: a touch display screen 403, a radio frequency circuit 404, an audio circuit 405, an input unit 406, and a power supply 407. The processor 401 is electrically connected to the touch display screen 403, the radio frequency circuit 404, the audio circuit 405, the input unit 406, and the power supply 407. Those skilled in the art will understand that... Figure 11 The electronic device structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0226] The touch display screen 403 can be used to display a graphical user interface (GUI) and receive operation commands generated by the user interacting with the GUI. The touch display screen 403 may include a display panel and a touch panel. The display panel can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces of the electronic device. These graphical user interfaces can be composed of graphics, text, icons, video, and any combination thereof. Optionally, the display panel can be configured using a liquid crystal display (LCD), organic light-emitting diode (OLED), or other similar technologies. The touch panel can be used to collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel), generate corresponding operation commands, and execute the corresponding program according to the operation commands. Optionally, the touch panel may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch location and the signal generated by the touch operation, transmitting the signal to the touch controller. The touch controller receives touch information from the touch detection device, converts it into touch point coordinates, and sends it to the processor 401. It can also receive and execute commands from the processor 401. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it transmits the information to the processor 401 to determine the type of touch event. Subsequently, the processor 401 provides corresponding visual output on the display panel based on the type of touch event. In this embodiment, the touch panel and the display panel can be integrated into the touch display screen 403 to achieve input and output functions. However, in some embodiments, the touch panel and the touch display screen 403 can be implemented as two independent components to achieve input and output functions. That is, the touch display screen 403 can also be used as part of the input unit 406 to achieve input functions.
[0227] In this embodiment of the application, the processor 401 executes a game application to generate a virtual three-dimensional scene on the touch screen 403. The scene includes a graphical user interface (UI) and a second spatial orientation indicator. The second spatial orientation indicator displays a spatial orientation mark corresponding to the target object. The spatial orientation mark is used to indicate the location of the target object.
[0228] The touch display screen 403 can be used to present images of virtual three-dimensional scenes, as well as graphical user interfaces and receive operation commands generated by the user interacting with the graphical user interface.
[0229] The radio frequency circuit 404 can be used to transmit and receive radio frequency signals to establish wireless communication with network devices or other electronic devices, and to transmit and receive signals with network devices or other electronic devices.
[0230] Audio circuit 405 can be used to provide an audio interface between a user and an electronic device via a speaker and a microphone. Audio circuit 405 can convert received audio data into electrical signals and transmit them to the speaker, where the speaker converts them into sound signals for output. Conversely, the microphone converts collected sound signals into electrical signals, which are then received by audio circuit 405, converted back into audio data, and then processed by processor 401 before being transmitted via radio frequency circuit 404 to, for example, another electronic device, or output to memory 402 for further processing. Audio circuit 405 may also include an earphone jack to provide communication between peripheral headphones and electronic devices.
[0231] The input unit 406 can be used to receive input numbers, characters, or user characteristic information (such as fingerprints, iris, facial information, etc.), and to generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control.
[0232] Power supply 407 is used to supply power to various components of electronic device 400. Optionally, power supply 407 can be logically connected to processor 401 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. Power supply 407 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0233] although Figure 11 As not shown in the diagram, the electronic device 400 may also include a camera, sensor, wireless fidelity module, Bluetooth module, etc., which will not be described in detail here.
[0234] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0235] As can be seen from the above, the electronic device provided in this embodiment can compress the data table without affecting the reading speed, thereby reducing the memory overhead occupied when reading the data table.
[0236] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0237] Therefore, embodiments of this application provide a computer-readable storage medium storing a plurality of computer programs that can be loaded by a processor to execute steps in any of the data processing methods provided in embodiments of this application. For example, the computer program can execute the following steps:
[0238] Obtain the data table to be processed. The data table includes at least one column key and at least one data row. Each data row includes at least one cell of data, and each cell of data corresponds to a column key.
[0239] Determine the data index row corresponding to each column key. The data index row includes at least one data index. Each data index corresponds to at least one data row, and each data index is used to index the cell data in its corresponding data row that corresponds to the same column key.
[0240] Generate a row data table corresponding to each data row based on the data of each cell in each data row;
[0241] Store the data index rows and the corresponding row data table for each data row.
[0242] In one example, determining the data index row corresponding to each column key includes:
[0243] Determine the initial sorting order of each column key;
[0244] Based on the first arrangement order and the column key corresponding to each cell data in each data row, determine the data index column corresponding to each data row. The data index column includes at least one data index corresponding to at least one column key.
[0245] Determine the data index row corresponding to each column key based on the data index column corresponding to each data row.
[0246] In one example, based on the first sort order and the column keys corresponding to the data in each cell of each data row, the data index column corresponding to each data row is determined, including:
[0247] Determine the column key corresponding to each cell in each data row to obtain the set of column keys for each data row;
[0248] Group data rows with the same column key set into one category;
[0249] Based on the first sorting order and the set of column keys corresponding to each type of data row, determine the data index column corresponding to each type of data row;
[0250] Based on the data index columns corresponding to each data row, determine the data index row corresponding to each column key, including:
[0251] Based on the data index columns corresponding to each type of data row, determine the data index column row corresponding to each column key.
[0252] In one example, based on the first sort order and the column keys corresponding to the data in each cell of each data row, the data index column corresponding to each data row is determined, including:
[0253] The second arrangement order of the data in each cell of each data row is determined based on the first arrangement order;
[0254] Based on the second sorting order and the column keys corresponding to the data in each cell of each data row, determine the data index column corresponding to each data row.
[0255] In one example, a row data table is generated for each data row based on the data in each cell of that row, including:
[0256] Generate a row data table corresponding to each data row based on the second arrangement order and the data of each cell in each data row.
[0257] In one example, the data index rows and the corresponding row data tables for each data row are stored, including:
[0258] Generate a data index table based on the data index rows corresponding to each column key;
[0259] Associate the row data table and the data index table corresponding to each row of data, and store the associated row data table and data index table.
[0260] In one example, after storing the data index rows and the corresponding row data tables for each data row, the process also includes:
[0261] Receive data query requests, which include the target row key and target column key of the data table to be processed;
[0262] Determine the row data table corresponding to the target row key as the target row data table;
[0263] Determine the data indexes corresponding to the target row key and target column key as the target data index;
[0264] The query result is the cell data corresponding to the target data index in the target row data table.
[0265] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0266] The computer-readable storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0267] Since the computer program stored in the computer-readable storage medium can execute the steps of any of the data processing methods provided in the embodiments of this application, the beneficial effects that any of the data processing methods provided in the embodiments of this application can achieve can be realized, as detailed in the preceding embodiments, and will not be repeated here.
[0268] The foregoing has provided a detailed description of a data processing method, apparatus, computer-readable storage medium, and electronic device provided in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A data processing method, characterized by, The method comprises: obtaining a to-be-processed data table, the to-be-processed data table comprising at least one column key and at least one data row, each data row comprising at least one cell data, and each cell data corresponding to one column key; determining a data index row corresponding to each column key, the data index row comprising at least one data index, each data index corresponding to at least one data row, and each data index being used to index the cell data corresponding to the same column key in the data row corresponding to the data index; generating a row data table corresponding to each data row according to each cell data in the data row; storing the data index row and the row data table corresponding to each data row; the determining of the data index row corresponding to each column key comprises: determining a first arrangement order of each column key; determining a data index column corresponding to each data row according to the first arrangement order and the column key corresponding to each cell data in the data row, the data index column comprising at least one data index corresponding to the at least one column key; determining the data index row corresponding to each column key according to the data index column corresponding to each data row.
2. The data processing method according to claim 1, characterized in that, the determining of the data index column corresponding to each data row according to the first arrangement order and the column key corresponding to each cell data in the data row comprises: determining the column key corresponding to each cell data in each data row to obtain a column key set corresponding to each data row; grouping the data rows with the same column key set into one type; determining the data index column corresponding to each type of data row according to the first arrangement order and the column key set corresponding to each type of data row; the determining of the data index row corresponding to each column key according to the data index column corresponding to each data row comprises: determining the data index column row corresponding to each column key according to the data index column corresponding to each type of data row.
3. The data processing method of claim 1, wherein, the determining of the data index column corresponding to each data row according to the first arrangement order and the column key corresponding to each cell data in the data row comprises: determining a second arrangement order of each cell data in each data row according to the first arrangement order; determining the data index column corresponding to each data row according to the second arrangement order and the column key corresponding to each cell data in the data row.
4. The data processing method according to claim 3, characterized in that, the generating of the row data table corresponding to each data row according to each cell data in the data row comprises: generating the row data table corresponding to each data row according to the second arrangement order and each cell data in the data row.
5. The data processing method of claim 1, wherein, the storing of the data index row and the row data table corresponding to each data row comprises: generating a data index table according to the data index row corresponding to each column key; The row data table corresponding to each data row is associated with the data index table, and the associated row data table and data index table are stored.
6. The data processing method of claim 1, wherein, After storing the data index row and the row data table corresponding to each data row, the method further comprises: receiving a data query request, the data query request comprising a target row key and a target column key of the to-be-processed data table; determining the row data table corresponding to the target row key as a target row data table; determining the data index corresponding to the target row key and the target column key as a target data index; determining the cell data corresponding to the target data index in the target row data table as a query result.
7. A data processing apparatus, characterized by, comprise: an acquisition module configured to acquire a to-be-processed data table, the to-be-processed data table comprising at least one column key and at least one data row, each data row comprising at least one cell data, and each cell data corresponding to one column key; a determination module configured to determine a data index row corresponding to each column key, the data index row comprising at least one data index, each data index corresponding to at least one data row, and each data index being used to index the cell data in the data row corresponding to the same column key as the data index; a generation module configured to generate a row data table corresponding to each data row according to each cell data in the data row; a storage module configured to store the data index row and the row data table corresponding to each data row; wherein the determination module comprises a first determination unit, a second determination unit and a third determination unit; the first determination unit is configured to determine a first arrangement order of each column key; the second determination unit is configured to determine a data index column corresponding to each data row according to the first arrangement order and the column key corresponding to each cell data in the data row, the data index column comprising at least one data index corresponding to the at least one column key; the third determination unit is configured to determine the data index row corresponding to each column key according to the data index column corresponding to each data row.
8. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program is adapted to be loaded by a processor to execute the data processing method according to any one of claims 1-6.
9. An electronic device, comprising: The electronic device comprises a memory and a processor, the memory stores a computer program, and the processor executes the data processing method according to any one of claims 1-6 by calling the computer program stored in the memory.
Citation Information
Patent Citations
Sparse data index table
CN111414359A
Storing data items and identifying stored data items
CN112262379A