Data management device, data management method, and data management program

The data management device uses a hash table with a shared values array and nexts array to manage key-value pairs, addressing inefficient memory management in existing hash tables by reducing the number of arrays required, thereby lowering memory management costs.

JP2026184550APending Publication Date: 2026-11-27NEC CORP
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
JP2025080866
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Filing Date
2025-05-14
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

Existing hash tables require frequent array expansions, leading to increased memory management costs due to the need to manage multiple arrays for each hash value, which can result in inefficient memory utilization.

Method used

A data management device and method that uses a hash table with a single values array and a nexts array, where each key is associated with head and tail information to manage the storage positions of the first and last values, reducing the need for separate arrays for each key.

Benefits of technology

This configuration reduces memory management costs by allowing all keys to share a single values array, minimizing the number of arrays needed and optimizing memory utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2026184550000001_ABST
    Figure 2026184550000001_ABST
Patent Text Reader

Abstract

This invention provides a data management device, a data management method, and a data management program that can reduce memory management costs. [Solution] The data management device includes a management means for managing data using a hash table that holds a first array which stores one or more values ​​corresponding to each of a plurality of keys, a second array which stores information indicating the storage location of the next value corresponding to the same key for each element of the first array, and a first piece of information which indicates the storage location of the first value among the corresponding values ​​and a second piece of information which indicates the storage location of the last value for each key.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical Field]

[0001] The present disclosure relates to a data management device, a data management method, and a data management program. [Background Art]

[0002] Patent Literature 1 (paragraph 0109) describes an example of a hash table. Connection information having the same hash value is associated in this hash table. [Description of Related Art] [Patent Literature]

[0003] [Patent Literature 1] Japanese Unexamined Patent Application Publication No. 2015-177263 [Summary of Invention] [Problem to be Solved by the Invention]

[0004] However, in the hash table described in Patent Literature 1, arrays corresponding to the number of hash values must be managed, and if expansion of these arrays occurs frequently, there is a problem that costs required for memory management increase.

[0005] The present disclosure has been made in view of these problems. An object of the present disclosure is to provide a data management device, a data management method, and a data management program that can reduce memory management costs. [Means for Solving the Problem]

[0006] A data management device according to the present disclosure includes: a first array that stores one or more values corresponding to each of a plurality of keys; a second array in which an element corresponding to an element of the first array stores information indicating a storage position of a next value corresponding to the same key; and a management unit that manages data using a hash table that holds, for each key, first information indicating a storage position of a head value among corresponding values and second information indicating a storage position of a last value.

[0007] The data management method based on this disclosure involves a computer managing data using a hash table that includes a first array storing one or more values ​​corresponding to each of a plurality of keys, a second array in which elements corresponding to the elements of the first array store information indicating the storage location of the next value corresponding to the same key, and for each key, first information indicating the storage location of the first value among the corresponding values ​​and second information indicating the storage location of the last value.

[0008] The data management program based on this disclosure causes a computer to perform a management process for managing data using a hash table that holds a first array storing one or more values ​​corresponding to each of a plurality of keys, a second array in which an element corresponding to an element of the first array stores information indicating the storage location of the next value corresponding to the same key, and for each key, first information indicating the storage location of the first value among the corresponding values ​​and second information indicating the storage location of the last value. [Effects of the Invention]

[0009] According to this disclosure, it will be possible to reduce memory management costs. [Brief explanation of the drawing]

[0010] [Figure 1] This is an explanatory diagram illustrating the structure of a hash table. [Figure 2] This is a block diagram illustrating the functional configuration of a data management device. [Figure 3] This is a flowchart illustrating the operation of a data management device. [Figure 4] This is a flowchart illustrating the operation of a data management device. [Figure 5] This is an explanatory diagram illustrating the general operation of the data management device. [Figure 6] This is an explanatory diagram illustrating the general operation of the data management device. [Figure 7] This is a block diagram illustrating the hardware configuration of a computer. [Figure 8] This is a block diagram illustrating the main components of a data management device. [Figure 9] This is an explanatory diagram illustrating join and grouping processes for table data. [Figure 10] This is an explanatory diagram illustrating a typical hash table. [Figure 11] This is an explanatory diagram illustrating the structure of a typical hash table. [Figure 12] This is an explanatory diagram illustrating the structure of a typical hash table. [Figure 13] This is an explanatory diagram illustrating the structure of a typical hash table. [Figure 14] This is an explanatory diagram illustrating the structure of a typical hash table. [Modes for carrying out the invention]

[0011] This section describes general join and grouping processes for table data. Figure 9 is an illustrative diagram illustrating join and grouping processes for table data.

[0012] The left side of Figure 9 shows an example of a join operation that combines rows with matching Key values ​​in data tables df_l and df_r. Note that the Key values ​​are stored in column col0 of data table df_l and column col4 of data table df_r before the join operation. Furthermore, both data tables df_l and df_r can have multiple rows corresponding to the same Key.

[0013] The right side of Figure 9 shows an example of a GroupBy operation that groups the data table df by Key column and performs aggregation on each group. The column col0 in the data table df stores the Key value. Furthermore, the data table df before the GroupBy operation can contain multiple rows corresponding to the same Key.

[0014] Next, a description will be given of a hash table used in the joining process and the grouping process shown in FIG. 9. FIG. 10 is an explanatory diagram illustrating an example of a general hash table. A hash table is a data structure that stores a plurality of pairs of keys and values (hereinafter, also referred to as entries) and allows a value corresponding to a key to be referenced. The hash table is also called a hash map. Such a hash table is also used to efficiently realize the Join process and the GroupBy process.

[0015] FIG. 10(A) illustrates an example of creating a hash table based on the key value of the data table df_r shown in FIG. 9. In the hash table of FIG. 10(A), the row number (that is, the index of the table) of the data table df_r corresponding to each key is stored. Note that a plurality of row numbers are associated with the same key.

[0016] FIG. 10(B) illustrates an example of a process of creating an inquiry result for an inquiry based on the value of the key column of the data table df_l shown in FIG. 9 using the hash table of FIG. 10(A). Specifically, an inquiry (that is, search) based on the key value "A" is performed, and rows in which the key matches "A" in the data table df_l, that is, the 0th row and the 3rd row are extracted as the inquiry result (that is, search result).

[0017] Figures 11 to 14 are explanatory diagrams illustrating the structure of a typical hash table. The left side of Figure 11 shows the structure of a typical hash table. This hash table has a configuration in which each key holds one one-dimensional array data structure capable of storing multiple values. In other words, the set of values ​​associated with the key is held as an array. The right side of Figure 11 illustrates how each array of the hash table is arranged in the computer's memory. Here, the arrangement of each one-dimensional array (i.e., contiguous memory region) corresponding to each key is visually shown in memory.

[0018] Figure 12 is an illustrative diagram illustrating the general operation of the hash table shown in Figure 11. The upper left of Figure 12 shows the initial state of the hash table, where no entries have yet been stored.

[0019] In the example in Figure 12, an entry {A:0} with Key "A" and Value "0" is added in the initial state. Key "A" is the first Key to appear in the hash table. Therefore, a new array corresponding to Key "A" is created. This array has a predetermined length (4 elements in this example). The value "0" is stored in the first element of this array, i.e., at index 0.

[0020] Next, an entry {B:2} is added with key "B" and value "2". Key "B" is the first key to appear in the hash table. Therefore, a new array corresponding to key "B" is created. This array has a predetermined length (4 elements in this example). The value "2" is stored in the first element of this array, i.e., at index 0.

[0021] Next, an entry {C:4} is added with key "C" and value "4". Key "C" is the first key to appear in the hash table. Therefore, a new array corresponding to key "C" is created. This array has a predetermined length (4 elements in this example). The value "4" is stored in the first element of this array, i.e., at index 0.

[0022] Next, an entry {A:6} is added with Key "A" and Value "6". Key "A" is a key that already exists in the hash table. Therefore, the value "6" is added to the array corresponding to Key "A". Specifically, the value "6" is stored at the first element of the unused elements (hereinafter also referred to as unused elements) in this array that do not yet have a value stored in them, i.e., at index 1.

[0023] Next, an entry {B:8} is added with key "B" and value "8". Key "B" is a key that already exists in the hash table. Therefore, the value "8" is added to the array corresponding to key "B". Specifically, the value "8" is stored in the first unused element of this array, i.e., at index 1.

[0024] Finally, an entry {D:10} is added with Key "D" and Value "10". Key "D" is the first Key to appear in the hash table. Therefore, a new array corresponding to Key "D" is created. This array has a predetermined length (4 elements in this example). The value "10" is stored in the first element of this array, i.e., at index 0.

[0025] Figure 13 is an explanatory diagram illustrating the general operation of the hash table shown in Figure 11. Figure 13 illustrates the operation when the array length becomes insufficient.

[0026] Specifically, the left side of Figure 13 shows the state where all elements of the array corresponding to Key "A" have been stored with values. Note that the initial length of this array is 4 elements. We will now explain how to add an entry {A:18} where Key is "A" and value is "18".

[0027] Since the key "A" already exists in the hash table, the value "18" needs to be added to the corresponding array. However, this array has no unused elements. Therefore, the array is expanded. The value "18" is then added to the expanded array. Specifically, the value "18" is stored in the first unused element of this array, i.e., at index 4.

[0028] In this expansion process, a buffer is allocated in the computer's memory, separate from the area where the existing array corresponding to Key "A" is located, to accommodate the expanded new array. Next, all elements of the existing array are copied to the new array. After that, the value "18" is added to the new array. Note that the size of the array when expanding can be set arbitrarily, but generally, a configuration that expands to twice the length of the existing array is commonly used.

[0029] Figure 14 is an explanatory diagram illustrating the challenges of the hash table shown in Figure 11. As shown in Figure 14, in a typical hash table, it is necessary to manage an array individually for each key. Therefore, as the number of keys increases, the number of arrays also increases proportionally. Furthermore, if expansion operations occur frequently in each array, it becomes necessary to allocate and reallocate memory space, which increases the cost of memory management. It is conceivable to allocate a large array size in advance to suppress the frequency of expansion operations. However, in this case, there will be many unused elements, and the efficiency of memory utilization will decrease, making efficient memory management difficult.

[0030] Embodiments of this disclosure will be described below with reference to the drawings. In each drawing, the same or corresponding elements are denoted by the same reference numerals, and redundant explanations are omitted as necessary for clarity. Unless otherwise specified, predetermined values ​​such as set values ​​and thresholds are stored in advance in a storage device accessible from the device that uses those values. Unless otherwise specified, the storage unit is composed of one or any number of storage devices.

[0031] Embodiment 1. The data management device 100 of this embodiment has the function of managing data using a hash table. Figure 1 is an explanatory diagram illustrating the structure of a hash table. Figure 1(A) shows a typical hash table after the array expansion process shown on the right side of Figure 13. In the example of Figure 1(A), there are five values ​​corresponding to key "A": 0, 6, 12, 16, and 18, and the sequence of values ​​is managed in the order 0→6→12→16→18.

[0032] In contrast, Figure 1(B) shows an example of a hash table used by the data management device 100 of this embodiment. In the example in Figure 1, the hash tables shown in Figure 1(A) and Figure 1(B) both store the same key-value pairs.

[0033] As shown in Figure 1(B), the hash table used by the data management device 100 of this embodiment is configured to hold corresponding head information (hereinafter also referred to as first information) and tail information (hereinafter also referred to as second information) for each key. Furthermore, this hash table is configured to hold an array (hereinafter also referred to as the values ​​array or first array) that stores together one or more values ​​corresponding to each of the multiple keys, and an array (hereinafter also referred to as the nexts array or second array) in which elements that correspond one-to-one with the elements of the values ​​array store information indicating the storage location of the next value corresponding to the same key.

[0034] The `head` information indicates the storage location of the first value among the values ​​corresponding to the Key. The `tail` information indicates the storage location of the last value among the values ​​corresponding to the Key. Here, "information indicating the storage location" specifically refers to the index within the `values` array.

[0035] In the example in Figure 1(B), the head information for Key "A" is "0" and the tail information is "9". This indicates that the first value corresponding to Key "A" is stored in the element at index "0" of the values ​​array, and the last value is stored in the element at index "9" of the values ​​array. Similarly, the head information for Key "B" is "1" and the tail information is "4". Therefore, the first value corresponding to Key "B" is stored in the element at index "1" of the values ​​array, and the last value is stored in the element at index "4" of the values ​​array.

[0036] Thus, in this embodiment, the values ​​corresponding to all keys managed by the hash table are aggregated and stored in a single values ​​array. In other words, instead of preparing a separate array for each key, all keys share a single values ​​array.

[0037] The `values` array and the `nexts` array are mapped one-to-one via the same index. Below, the element corresponding to index "i" in the `values` array will also be denoted as `values[i]`. Similarly, the element corresponding to index "i" in the `nexts` array will also be denoted as `nexts[i]`.

[0038] `nexts[i]` stores information (i.e., an index) indicating the storage location within the `values` array where the next value corresponding to the same key as the value stored in `values[i]` is stored. If no subsequent value exists, `nexts[i]` stores a specific value (in this embodiment, "-1") indicating that no further value is stored, i.e., the end of the sequence.

[0039] In the example in Figure 1(B), values[0] contains "0", and the corresponding nexts[0] contains "3". Furthermore, values[3] contains "6". Therefore, we can see that the next value following the value "0" is "6".

[0040] In the example in Figure 1(B), the procedure for obtaining the value corresponding to Key "A" is explained below. The head information for Key "A" is "0". Therefore, the value "0" stored in values[0] is obtained as the first value. Next, referring to nexts[0] yields "3", so the value "6" stored in values[3] is obtained as the next value.

[0041] Next, referencing nexts[3] yields "6", so the value "12" stored in values[6] is retrieved. Next, referencing nexts[6] yields "8", so the value "16" stored in values[8] is retrieved. Next, referencing nexts[8] yields "9", so the value "18" stored in values[9] is retrieved. Finally, referencing nexts[9] yields "-1", which indicates that there are no further values.

[0042] As described above, the values ​​corresponding to Key "A" are obtained sequentially in the order of 0 → 6 → 12 → 16 → 18.

[0043] [Explanation of the structure] The functional configuration of the data management device of this embodiment will now be described. Figure 2 is a block diagram illustrating the functional configuration of the data management device.

[0044] The data management device 100 includes a hash table management unit 110 and a hash table storage unit 120. The hash table management unit 110 also includes a creation unit 111, an addition unit 112, and an retrieval unit 113.

[0045] The hash table management unit 110 has the function of managing data using a hash table. Specifically, the hash table management unit 110 performs various processes related to the creation of hash tables, the addition of data, and the retrieval of data.

[0046] The hash table storage unit 120 is the main memory for storing the hash table. The hash table storage unit 120 is implemented using, for example, RAM (Random Access Memory).

[0047] When the hash table management unit 110 receives a hash table creation request, it uses the creation unit 111 to execute the hash table creation process.

[0048] The creation unit 111 has the function of creating a hash table that holds the values ​​array and nexts array described above, as well as head information and tail information corresponding to each key. For example, in response to a creation request, the creation unit 111 allocates a memory area of ​​a predetermined initial size on the hash table storage unit 120. This allocated area includes an area for storing the values ​​array and nexts array, and an area for storing the head information and tail information. The initial sizes of the values ​​array and nexts array can be set arbitrarily. For example, if the number of elements to be registered in the hash table is known in advance, the initial size may be set to correspond to that number of elements.

[0049] When the hash table management unit 110 receives a request to add a key-value pair to the hash table, it uses the addition unit 112 to perform data addition processing.

[0050] The addition unit 112 has the function of adding the key-value pairs of the addition request to the hash table.

[0051] For example, when the appending unit 112 receives an appending request, it obtains the effective length of the values ​​array at the time of receipt (i.e., corresponding to the number of used elements). If no values ​​are stored in any of the elements of the values ​​array, the effective length of the values ​​array is 0. If values ​​are stored in x elements of the values ​​array, the effective length of the values ​​array is x. The effective length of the values ​​array obtained here corresponds to the index indicating the first unused element in the values ​​array (i.e., the next element that can be stored). Furthermore, the values ​​array and the nexts array are associated one-to-one via the same index. Therefore, the appending unit 112 can obtain the index indicating the first unused element in both the values ​​array and the nexts array (hereinafter also referred to as the first unused index).

[0052] The addition unit 112 performs expansion processing on both the values ​​array and the nexts array, respectively, when the effective length of the values ​​array reaches the capacity of the array, i.e., when there are no new elements that can be stored.

[0053] In the expansion process, the addition unit 112 allocates a buffer in the computer's memory, separate from the area where the existing values ​​array and nexts array are located, to place the expanded values ​​array and nexts array. Next, the addition unit 112 copies all elements of the existing values ​​array and nexts array to the expanded values ​​array and nexts array located in the newly allocated area. The size of the expanded array can be set arbitrarily; for example, it may be set to expand to twice the existing size, or to expand at a fixed percentage.

[0054] The appending unit 112 determines whether the Key to be added already exists in the hash table (i.e., whether the Key is already registered). If it does not exist (i.e., the Key is not registered), the appending unit 112 sets the starting index of the unused element in both the head information and tail information corresponding to the Key. The appending unit 112 also stores the value to be added in the first unused element in the values ​​array. Furthermore, the appending unit 112 stores a specific value (-1) indicating the end in the first unused element in the nexts array.

[0055] On the other hand, if it exists (i.e., if the Key is already registered), the appending unit 112 refers to the tail information corresponding to the Key and obtains the index of the element in the values ​​array that stores the last value corresponding to the Key. Subsequently, the appending unit 112 updates the information stored in the element of the nexts array corresponding to the obtained index to the first index of the unused elements in the values ​​array. As a result, the information stored in that element in the nexts array is updated from a specific value indicating the end (-1) to the first index of the unused elements in the values ​​array (i.e., the index of the element that stores the value to be appended).

[0056] Next, the addition unit 112 updates the tail information corresponding to the Key to the first index of the unused elements in the values ​​array. As a result, the tail information is updated to the first index of the unused elements in the values ​​array (i.e., the index indicating the element that stores the value to be added).

[0057] Subsequently, the appending unit 112 stores the value to be appended in the first unused element in the values ​​array. Furthermore, the appending unit 112 stores a specific value (-1) indicating the end in the first unused element in the nexts array.

[0058] When the hash table management unit 110 receives a data retrieval request (for example, a retrieval request that includes a Key corresponding to the value to be retrieved), it uses the retrieval unit 113 to execute the data retrieval process.

[0059] The retrieval unit 113 has the function of retrieving a value corresponding to a specific key from a hash table.

[0060] For example, when the acquisition unit 113 receives an acquisition request, it refers to the head information corresponding to the key included in the acquisition request and obtains an index indicating the element in which the first value corresponding to the key is stored.

[0061] Subsequently, the retrieval unit 113 refers to an element in the values ​​array corresponding to the retrieved index and retrieves the value stored in that element. Next, the retrieval unit 113 refers to an element in the nexts array corresponding to the same index and retrieves the index of the element in the values ​​array that stores the next value corresponding to the same key. The retrieval unit 113 repeats the same process unless the index retrieved from the nexts array is a specific value (-1) that indicates the end. By repeating these processes, all values ​​corresponding to the key are retrieved in a chain.

[0062] The data management device 100 is not limited to the configuration shown in Figure 2. For example, the creation unit 111 may be provided independently of the hash table management unit 110. Also, Figure 2 shows an example of the functional configuration of the data management device 100, and the number, arrangement, connection configuration, etc. of each component can be changed as appropriate without departing from the spirit of this disclosure.

[0063] [Explanation of operation] Next, the operation of the data management device 100 will be described. Figures 3 and 4 are flowcharts illustrating the operation of the data management device 100.

[0064] First, the data addition process will be explained. Figure 3 shows an example of the data addition process. The hash table management unit 110 receives an addition request that includes a key-value pair to be added to the hash table (step S101).

[0065] When the appending unit 112 receives an appending request, it obtains the effective length of the values ​​array at the time of receipt (i.e., the index of the first unused element) (step S102).

[0066] Next, the addition unit 112 determines whether the effective length of the values ​​array has reached the capacity of the array (step S103). If the effective length of the values ​​array has not reached the capacity of the array, the process proceeds to step S105.

[0067] On the other hand, if the effective length of the values ​​array reaches the capacity of that array, the appending unit 112 performs expansion processing on both the values ​​array and the nexts array (step S104). The process then proceeds to step S105.

[0068] In step S105, the addition unit 112 determines whether the Key to be added already exists in the hash table (i.e., whether the Key to be added is already registered).

[0069] If step S105 determines that the Key to be added does not exist in the hash table, the addition unit 112 sets the starting index of the unused element in both the head information and tail information corresponding to the Key (step S106).

[0070] Next, the appending unit 112 stores the value to be appended in the first unused element in the values ​​array (step S110). Furthermore, the appending unit 112 stores a specific value (-1) indicating the end in the first unused element in the nexts array (step S111). After that, the data appending process is completed.

[0071] If step S105 determines that the Key to be added exists in the hash table, the addition unit 112 refers to the tail information corresponding to the Key and obtains the index of the element in the values ​​array that contains the last value corresponding to the Key (step S107).

[0072] Next, the addition unit 112 updates the information stored in the element of the nexts array corresponding to the index obtained in step S107 to the first index of the unused element in the values ​​array obtained in step S102 (step S108). As a result of the execution of step S108, the information stored in that element in the nexts array is updated from a specific value (-1) indicating the end to the first index of the unused element in the values ​​array (i.e., the index indicating the element that stores the value to be added).

[0073] Next, the addition unit 112 updates the tail information corresponding to the Key to the first index of the unused elements in the values ​​array (step S109). As a result of the execution of step S109, the tail information is updated to the first index of the unused elements in the values ​​array (i.e., the index indicating the element that stores the value to be added).

[0074] Next, the appending unit 112 stores the value to be appended in the first unused element in the values ​​array (step S110). Furthermore, the appending unit 112 stores a specific value (-1) indicating the end in the first unused element in the nexts array (step S111). After that, the data appending process is completed.

[0075] Next, the data retrieval process will be described. Figure 4 shows an example of the data retrieval process. The hash table management unit 110 receives a retrieval request that includes a Key corresponding to the value to be retrieved (step S201).

[0076] When the acquisition unit 113 receives an acquisition request, it refers to the head information corresponding to the key included in the acquisition request and obtains the index of the element in the values ​​array that contains the first value corresponding to the key (step S202).

[0077] Next, the acquisition unit 113 refers to an element of the values ​​array corresponding to the index acquired in step S202 or step S204 (described later), and acquires the value stored in that element (step S203).

[0078] Next, the acquisition unit 113 refers to the element in the nexts array corresponding to the same index and obtains the index of the element in the values ​​array that contains the next value corresponding to the same key (step S204).

[0079] Next, the acquisition unit 113 determines whether the index acquired in step S204 is valid or not (step S205). Here, the acquisition unit 113 determines that the index acquired in step S204 is valid if it is not a specific value (-1) indicating the end, and invalid if it is a specific value (-1).

[0080] If the index is determined to be valid in step S205, the process returns to step S203 and retrieves the next value. In the data retrieval process shown in Figure 4, the process from steps S203 to S205 is repeated until the index is determined to be invalid in step S205, thereby retrieving all values ​​corresponding to the Key included in the retrieval request in a chain reaction.

[0081] On the other hand, if the index is determined to be invalid in step S205, the acquisition unit 113 outputs one or more values ​​acquired in step S203 as the acquisition result. After that, the data acquisition process ends.

[0082] The operation examples shown in Figures 3 and 4 do not limit the operation of the data management device 100. For example, the data management device 100 may be configured to execute the processes in steps S106 or S107-S109 and steps S110-S111 in reverse order, or in parallel. Also, the data management device 100 may be configured to execute the processes in step S203 and step S204 in reverse order, or in parallel.

[0083] Next, the operational overview of the data management device 100 will be explained with reference to Figures 5 and 6. Figures 5 and 6 are explanatory diagrams intended to facilitate understanding of the operational overview of the data management device 100. Therefore, the configuration and operation of the data management device 100 are not limited to those shown in Figures 5 and 6.

[0084] In the examples shown in Figures 5 and 6, the state of the hash table transitions from left to right. The left side of Figure 5 shows the initial state of the hash table, created by the creation unit 111 of the data management device 100, with no entries yet stored. This hash table contains a values ​​array and a nexts array of default length (four elements in this example).

[0085] In the examples shown in Figures 5 and 6, the hash table management unit 110 receives an append request to add a pair of Key "A" and Value "0" to the hash table in its initial state. Upon receiving the append request, the append unit 112 obtains the effective length of the values ​​array at the time of receipt, i.e., the index of the first unused element, which is "0".

[0086] Key "A" is the first Key to appear in the hash table. Therefore, the addition section 112 sets the head information corresponding to Key "A" to the first index "0" of the unused elements.

[0087] Furthermore, the addition unit 112 stores the value "0" in values[0] and the end value "-1" in nexts[0]. Then, the addition unit 112 sets the index "0" in the tail information corresponding to Key "A".

[0088] Next, the hash table management unit 110 receives an append request to add the key "B" and value "2" to the hash table. Upon receiving the append request, the append unit 112 obtains the effective length of the values ​​array at the time of receipt, i.e., the index of the first unused element, which is "1".

[0089] Key "B" is the first Key to appear in the hash table. Therefore, the addition section 112 sets the head information corresponding to Key "B" to the first index "1" of the unused elements.

[0090] Furthermore, the appending unit 112 stores the value "2" in values[1] and the end value "-1" in nexts[1]. Then, the appending unit 112 sets the index "1" in the tail information corresponding to Key "B".

[0091] Next, the hash table management unit 110 receives an append request to add the key "C" and value "4" to the hash table. Upon receiving the append request, the append unit 112 obtains "2", which is the effective length of the values ​​array at the time of receipt, i.e., the index of the first unused element.

[0092] Key "C" is the first Key to appear in the hash table. Therefore, the addition section 112 sets the head information corresponding to Key "C" to the first index "2" of the unused elements.

[0093] Furthermore, the appending unit 112 stores the value "4" in values[2] and the end value "-1" in nexts[2]. Then, the appending unit 112 sets the index "2" in the tail information corresponding to Key "C".

[0094] Next, as shown in Figure 6, the hash table management unit 110 receives an append request to add a pair of key "A" and value "6" to the hash table. Upon receiving the append request, the append unit 112 obtains "3", which is the effective length of the values ​​array at the time of receipt, i.e., the index of the first unused element.

[0095] Key "A" is a key that exists in the hash table. Therefore, the appending unit 112 refers to the tail information corresponding to Key "A" and obtains index "0", which indicates the element where the last value corresponding to Key "A" is stored. Subsequently, the appending unit 112 updates nexts[0] to index "3".

[0096] Furthermore, the appending unit 112 stores the value "6" in values[3] and the end value "-1" in nexts[3]. Then, the appending unit 112 sets the index "3" in the tail information corresponding to Key "A".

[0097] Next, the hash table management unit 110 receives an append request to add the key "B" and value "8" to the hash table. Upon receiving the append request, the append unit 112 obtains "4", which is the effective length of the values ​​array at the time of receipt, i.e., the index of the first unused element.

[0098] Since the effective length of the values ​​array has reached its capacity, the appending unit 112 performs expansion processing on both the values ​​array and the nexts array. In this example, the appending unit 112 expands both the values ​​array and the nexts array to twice their existing size (8 elements).

[0099] Key "B" is a key that exists in the hash table. Therefore, the appending unit 112 refers to the tail information corresponding to Key "B" and obtains index "1", which indicates the element where the last value corresponding to Key "B" is stored. Subsequently, the appending unit 112 updates nexts[1] to index "4".

[0100] Furthermore, the appending unit 112 stores the value "8" in values[4] and the end value "-1" in nexts[4]. Then, the appending unit 112 sets the index "4" to the tail information corresponding to Key "D".

[0101] Next, the hash table management unit 110 receives an append request to add the key "D" and value "10" to the hash table. Upon receiving the append request, the append unit 112 obtains "5", which is the effective length of the values ​​array at the time of receipt, i.e., the index of the first unused element.

[0102] Key "D" is the first Key to appear in the hash table. Therefore, the addition section 112 sets the head information corresponding to Key "D" to the first index "5" of the unused elements.

[0103] Furthermore, the appending unit 112 stores the value "10" in values[5] and the end value "-1" in nexts[5]. Then, the appending unit 112 sets the index "5" in the tail information corresponding to Key "D".

[0104] [Explanation of effects] Next, the effects of this embodiment will be described. In this embodiment, the hash table management unit 110 manages data using a hash table that holds a values ​​array (first array) which stores one or more values ​​corresponding to each of a plurality of keys, a nexts array (second array) which stores information indicating the storage location of the next value corresponding to the same key for each element of the values ​​array (first array), and head information (first information) which indicates the storage location of the first value among the corresponding values ​​and tail information (second information) which indicates the storage location of the last value for each key.

[0105] Furthermore, based on the request to add a key-value pair, the addition unit 112 stores the value in the first unused element of the values ​​array. The addition unit 112 also stores information indicating that the next value is not stored in the element of the nexts array corresponding to the element of the values ​​array that stores the value of the addition request. If the key of the addition request does not exist in the hash table, the addition unit 112 sets information indicating the storage location of the value of the addition request as head information and tail information, respectively. On the other hand, if the key of the addition request exists in the hash table, the addition unit 112 updates the element of the nexts array identified by the tail information corresponding to that key with information indicating the storage location of the value of the addition request. Furthermore, after updating the element of the nexts array, the addition unit 112 updates the tail information with information indicating the storage location of the value of the addition request.

[0106] Furthermore, the acquisition unit 113 refers to the head information corresponding to the key included in the acquisition request and obtains an index indicating the element in the values ​​array where the first value corresponding to that key is stored. Subsequently, the acquisition unit 113 refers to the element in the values ​​array corresponding to the acquired index and obtains the value stored in that element. Next, the acquisition unit 113 refers to the element in the nexts array corresponding to the same index and obtains an index indicating the element in the values ​​array where the next value corresponding to the same key is stored.

[0107] With this configuration, the data management device 100 can manage one or more values ​​corresponding to each of multiple keys using only a limited number of arrays: the values ​​array and the nexts array. In other words, since the number of arrays does not increase in proportion to the number of keys, it is possible to reduce memory management costs.

[0108] Each function (each process) in the above embodiment can be implemented by a computer having a processor, memory, etc. For example, a program for implementing the method (process) in the above embodiment may be stored in a storage device (storage medium), and each function may be implemented by executing the program stored in the storage device with a processor.

[0109] Figure 7 is a block diagram illustrating the hardware configuration of computer 1000. Computer 1000 is any computer. For example, computer 1000 is a stationary computer such as a personal computer or a server machine. Alternatively, computer 1000 is a portable computer such as a smartphone or a tablet device. Computer 1000 may be a dedicated computer designed to implement the data management device 100, or it may be a general-purpose computer.

[0110] Computer 1000 has a processor 1001, a storage device 1002, memory 1003, a bus 1004, an input / output interface 1005, and a network interface 1006.

[0111] Processor 1001 is a variety of processing units, including CPUs (Central Processing Units), GPUs (Graphics Processing Units), FPGAs (Field-Programmable Gate Arrays), and DSPs (Digital Signal Processors).

[0112] The storage device 1002 is, for example, a non-transitory computer-readable medium. Non-transitory computer-readable media include various types of tangible storage media. Specific examples of non-transitory computer-readable media include semiconductor memory (e.g., mask ROM, PROM (Programmable ROM), EPROM (Erasable PROM), flash ROM).

[0113] Memory 1003 is a main memory system implemented using RAM (Random Access Memory) or similar technologies. Memory 1003 temporarily stores data when the processor 1001 executes processing.

[0114] Bus 1004 is a data transmission path for the processor 1001, memory 1003, storage device 1002, input / output interface 1005, and network interface 1006 to send and receive data to and from each other. However, the method of connecting the processor 1001 and the others to each other is not limited to bus connection.

[0115] The input / output interface 1005 is an interface for connecting the computer 1000 with input / output devices. For example, input devices such as keyboards and output devices such as display devices are connected to the input / output interface 1005.

[0116] The network interface 1006 is an interface for connecting computer 1000 to a network. This network may be a LAN (Local Area Network) or a WAN (Wide Area Network).

[0117] The storage device 1002 stores a program that implements each of the functional components in the above-described embodiments and examples. The processor 1001 reads this program into the memory 1003 and executes it to implement each of the functional components in the above-described embodiments and examples.

[0118] The data management device 100 may be implemented using one computer 1000 or multiple computers 1000. In the latter case, the configuration of each computer 1000 does not need to be identical and can be different.

[0119] Each functional component in the above embodiments and examples may be implemented by a combination of the hardware and software described above, or by hardware (for example, a hardwired electronic circuit).

[0120] Next, an overview of the present disclosure will be described. Figure 8 is a block diagram illustrating an overview of a data management device. The data management device 10 according to the present disclosure (corresponding to, for example, a data management device 100) includes a management means 11 (implemented by a hash table management unit 110 in this embodiment) that manages data using a hash table that stores a first array (e.g., a values ​​array) that stores one or more values ​​corresponding to each of a plurality of keys, a second array (e.g., a nexts array) in which elements corresponding to the elements of the first array store information (e.g., an index) indicating the storage location of the next value corresponding to the same key, and first information (e.g., head information) indicating the storage location of the first value among the corresponding values ​​for each key, and second information (e.g., tail information) indicating the storage location of the last value. With this configuration, the number of arrays does not increase in proportion to the number of keys, and one or more values ​​corresponding to each of a plurality of keys can be managed with a limited number of arrays, thereby reducing memory management costs.

[0121] Although the present disclosure has been described above with reference to embodiments, the present disclosure is not limited to the embodiments described above. Various modifications to the structure and details of the present disclosure are possible, as can be understood by those skilled in the art within the scope of the present disclosure. Each embodiment can be combined with other embodiments as appropriate.

[0122] Each drawing is merely illustrative to illustrate one or more embodiments. Each drawing may be associated with one or more other embodiments rather than with only one specific embodiment. As those skilled in the art will understand, various features or steps described with reference to any one drawing can be combined with features or steps shown in one or more other drawings, for example, to create embodiments not explicitly shown or described. Not all features or steps shown in any one drawing to illustrate an exemplary embodiment are necessarily required, and some features or steps may be omitted. The order of steps shown in any of the drawings may be changed as appropriate.

[0123] Some or all of the above embodiments may also be described as follows, but are not limited to the following:

[0124] (Note 1) The system includes a first array that stores one or more values ​​corresponding to each of multiple keys, a second array in which elements corresponding to the elements of the first array store information indicating the storage location of the next value corresponding to the same key, and a management means for managing data using a hash table that holds first information indicating the storage location of the first value among the corresponding values ​​and second information indicating the storage location of the last value for each key. A data management device characterized by the following features.

[0125] (Note 2) The management means includes an additional means for storing a value in the first unused element of the first array based on a request to add a key-value pair. The data management device described in Appendix 1.

[0126] (Note 3) The additional means stores information indicating that the following value is not stored in the element of the second array corresponding to the element of the first array that stores the value of the additional request. The data management device described in Appendix 2.

[0127] (Note 4) The additional means, if the key of the additional request does not exist in the hash table, sets information indicating the storage location of the value of the additional request as the first information and the second information, respectively. The data management device described in Appendix 2 or Appendix 3.

[0128] (Note 5) The additional means, if the key of the additional request exists in the hash table, updates the elements of the second array identified by the second information corresponding to the key with information indicating the storage location of the value of the additional request. A data management device as described in any of the appendices 2 to 4.

[0129] (Note 6) The additional means updates the element of the second array identified by the second information corresponding to the key of the additional request if the key of the additional request exists in the hash table, and then updates the second information to information indicating the storage location of the value of the additional request. The data management device described in Appendix 5.

[0130] (Note 7) The management means includes an retrieval means for obtaining a value corresponding to a specific key from the hash table. A data management device as described in any of the appendices 1 through 6.

[0131] (Note 8) The system includes means for creating the aforementioned hash table. A data management device as described in any of the appendices 1 through 7.

[0132] (Note 9) Computers The data is managed using a hash table that includes a first array that stores one or more values ​​corresponding to each of multiple keys, a second array in which elements corresponding to the elements of the first array store information indicating the storage location of the next value corresponding to the same key, and for each key, a first piece of information indicating the storage location of the first value among the corresponding values ​​and a second piece of information indicating the storage location of the last value. A data management method characterized by the following features.

[0133] (Note 10) On the computer, A management process for managing data using a hash table that includes a first array storing one or more values ​​corresponding to each of multiple keys, a second array in which elements corresponding to the elements of the first array store information indicating the storage location of the next value corresponding to the same key, and for each key, a first piece of information indicating the storage location of the first value among the corresponding values ​​and a second piece of information indicating the storage location of the last value. A data management program for execution.

[0134] Furthermore, some or all of the configurations described in Appendices 2 to 8, which are dependent on Appendice 1 above, may also be dependent on Appendices 9 and 10 in the same way as those described in Appendices 2 to 8. Moreover, not limited to Appendices 1, 9, and 10, some or all of the configurations described as appendices may also be dependent on various hardware, software, various recording means for recording software, or systems, without departing from the embodiments described above. [Explanation of Symbols]

[0135] 10,100 Data Management Devices 11 Control measures 110 Hash Table Management Department 111 Creation Section 112 Additional section 113 Acquisition Department 120 Hash Table Memory Unit 1000 computers 1001 Processor 1002 Storage device 1003 memory 1004 Bus 1005 Input / Output Interface 1006 Network Interface

Claims

1. The system includes a first array that stores one or more values ​​corresponding to each of a plurality of keys, a second array in which elements corresponding to the elements of the first array store information indicating the storage location of the next value corresponding to the same key, and a management means for managing data using a hash table that holds first information indicating the storage location of the first value among the corresponding values ​​and second information indicating the storage location of the last value for each key. A data management device characterized by the following features.

2. The management means includes an additional means for storing a value in the first unused element of the first array based on a request to add a key-value pair. The data management device according to claim 1.

3. The aforementioned additional means stores information indicating that the following value is not stored in the element of the second array corresponding to the element of the first array that stores the value of the additional request. The data management device according to claim 2.

4. The additional means, if the key of the additional request does not exist in the hash table, sets information indicating the storage location of the value of the additional request as the first information and the second information, respectively. The data management device according to claim 3.

5. The additional means, if the key of the additional request exists in the hash table, updates the elements of the second array identified by the second information corresponding to the key with information indicating the storage location of the value of the additional request. The data management device according to claim 4.

6. The additional means updates the element of the second array identified by the second information corresponding to the key of the additional request if the key of the additional request exists in the hash table, and then updates the second information to information indicating the storage location of the value of the additional request. The data management device according to claim 5.

7. The management means includes an retrieval means for obtaining a value corresponding to a specific key from the hash table. A data management device according to any one of claims 1 to 6.

8. The system includes means for creating the aforementioned hash table. The data management device according to claim 7.

9. Computers The data is managed using a hash table that includes a first array storing one or more values ​​corresponding to each of multiple keys, a second array in which elements corresponding to the elements of the first array store information indicating the storage location of the next value corresponding to the same key, and for each key, a first piece of information indicating the storage location of the first value among the corresponding values ​​and a second piece of information indicating the storage location of the last value. A data management method characterized by the following features.

10. On the computer, A management process for managing data using a hash table that includes a first array storing one or more values ​​corresponding to each of multiple keys, a second array in which elements corresponding to the elements of the first array store information indicating the storage location of the next value corresponding to the same key, and for each key, a hash table that holds first information indicating the storage location of the first value among the corresponding values ​​and second information indicating the storage location of the last value. A data management program for execution.

Citation Information

Patent Citations

  • Communication apparatus, information processing device, communication method, and communication program

    JP2015177263A