WO2023045295A1 - 数据倾斜处理方法、设备、存储介质及程序产品 - Google Patents

数据倾斜处理方法、设备、存储介质及程序产品 Download PDF

Info

Publication number
WO2023045295A1
WO2023045295A1 PCT/CN2022/084642 CN2022084642W WO2023045295A1 WO 2023045295 A1 WO2023045295 A1 WO 2023045295A1 CN 2022084642 W CN2022084642 W CN 2022084642W WO 2023045295 A1 WO2023045295 A1 WO 2023045295A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
execution plan
key
skew
sub
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Ceased
Application number
PCT/CN2022/084642
Other languages
English (en)
French (fr)
Inventor
魏秀利
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Publication of WO2023045295A1 publication Critical patent/WO2023045295A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor

Definitions

  • the embodiments of the present invention relate to the field of computer technology, and in particular, to a data skew processing method, device, storage medium, and program product.
  • a distributed cluster system For a distributed cluster system, its different nodes are responsible for a certain range of data storage or data calculation. Usually, the dispersion of data is not enough, leading to the concentration of a large amount of data on one or several service nodes, which is called data skew.
  • Data skew Take the distributed computing engine Spark as an example. When the Spark computing engine performs shuffle, it needs to pull the same key Key on each node to a task task on a certain node for processing. The running progress of the entire Spark job is It is determined by the task with the longest running time, so the data skew of some keys will reduce the overall computing efficiency of Spark.
  • Adaptive Query Execution (AQE) technology can be introduced from the engine core level.
  • AQE uses runtime statistics to automatically optimize query execution for the above-mentioned data skew problem, and dynamically finds the amount of skewed data. And divide the skewed partition into smaller sub-partitions for processing.
  • the prior art center has at least the following problems: the optimization of data tilt through AOE technology depends on the accuracy of statistical information, and only supports part of the scene, for example, only supports the same stage
  • the scenario of only one link Join has limitations.
  • Embodiments of the present invention provide a data skew processing method, device, storage medium, and program product, so as to improve the comprehensiveness and accuracy of data skew processing.
  • an embodiment of the present invention provides a data skew processing method, including:
  • the data table to be connected is queried through the query node in the logical execution plan to obtain the Key of data skew, including:
  • the Key is determined as a Key with skewed data.
  • modifying the logic execution plan according to the key and data skew strategy of the data skew includes:
  • the merging of the connected first subtable to be connected and the connected second subtable to be connected includes:
  • the to-be-connected data tables include a first data table and a second data table, and the key of the data skew comes from the first data table and/or the second data table.
  • the first subtable to be connected corresponding to the Key corresponding to the data tilt obtained by splitting the data table to be connected carries out Map Join when Spark executes the physical execution plan, including:
  • Map Join is performed on the first subtable to be joined corresponding to the data-slanted Key when Spark executes the physical execution plan.
  • the modifying the logic execution plan according to the key of the data skew and the data skew policy also includes:
  • Each group corresponds to one of the first to-be-connected sub-tables
  • the first to-be-connected sub-table corresponding to the key corresponding to the data tilt obtained by splitting the data table to be connected performs Map Join when Spark executes the physical execution plan, including:
  • Map Join is performed on the first subtable to be joined corresponding to the group when Spark executes the physical execution plan.
  • the query node is added to the logical execution plan.
  • the generating the physical execution plan according to the modified logical execution plan includes:
  • the Map Join is a broadcast table link BroadcastHashJoin
  • the Reduce Join is a sort-merge link SortMergeJoin.
  • an embodiment of the present invention provides a data skew processing device, including:
  • the query module is used to query the data table to be connected through the query node in the logical execution plan to obtain the key Key of the data skew;
  • a modifying module configured to modify the logic execution plan according to the data skewed Key and the data skewed strategy, so that the first waiting list corresponding to the data skewed Key split from the data table to be connected
  • the connection sub-table is linked to Map Join when the distributed computing engine Spark executes the physical execution plan
  • the generating module is configured to generate the physical execution plan according to the modified logical execution plan, so as to execute the physical execution plan through Spark.
  • the query module is specifically used for:
  • the Key is determined as a Key with skewed data.
  • the modification module is specifically used for:
  • the modification module is specifically used for:
  • the to-be-connected data tables include a first data table and a second data table, and the key of the data skew comes from the first data table and/or the second data table.
  • the modification module is specifically used for: for each data-slanted Key, the first subtable to be connected corresponding to the data-slanted Key performs Map Join when Spark executes the physical execution plan.
  • the modification module is also used for:
  • Map Join is performed on the first subtable to be joined corresponding to the group when Spark executes the physical execution plan.
  • the device further includes:
  • the syntax analysis module is used to parse the structured query language SQL text into a syntax tree and generate an unparsed logic execution plan
  • a parsing module configured to parse the unparsed logical execution plan to obtain a logical execution plan
  • a creation module is used for adding the query node in the logical execution plan.
  • the generating module is specifically used for:
  • the Map Join is a broadcast table link BroadcastHashJoin
  • the Reduce Join is a sort-merge link SortMergeJoin.
  • an embodiment of the present invention provides a data skew processing device, including: at least one processor and a memory;
  • the memory stores computer-executable instructions
  • the at least one processor executes the computer-executed instructions stored in the memory, so that the at least one processor executes the method described in the above first aspect and various possible designs of the first aspect.
  • an embodiment of the present invention provides a computer-readable storage medium, where computer-executable instructions are stored in the computer-readable storage medium, and when the processor executes the computer-executable instructions, the above first aspect and the first Aspects of various possible designs of the described method.
  • an embodiment of the present invention provides a computer program product, including a computer program.
  • the computer program is executed by a processor, the method described in the above first aspect and various possible designs of the first aspect is implemented.
  • an embodiment of the present invention provides a chip for running instructions, the chip includes a memory and a processor, codes and data are stored in the memory, the memory is coupled to the processor, and the processor runs The codes in the memory enable the chip to execute the method described in the above first aspect and various possible designs of the first aspect.
  • an embodiment of the present invention provides a computer program, which is used to execute the method described in the first aspect and various possible designs of the first aspect when the computer program is executed by a processor.
  • the data tilt processing method, device, storage medium and program product provided in this embodiment, queries the data table to be connected through the query node in the logic execution plan, obtains the key Key of data tilt, and according to the Key and
  • the data skew strategy modifies the logical execution plan, so that the first subtable to be connected corresponding to the key of the data skew obtained by splitting the data table to be connected executes the physical execution plan in the distributed computing engine Spark
  • When performing mapping end link Map Join generate the physical execution plan according to the modified logical execution plan, so as to execute the physical execution plan through Spark.
  • the data skew processing method provided in this embodiment optimizes the processing of skewed Keys from Reduce Join to Map Join by modifying the logical execution plan, which avoids many problems caused by data skew from the root, reduces scene restrictions, and avoids It reduces the dependence on statistical information and improves the comprehensiveness and accuracy of data skew processing.
  • Fig. 1 is a schematic flow chart of linking two data tables provided by an embodiment of the present invention
  • Fig. 2 is a schematic flow diagram of linking operations provided by the prior art through spallation tilt Key
  • FIG. 3 is a schematic flow chart of a data skew processing method provided by an embodiment of the present invention.
  • FIG. 4 is a schematic flowchart of a data skew processing method provided by another embodiment of the present invention.
  • Fig. 5 is a schematic flow chart of linking two data tables provided by another embodiment of the present invention.
  • Fig. 6 is the directed acyclic graph that two data tables provided by the prior art are linked and operated;
  • Fig. 7 is a directed acyclic graph of two data tables provided by another embodiment of the present invention for link operation;
  • Fig. 8 is the directed acyclic graph that two data tables that another embodiment of the present invention provides carry out link operation
  • FIG. 9 is a schematic flowchart of a data skew processing method provided by yet another embodiment of the present invention.
  • FIG. 10 is a schematic structural diagram of a data skew processing device provided by an embodiment of the present invention.
  • FIG. 11 is a schematic diagram of a hardware structure of a data skew processing device provided by an embodiment of the present invention.
  • data skew For a distributed cluster system, its different nodes are responsible for a certain range of data storage or data calculation. Usually, the dispersion of volume data is not enough, resulting in a large amount of data being concentrated on one or several service nodes, which is called data skew.
  • the distributed computing engine Spark When the distributed computing engine Spark performs shuffling, it needs to pull the same key on each node to a task on a certain node for processing, such as performing operations such as aggregation or link join according to the key. At this time, if the amount of data corresponding to a certain Key is particularly large, data skew will occur. For example, most keys correspond to 10 pieces of data, but individual keys correspond to 1 million pieces of data, then most tasks may only be allocated to 10 pieces of data, and then run in a few seconds; but individual tasks may be allocated to 1 million data, to run for an hour or two. Therefore, the running progress of the entire Spark job is determined by the task with the longest running time.
  • Fig. 1 is the flow schematic diagram that two data tables provided by an embodiment of the present invention carry out link operation; As shown in Fig.
  • the data in the column is the mathematics competition results corresponding to different IDs.
  • Table 1-2 shows the students' English competition results.
  • the first column of data includes the student ID number, and the second column of data is the English competition results corresponding to different IDs. From the two It can be seen from the table that the student with ID 001 in Table 1-1 has a large number of grades. When the two tables are joined, each ID is equivalent to a Key. Obviously, the amount of data corresponding to Key001 is relatively large. When the task corresponding to Key001 is processed, it takes more time than other keys. Therefore, it can be said that Key001 has data skew. Of course, this is just an example description for a more vivid understanding of data skew. In actual applications, the data volume determination conditions corresponding to skewed keys can be set as needed.
  • Spark kernel introduces adaptive query execution technology (Adaptive Query Execution, AQE), AQE uses runtime statistics to automatically optimize query execution for the above data skew problem, and dynamically finds skewed data , and divide the skewed partitions into smaller subpartitions for processing.
  • AQE technology strongly relies on runtime statistical information. If the statistical information is inaccurate, it will lead to misjudgment or omission of data skew; on the other hand, AQE technology only supports only A join scenario does not support the multi-table join scenario, and the AQE data skew optimization logic will not be triggered for the scenario with a shuffle after the join.
  • AQE-based data skew processing is positioned at the Partition granularity. Skewed governance, if the skewed data is generated by the same Mapper, it cannot be resolved.
  • the AQE technology belongs to the optimization of the Physical Plan of the physical execution plan.
  • the entire execution plan of Spark SQL it mainly includes: Logical Plan of execution plan and Physical Plan of physical execution plan.
  • the latter is composed of The transformation of the former means that if we start with the logical execution plan and optimize the data skew, we can solve the problem of data skew from the root and avoid defects at the application layer or physical execution plan level. Based on this, the embodiment of the present invention provides a data skew processing method.
  • FIG. 3 is a schematic flowchart of a data skew processing method provided by an embodiment of the present invention. As shown in Figure 3, the method includes:
  • the data table to be connected may include at least two data tables, for example, it may include the first data table and the second data table, and the first data table and the second data table may be respectively processed by the query node in the logical execution plan.
  • Tables are queried separately, and can also include more than three data tables, such as the first data table, the second data table, and the third data table.
  • the first data table, the second data table, and the third data table can be sequentially Table etc. to query.
  • the number of data tables to be connected and the query order are not limited.
  • the querying the data table to be connected through the query node in the logical execution plan to obtain the key of the data skew includes: for each Key of the data table to be connected, the The data amount corresponding to the Key is compared with a first preset threshold; if the data amount corresponding to the Key is greater than the first preset threshold, the Key is determined as a key with data skew.
  • the query can be performed for each Key, as shown in Figure 1, assuming Table 1-1 and Table 1-2
  • Table 1-1 and Table 1-2 For the data table to be connected, in a feasible way, you can first query Key001 in Table 1-1, and then query other keys such as Key002 and Key003 in turn, and then query Key001 in Table 2-1, and then Query other keys such as Key002 and Key003 in turn.
  • This method is conducive to finding the skewed key as soon as possible, and if the number of keys is too small to become a skewed key, the query can be stopped in time to save the amount of computation.
  • the specific query mode to be used may be determined according to actual needs, which is not limited in this embodiment.
  • the amount of data corresponding to the Key may be compared with a first preset threshold.
  • the amount of data here may be the size of the data capacity, such as how many megabytes, how many G, or the number of records.
  • the first preset threshold may be a fixed value determined empirically.
  • mapping end link Map Join is performed.
  • the logical execution plan is modified based on the data skew Key and the data skew strategy, so that the first word table to be connected corresponding to the data skew Key obtained by splitting from the data table to be connected will be processed in the subsequent physical execution plan.
  • the Spark computing engine can connect to the mapping side during execution.
  • Map Join at the mapping end and Reduce Join at the merging end are used to join the data tables to be joined. That is, the merge operation of data from different data sources.
  • Reduce Join is to complete the marking of data in the Map stage, and complete the merging of data in the Reduce stage.
  • Map Join is to complete the merging of data directly in the Map stage, without the Reduce stage.
  • Table 1-1 and Table 2-1 in Figure 1 take this as an example to illustrate the Reduce Join process.
  • the input data will be uniformly encapsulated into a Bean.
  • This Bean Contains all public and non-public attributes of Table 1-1 and Table 2-1, which is equivalent to a full outer connection, and adds a new attribute, the file name, to distinguish whether the data comes from Table 1-1 or Table 2- 1. It is convenient for data processing in the Reduce phase; the Key output by the Map is the ID of the student ID, and the Value is the Bean.
  • the beans are sorted according to the ID, and all the data with the same ID will be aggregated under the same key and sent to the same Reduce task; Source, whether it is Table 1-1 or Table 2-1.
  • Source whether it is Table 1-1 or Table 2-1.
  • Map Join is performed on Table 1-1 and Table 2-1, there is no Reduce process, and all work is completed in the Map phase, which greatly reduces the cost of network transmission and input and output.
  • the first sub-table to be connected includes the key corresponding to 001 from table 1-1
  • the first sub-data table comes from the second sub-data table corresponding to 001 in Table 2-1.
  • the first to-be-connected sub-table corresponding to the Key of the data tilt obtained by splitting from the data table to be connected performs a mapping end link Map Join when the distributed computing engine Spark executes the physical execution plan, which can be in Sark
  • Map join the first sub-data table and the second sub-data table specifically, the first sub-data table or the second sub-data table, for example, pre-cache the second sub-data table in each Map task node, and when the data of the first sub-data table is transmitted, directly connect the pre-stored data of the second sub-data table with the data of the first sub-data table and output it.
  • Spark's execution of the API in the code mainly includes the following steps: first write the DataFrame/Dataset/SQL code; secondly, if there is no error in the written code, Spark will convert these codes into a logical execution plan; again, Spark will After performing a series of optimizations on the generated logical execution plan, the optimized logical execution plan is converted into a physical execution plan; finally, Spark executes the physical execution plan, that is, the Resilient Distributed Datasets (Resilient Distributed Datasets, RDD) to perform a series of operations.
  • RDD Resilient Distributed Datasets
  • a physical execution plan may be generated based on the modified logical execution plan.
  • the logical execution plan to be modified may be an optimized logical execution plan or an unoptimized logical execution plan, which is not limited in this embodiment.
  • the data table to be connected is queried through the query node in the logical execution plan to obtain the key Key of data skew, and the logical execution plan is executed according to the key of the data skew and the data skew strategy.
  • Modify so that the first subtable to be connected corresponding to the Key corresponding to the data tilt obtained from the data table to be split is carried out the mapping end link Map Join when the distributed computing engine Spark executes the physical execution plan, according to the modification
  • After the logical execution plan generate the physical execution plan, so as to execute the physical execution plan through Spark.
  • the data skew processing method provided in this embodiment optimizes the processing of skewed Keys from Reduce Join to Map Join by modifying the logical execution plan, which avoids many problems caused by data skew from the root, reduces scene restrictions, and avoids It reduces the dependence on statistical information and improves the comprehensiveness and accuracy of data skew processing.
  • FIG. 4 is a schematic flow chart of a data skew processing method provided by another embodiment of the present invention. As shown in FIG. 4 , on the basis of the above embodiments, for example, on the basis of the embodiment shown in FIG. 3 , how to modify the logic modification plan is described in detail in this embodiment, and the method includes:
  • step 401 is similar to step 301 in the foregoing embodiment, and will not be repeated here.
  • the processing step of the sub-table to be connected, so that the first sub-table to be connected corresponding to the Key of the data skew obtained from the splitting of the data table to be connected is mapped when the distributed computing engine Spark executes the physical execution plan Link Map Join.
  • the data tables to be connected include a first data table and a second data table, and the key of the data skew comes from the first data table and/or the second data table. That is to say, any data table in the data table to be connected may be determined to have a key with data skew.
  • any data table in the data table to be connected may be determined to have a key with data skew.
  • only one of the two data tables has a key with skewed data, that is, Key001 in Table 1-1.
  • there are keys with skewed data in both data tables that is, the key with skewed data in Table 1-1 is 001, and the key with skewed data in Table 4-1 is 003.
  • connection process of the data tables to be connected Table 1-1 and Table 4-1 will be illustrated below in conjunction with FIG. 5 .
  • the key of the data skew in Table 1-1 is 001
  • the key of the data skew in Table 4-1 is 003. Therefore, after splitting Table 1-1, get Table 1-1-1 including data corresponding to data skew Key001 and 003, and Table 1-1-2 including data non-skew Key002; in Table 4-1 After splitting, get Table 4-1-1 including data corresponding to data skew Key001 and 003, and Table 4-1-2 including data non-skewed Key002, that is, in the table 1-1 and After Table 4-1 is split according to the key of the data skew, the first sub-table to be connected is obtained consisting of Table 1-1-1 and Table 4-1-1, and Table 1-1-2 and Table 4-1 The second to-be-connected subtable composed of -2.
  • Table 1-1 and Table 4-1 in Figure 5 are just examples, and only 3 Keys from 001 to 003 are shown in order to describe the data table connection process. In an actual data table, the data volume of Keys can reach tens of thousands or tens of millions.
  • Table 1-1-1 and Table 4-1-1 in the sub-table to be joined are both small tables that can be used for Map Join when Spark executes the physical execution plan, while Table 1-1-1 in the second sub-table to be joined 2 and Table 4-1-2 are large tables that can be used for Reduce Join when Spark executes the physical execution plan.
  • the implementation process of Map Join and Reduce Join can refer to the description of step 302, and will not be repeated here.
  • the merging the connected first to-be-connected sub-table and the connected second to-be-connected sub-table includes: using a Union operator to combine the connected first to-be-connected sub-table The to-be-connected sub-table is merged with the connected second to-be-connected sub-table to obtain a final data table.
  • the Map Join is a broadcast table link BroadcastHashJoin
  • the Reduce Join is a sort-merge link SortMergeJoin.
  • the Key of the data tilt is multiple
  • the first subtable to be connected is multiple
  • the The key of the data skew is in one-to-one correspondence with the first subtable to be connected
  • the first subtable to be connected corresponding to the key of the data skew obtained by splitting the data table to be connected is physically executed in Spark Map Join is performed during planning, including: for each data-slanted Key, Map Join is performed on the first subtable to be joined corresponding to the data-slanted Key when Spark executes the physical execution plan.
  • each key of the data slope corresponds to a first child table to be connected , that is, when splitting Table 1-1, two first sub-tables to be connected can be obtained by splitting.
  • the first sub-table to be connected only includes the data of Key001, while the other sub-table to be connected only includes Data of Key002.
  • Stage1 and Stage2 target a first sub-table to be joined, and Stage3 and Stage4 target another first sub-table to be joined. Specifically, both realize the key of data skew through BroadcastHashJoin The Map Join.
  • Stage5 and Stage6 are for the second sub-table to be joined.
  • the Reduce Join of the key with non-slanted data is realized through SortMergeJoin.
  • Stage7 the two first to-be-joined sub-tables executed by BroadcastHashJoin and the second to-be-joined sub-table executed by SortMergeJoin are merged into Union to obtain the final data table.
  • modifying the logic execution plan according to the key of the data tilt and the data tilt strategy further comprising: grouping the keys of the data tilt to obtain multiple groups; the total data of each group The amount is less than the second preset threshold; each group corresponds to one of the first sub-tables to be connected; the first sub-table to be connected corresponding to the Key of the data skew obtained from the splitting of the data table to be connected
  • Map Join when Spark executes the physical execution plan includes: for each group, performing Map Join on the first subtable to be joined corresponding to the group when Spark executes the physical execution plan.
  • the data skew Keys 001 and 003 can be grouped based on the second preset threshold, for example, assuming If the sum of the data amounts corresponding to 001 and 003 is less than the second preset threshold, 001 and 003 can be divided into one group as shown in FIG. 5 , and the data table to be connected has and only has this one group. As shown in Figure 7, for this grouping, a first subtable to be connected can be obtained, and for this subtable to be connected, after performing the processing of Stage1 and Stage2, BroadcastHashJoin can be performed to realize the first subtable to be connected Map Join.
  • Stage3 and Stage4 are for the second sub-table to be joined.
  • the Reduce Join of the key with non-slanted data is realized through SortMergeJoin.
  • Stage5 the first to-be-joined sub-table executed by BroadcastHashJoin and the second to-be-joined sub-table executed by SortMergeJoin are merged into Union to obtain the final data table.
  • the setting of the second preset threshold may be set according to experience, which is not limited in this embodiment.
  • the 100 data skewed keys can be grouped based on the second preset threshold in various ways.
  • the keys with data skew can be sorted according to the number of the key, and then the data volume of the first key in the sorting can be judged based on the second preset threshold, if it is less than the second preset threshold , the total amount of data of the first and second Key is judged based on the second preset threshold, and if it is still less than the second preset threshold, the total amount of data of the first, second, and third Key is Quantity is judged based on the second preset threshold, until it exceeds the second preset threshold, then the Key before the N-1th is classified into a group, and the judgment of the above steps is continued from the Nth.
  • the Keys with skewed data may be sorted according to the amount of data corresponding to each Key. Then the keys in the sorting are grouped based on the second preset threshold. This is not limited in this embodiment, and can be selected according to actual needs.
  • FIG. 6 is a directed acyclic graph of two data tables provided in the prior art for link operation.
  • Fig. 7 is a directed acyclic graph of linking operation of two data tables provided by another embodiment of the present invention.
  • Fig. 8 is a directed acyclic graph of linking operation of two data tables provided by another embodiment of the present invention.
  • both stage 1Stage1 and stage 2Stage2 include the following steps in sequence: range Range, projection Project, exchange Exchange, custom read CustomShuffleReader and sort Sort; stage 3Stage3 includes sort merge link SortMergeJoin.
  • stage 1Stage1 includes the following steps: range Range, filter Filter, projection Project, exchange Exchange, custom read CustomShuffleReader and broadcast exchange BroadcastExchage;
  • stage 2Stage2 includes the following steps: range Range, filter Filter, projection Project, exchange Exchange, custom read CustomShuffleReader;
  • stage 3Stage3 and stage 4Stage4 both include range Range, filter Filter, projection Project, exchange Exchange, custom read CustomShuffleReader and sort Sort;
  • stage 5 includes the following steps: broadcast table link BroadcastHashJoin, sort merge link SortMergeJoin, merge Union and adaptive Spark execution plan AdaptiveSparkPlan.
  • Table 1-1 and Table 4-1 shown in Figure 5 are linked, usually through Table 1-1.
  • Stage1 For the processing of Stage1, after Table 4-1 is processed by Stage2, SortMergeJoin is performed in Stage3 to realize Reduce Join.
  • Sub-tables of the next level, corresponding to Table 4-1-2 is also split to obtain multiple sub-tables, and then for each group of sub-tables (including a sub-sub-table of Table 1-1-1 table, and the next-level sub-table of Table 4-1-2 corresponding to the lower-level sub-table), after processing Stage1 and Stage2, perform BroadcastHashJoin to realize multiple MapJoins. Finally, through the processing of Stage7, multiple tables obtained by BroadcastHashJoin and tables obtained by SortMergeJoin are merged, and then the adaptive Spark execution plan is executed.
  • the Spark task running time is 5.5 minutes
  • the embodiment of the present invention that is, in the processing mode shown in Figure 7 or Figure 8 after optimization
  • Spark The task runtime is 2.1 minutes and the overall performance is improved by 60%.
  • Step 404 in this embodiment is similar to step 303 in the above embodiment, and will not be repeated here.
  • the data skew processing method provided by the embodiment of the present invention splits the key of data skew and the key of non-data skew by modifying the logical execution plan, so that when Spark executes the physical execution plan, the Key of data skew can correspond to Map Join is performed on the first child table to be connected, which greatly reduces the running time.
  • the long running time of the key that avoids data skew affects the running efficiency of the entire Spark task. And this method has no scene restrictions, which solves the problem of data skew from the root.
  • FIG. 9 is a schematic flow chart of a data skew processing method provided by yet another embodiment of the present invention. As shown in FIG. 9, on the basis of the above-mentioned embodiments, for example, on the basis of the embodiment shown in FIG. 3, the generation process of the logical execution plan in this embodiment and the generation of the physical execution plan from the modified logical execution plan process is described in detail.
  • the method includes:
  • the logical execution plan is mainly a series of abstract conversion processes. No executors or drivers are involved, it just translates the user's set of expressions into an optimal version. Specifically, the user's code will first be converted into an unresolved logical execution plan (Unresolved Logical Plan). The reason why the unresolved logical plan is called unresolved is because the unresolved logical execution plan is not necessarily correct.
  • the table name or column name referenced by the logical execution plan may or may not exist. Spark will then use the catalog Catalog, a metadata warehouse containing all data tables and data frames DataFrame, in the parser (Analyser) to resolve the table name or column name referenced by proofreading.
  • the logical execution plan (Resolved Logical Plan) can be obtained. Add a query node (Query Node) in the logical execution plan to query the data table to be connected through the query node.
  • mapping end link Map Join Modify the logic execution plan according to the data skew Key and the data skew policy, so that the first subtable to be joined corresponding to the data skew Key split from the data table to be joined
  • the mapping end link Map Join is performed.
  • Step 904 and step 905 in this embodiment are similar to step 301 and step 302 in the above embodiment, and will not be repeated here.
  • the logical execution plan After the logical execution plan is modified, it needs to be updated, so that subsequent steps can apply the updated logical execution plan. Pass the modified logical execution plan to the optimizer Catalyst Optimizer for optimization, and then generate an optimized logical execution plan through a series of optimizations. Spark translates this logical execution plan into a physical execution plan, checking for feasible optimization strategies, and checking for optimizations along the way.
  • the physical execution plan determines how to execute the logical plan on the cluster by generating different physical execution operations and conducting comparative analysis through the cost model.
  • Spark chooses a physical plan, Spark runs all codes on Spark's underlying programming interface RDD. Spark performs further optimizations at runtime, generates native Java bytecode that can optimize tasks or stages during execution, and finally returns the results to the user.
  • Spark executes the physical execution plan , it is possible to perform Map Join on the skewed Key of the split data corresponding to the first sub-table to be joined, which can greatly save the running time. It avoids many problems caused by data skew from the root, reduces scene restrictions, avoids dependence on statistical information, and improves the comprehensiveness and accuracy of data skew processing.
  • FIG. 10 is a schematic structural diagram of a data skew processing device provided by an embodiment of the present invention.
  • the data skew processing device 100 includes: a query module 1001 , a modification module 1002 and a generation module 1003 .
  • the query module 1001 is configured to query the data table to be connected through the query node in the logic execution plan, and obtain the key Key of the data skew.
  • a modifying module 1002 configured to modify the logic execution plan according to the data skewed Key and the data skewed strategy, so that the data skewed key corresponding to the first
  • Map Join is performed at the mapping end.
  • the generating module 1003 is configured to generate the physical execution plan according to the modified logical execution plan, so as to execute the physical execution plan through Spark.
  • the query module is specifically used for:
  • the Key is determined as a Key with skewed data.
  • the modification module is specifically used for:
  • the modification module is specifically used for:
  • the to-be-connected data tables include a first data table and a second data table, and the key of the data skew comes from the first data table and/or the second data table.
  • the modification module is specifically used for: for each data-slanted Key, the first sub-table to be connected corresponding to the data-slanted Key performs Map Join when Spark executes the physical execution plan.
  • the modification module is also used for:
  • Map Join is performed on the first subtable to be joined corresponding to the group when Spark executes the physical execution plan.
  • the device further includes:
  • the syntax analysis module is used to parse the structured query language SQL text into a syntax tree and generate an unparsed logic execution plan.
  • the parsing module is configured to parse the unparsed logical execution plan to obtain the logical execution plan.
  • a creation module is used for adding the query node in the logical execution plan.
  • the generating module is specifically used for:
  • the Map Join is a broadcast table link BroadcastHashJoin
  • the Reduce Join is a sort-merge link SortMergeJoin.
  • the data skew processing device provided by the embodiment of the present invention can be used to execute the above-mentioned method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not repeat them here.
  • Fig. 11 is a schematic diagram of the hardware structure of a data tilt processing device provided by an embodiment of the present invention.
  • the device may be a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc. .
  • Device 110 may include one or more of the following components: processing component 1101 , memory 1102 , power supply component 1103 , input/output (I/O) interface 1104 , and communication component 1106 .
  • Processing component 1101 generally controls the overall operations of device 110, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations.
  • the processing component 1101 may include one or more processors 1105 to execute instructions to complete all or part of the steps of the above method. Additionally, the processing component 1101 may include one or more modules to facilitate interaction between the processing component 1101 and other components. For example, processing component 1101 may include a multimedia module to facilitate interaction between multimedia component 808 and processing component 1101 .
  • Memory 1102 is configured to store various types of data to support operations at device 110 . Examples of such data include instructions for any application or method operating on device 110, contact data, phonebook data, messages, pictures, videos, and the like.
  • the memory 1102 can be implemented by any type of volatile or non-volatile storage device or their combination, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable Programmable Read Only Memory (EPROM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), Magnetic Memory, Flash Memory, Magnetic or Optical Disk.
  • SRAM static random access memory
  • EEPROM electrically erasable programmable read-only memory
  • EPROM erasable Programmable Read Only Memory
  • PROM Programmable Read Only Memory
  • ROM Read Only Memory
  • Magnetic Memory Flash Memory
  • Magnetic or Optical Disk Magnetic Disk
  • the power supply component 1103 provides power to various components of the device 110 .
  • Power components 1103 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for device 110 .
  • the I/O interface 1104 provides an interface between the processing component 1101 and a peripheral interface module.
  • the peripheral interface module may be a keyboard, a click wheel, a button, and the like. These buttons may include, but are not limited to: a home button, volume buttons, start button, and lock button.
  • Communication component 1106 is configured to facilitate wired or wireless communications between device 110 and other devices.
  • the device 110 may access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof.
  • the communication component 1106 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel.
  • the communication component 1106 also includes a near field communication (NFC) module to facilitate short-range communication.
  • NFC near field communication
  • the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, Infrared Data Association (IrDA) technology, Ultra Wide Band (UWB) technology, Bluetooth (BT) technology and other technologies.
  • RFID Radio Frequency Identification
  • IrDA Infrared Data Association
  • UWB Ultra Wide Band
  • Bluetooth Bluetooth
  • device 110 may be programmed by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable A gate array (FPGA), controller, microcontroller, microprocessor or other electronic component implementation for performing the methods described above.
  • ASICs application specific integrated circuits
  • DSPs digital signal processors
  • DSPDs digital signal processing devices
  • PLDs programmable logic devices
  • FPGA field programmable A gate array
  • controller microcontroller, microprocessor or other electronic component implementation for performing the methods described above.
  • the present application also provides a computer-readable storage medium, where computer-executable instructions are stored in the computer-readable storage medium, and when a processor executes the computer-executable instructions, the data skew processing method performed by the above data skew processing device is realized.
  • the above-mentioned computer-readable storage medium can be realized by any type of volatile or non-volatile storage device or their combination, such as static random access memory (SRAM), electrically erasable Programmable Read Only Memory (EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), Magnetic Memory, Flash Memory, Magnetic or Optical Disk.
  • SRAM static random access memory
  • EEPROM electrically erasable Programmable Read Only Memory
  • EPROM Erasable Programmable Read Only Memory
  • PROM Programmable Read Only Memory
  • ROM Read Only Memory
  • Magnetic Memory Flash Memory
  • Magnetic or Optical Disk Readable storage media can be any available media that can be accessed by a general purpose or special purpose computer.
  • An exemplary readable storage medium is coupled to the processor such the processor can read information from, and write information to, the readable storage medium.
  • the readable storage medium can also be a component of the processor.
  • the processor and the readable storage medium may be located in Application Specific Integrated Circuits (ASIC for short).
  • ASIC Application Specific Integrated Circuits
  • the processor and the readable storage medium can also exist in the device as discrete components.
  • the aforementioned program can be stored in a computer-readable storage medium.
  • the program executes the steps including the above-mentioned method embodiments; and the aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk and other various media that can store program codes.
  • An embodiment of the present invention also provides a computer program product, including a computer program.
  • the computer program is executed by a processor, the above data skew processing method performed by the data skew processing device is implemented.
  • the embodiment of the present invention also provides a chip for running instructions.
  • the chip includes a memory and a processor. Codes and data are stored in the memory.
  • the memory is coupled to the processor.
  • the processor runs the memory in the memory.
  • the code enables the chip to execute the data skew processing method performed by the above data skew processing device.
  • An embodiment of the present invention further provides a computer program, which is used to execute the data skew processing method performed by the above data skew processing device when the computer program is executed by a processor.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Computing Systems (AREA)
  • Computational Linguistics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

一种数据倾斜处理方法、设备、存储介质及程序产品,涉及计算机技术领域。方法包括逻辑执行计划中的查询节点对待连接数据表进行查询,获得数据倾斜的键Key,根据数据倾斜的Key与数据倾斜策略对逻辑执行计划进行修改,以使从待连接数据表中拆分得到的数据倾斜的Key对应的第一待连接子表在Spark执行物理执行计划时进行映射端链接Map Join,根据修改后的逻辑执行计划,生成物理执行计划。本实施例提供的方法通过对逻辑执行计划进行修改,从根源上规避了数据倾斜带来的诸多问题,减少了场景限制,避免了对统计信息的依赖,提高了数据倾斜处理的全面性和准确性。

Description

数据倾斜处理方法、设备、存储介质及程序产品
本申请要求于2021年09月27日提交中国专利局、申请号为202111139049.1、申请名称为“数据倾斜处理方法、设备、存储介质及程序产品”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本发明实施例涉及计算机技术领域,尤其涉及一种数据倾斜处理方法、设备、存储介质及程序产品。
背景技术
对于分布式集群系统,其不同节点负责一定范围的数据存储或数据计算。通常将数据分散度不够,导致大量的数据集中到一台或者几台服务节点上的情况,称为数据倾斜。以分布式计算引擎Spark为例,Spark计算引擎进行洗牌Shuffle的时候,需要将各个节点上相同的键Key拉取到某个节点上的一个任务task来进行处理,整个Spark作业的运行进度是由运行时间最长的task决定,因此部分Key发生数据倾斜后,会使得Spark的整体计算效率降低。
现有技术中,可以从引擎内核层面,引入自适应查询执行(Adaptive Query Execution,AQE)技术,AQE针对上述数据倾斜问题使用运行时的统计信息自动优化查询执行,动态的发现倾斜数据的数量,并且把倾斜的分区分成更小的子分区来处理。
然而,实现本发明过程中,发明人发现现有技术中心至少存在如下问题:通过AOE技术进行数据倾斜的优化,依赖于统计信息的准确度,且仅支持部分场景,例如仅支持同一阶段Stage中只有一个链接Join的场景,具有局限性。
发明内容
本发明实施例提供一种数据倾斜处理方法、设备、存储介质及程序产品,以提高数据倾斜处理的全面性和准确性。
第一方面,本发明实施例提供一种数据倾斜处理方法,包括:
通过逻辑执行计划中的查询节点对待连接数据表进行查询,获得数据倾斜的键Key;
根据所述数据倾斜的Key与数据倾斜策略对所述逻辑执行计划进行修改,以使从所述待连接数据表中拆分得到的所述数据倾斜的Key对应的第一待连接子表在分布式计算引擎Spark执行物理执行计划时进行映射端链接Map Join;
根据修改后的所述逻辑执行计划,生成所述物理执行计划,以通过Spark执行所述物理执行计划。
在一种可能的设计中,所述通过逻辑执行计划中的查询节点对待连接数据表进行查询,获得数据倾斜的Key,包括:
针对所述待连接数据表的每个Key,将所述Key对应的数据量与第一预设阈值进行对比;
若所述Key对应的数据量大于所述第一预设阈值,则将所述Key确定为数据倾斜的Key。
在一种可能的设计中,所述根据所述数据倾斜的Key与数据倾斜策略对所述逻辑执行计划进行修改,包括:
在所述逻辑执行计划中增加以下处理步骤:
根据所述数据倾斜的Key,将所述待连接数据表的数据进行拆分,得到所述第一待连接子表和数据非倾斜的Key对应的第二待连接子表;
将连接后的所述第一待连接子表和连接后的所述第二待连接子表进行合并,得到最终的数据表。
在一种可能的设计中,所述将连接后的所述第一待连接子表和连接后的所述第二待连接子表进行合并,包括:
通过Union算子,将连接后的所述第一待连接子表和连接后的所述第二待连接子表进行合并,得到最终的数据表。
在一种可能的设计中,所述待连接数据表包括第一数据表和第二数据表,所述数据倾斜的Key来自于所述第一数据表和/或所述第二数据表。
在一种可能的设计中,所述数据倾斜的Key为多个,所述第一待连接子表为多个,所述数据倾斜的Key与所述第一待连接子表一一对应;
所述从所述待连接数据表中拆分得到的所述数据倾斜的Key对应的第 一待连接子表在Spark执行物理执行计划时进行Map Join,包括:
针对每个数据倾斜的Key,所述数据倾斜的Key对应的第一待连接子表在Spark执行物理执行计划时进行Map Join。
在一种可能的设计中,所述数据倾斜的Key为多个,所述第一待连接子表为至少一个;
所述根据所述数据倾斜的Key与数据倾斜策略对所述逻辑执行计划进行修改,还包括:
将所述数据倾斜的Key进行分组,得到多个分组;每个分组的总数据量小于第二预设阈值;
每个分组对应一个所述第一待连接子表;
所述从所述待连接数据表中拆分得到的所述数据倾斜的Key对应的第一待连接子表在Spark执行物理执行计划时进行Map Join,包括:
针对每个分组,所述分组对应的第一待连接子表在Spark执行物理执行计划时进行Map Join。
在一种可能的设计中,所述通过逻辑执行计划中的查询节点对待连接数据表进行查询之前,还包括:
将结构化查询语言SQL文本解析成语法树,生成未解析逻辑执行计划;对所述未解析逻辑执行计划进行解析,得到逻辑执行计划;
在所述逻辑执行计划中加入所述查询节点。
在一种可能的设计中,所述根据修改后的所述逻辑执行计划,生成所述物理执行计划,包括:
对修改后的所述逻辑执行计划进行更新,得到更新后的逻辑执行计划;
对所述更新后的逻辑执行计划进行优化,得到优化后的逻辑执行计划;
将所述优化后的逻辑执行计划转换为物理执行计划。
在一种可能的设计中,所述第二待连接子表Spark执行物理执行计划时进行归并端链接Reduce Join。
在一种可能的设计中,所述Map Join为广播表链接BroadcastHashJoin,所述Reduce Join为排序合并链接SortMergeJoin。
第二方面,本发明实施例提供一种数据倾斜处理设备,包括:
查询模块,用于通过逻辑执行计划中的查询节点对待连接数据表进行查询,获得数据倾斜的键Key;
修改模块,用于根据所述数据倾斜的Key与数据倾斜策略对所述逻辑执行计划进行修改,以使从所述待连接数据表中拆分得到的所述数据倾斜的Key对应的第一待连接子表在分布式计算引擎Spark执行物理执行计划时进行映射端链接Map Join;
生成模块,用于根据修改后的所述逻辑执行计划,生成所述物理执行计划,以通过Spark执行所述物理执行计划。
在一种可能的设计中,所述查询模块具体用于:
针对所述待连接数据表的每个Key,将所述Key对应的数据量与第一预设阈值进行对比;
若所述Key对应的数据量大于所述第一预设阈值,则将所述Key确定为数据倾斜的Key。
在一种可能的设计中,所述修改模块具体用于:
在所述逻辑执行计划中增加以下处理步骤:
根据所述数据倾斜的Key,将所述待连接数据表的数据进行拆分,得到所述第一待连接子表和数据非倾斜的Key对应的第二待连接子表;
将连接后的所述第一待连接子表和连接后的所述第二待连接子表进行合并,得到最终的数据表。
在一种可能的设计中,所述修改模块具体用于:
通过Union算子,将连接后的所述第一待连接子表和连接后的所述第二待连接子表进行合并,得到最终的数据表。
在一种可能的设计中,所述待连接数据表包括第一数据表和第二数据表,所述数据倾斜的Key来自于所述第一数据表和/或所述第二数据表。
在一种可能的设计中,所述数据倾斜的Key为多个,所述第一待连接子表为多个,所述数据倾斜的Key与所述第一待连接子表一一对应;所述修改模块具体用于:针对每个数据倾斜的Key,所述数据倾斜的Key对应的第一待连接子表在Spark执行物理执行计划时进行Map Join。
在一种可能的设计中,所述数据倾斜的Key为多个,所述第一待连接子表为至少一个;所述修改模块还用于:
所述数据倾斜的Key为多个,所述第一待连接子表为至少一个;
针对每个分组,所述分组对应的第一待连接子表在Spark执行物理执行计划时进行Map Join。
在一种可能的设计中,所述设备,还包括:
语法分析模块,用于将结构化查询语言SQL文本解析成语法树,生成未解析逻辑执行计划;
解析模块,用于对所述未解析逻辑执行计划进行解析,得到逻辑执行计划;
创建模块,用于在所述逻辑执行计划中加入所述查询节点。
在一种可能的设计中,所述生成模块具体用于:
对修改后的所述逻辑执行计划进行更新,得到更新后的逻辑执行计划;
对所述更新后的逻辑执行计划进行优化,得到优化后的逻辑执行计划;
将所述优化后的逻辑执行计划转换为物理执行计划。
在一种可能的设计中,所述第二待连接子表Spark执行物理执行计划时进行归并端链接Reduce Join。
在一种可能的设计中,所述Map Join为广播表链接BroadcastHashJoin,所述Reduce Join为排序合并链接SortMergeJoin。
第三方面,本发明实施例提供一种数据倾斜处理设备,包括:至少一个处理器和存储器;
所述存储器存储计算机执行指令;
所述至少一个处理器执行所述存储器存储的计算机执行指令,使得所述至少一个处理器执行如上第一方面以及第一方面各种可能的设计所述的方法。
第四方面,本发明实施例提供一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机执行指令,当处理器执行所述计算机执行指令时,实现如上第一方面以及第一方面各种可能的设计所述的方法。
第五方面,本发明实施例提供一种计算机程序产品,包括计算机程序,所述计算机程序被处理器执行时,实现如上第一方面以及第一方面各种可能的设计所述的方法。
第六方面,本发明实施例提供了一种运行指令的芯片,所述芯片包括存储器、处理器,所述存储器中存储代码和数据,所述存储器与所述处理器耦合,所述处理器运行所述存储器中的代码使得所述芯片用于执行上述第一方面以及第一方面各种可能的设计所述的方法。
第七方面,本发明实施例提供了一种计算机程序,当所述计算机程序被处理器执行时,用于执行上述第一方面以及第一方面各种可能的设计所述的方法。
本实施例提供的数据倾斜处理方法、设备、存储介质及程序产品,该方法通过逻辑执行计划中的查询节点对待连接数据表进行查询,获得数据倾斜的键Key,根据所述数据倾斜的Key与数据倾斜策略对所述逻辑执行计划进行修改,以使从所述待连接数据表中拆分得到的所述数据倾斜的Key对应的第一待连接子表在分布式计算引擎Spark执行物理执行计划时进行映射端链接Map Join,根据修改后的所述逻辑执行计划,生成所述物理执行计划,以通过Spark执行所述物理执行计划。本实施例提供的数据倾斜处理方法通过对逻辑执行计划进行修改,使得对倾斜Key的处理从Reduce Join优化成Map Join,从根源上规避了数据倾斜带来的诸多问题,减少了场景限制,避免了对统计信息的依赖,提高了数据倾斜处理的全面性和准确性。
附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1为本发明一实施例提供的两个数据表进行链接操作的流程示意图;
图2为现有技术提供的通过散裂化倾斜Key进行链接操作的流程示意图;
图3为本发明一实施例提供的数据倾斜处理方法的流程示意图;
图4为本发明又一实施例提供的数据倾斜处理方法的流程示意图;
图5为本发明又一实施例提供的两个数据表进行链接操作的流程示意图;
图6为现有技术提供的两个数据表进行链接操作的有向无环图;
图7为本发明又一实施例提供的两个数据表进行链接操作的有向无环图;
图8为本发明又一实施例提供的两个数据表进行链接操作的有向无环 图;
图9为本发明再一实施例提供的数据倾斜处理方法的流程示意图;
图10为本发明一实施例提供的数据倾斜处理设备的结构示意图;
图11为本发明一实施例提供的数据倾斜处理设备的硬件结构示意图。
具体实施方式
为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
对于分布式集群系统,其不同节点负责一定范围的数据存储或数据计算。通常量数据分散度不够,导致大量的数据集中到了一台或者几台服务节点上,称为数据倾斜。
分布式计算引擎Spark进行洗牌Shuffle的时候,需要将各个节点上相同的Key拉取到某个节点上的一个task来进行处理,比如按照Key进行聚合或链接Join等操作。此时如果某个Key对应的数据量特别大的话,就会发生数据倾斜。比如大部分Key对应10条数据,但是个别Key却对应了100万条数据,那么大部分task可能就只会分配到10条数据,然后几秒钟就运行完了;但是个别task可能分配到了100万数据,要运行一两个小时。因此,整个Spark作业的运行进度是由运行时间最长的task决定的。
图1为本发明一实施例提供的两个数据表进行链接操作的流程示意图;如图1所示,表1-1为学生的数学竞赛成绩,第一列数据包括学生证号ID,第二列数据为不同ID分别对应的数学竞赛成绩,表1-2为学生的英语竞赛成绩,第一列数据包括学生证号ID,第二列数据为不同ID分别对应的英语竞赛成绩,从两个表中可以发现,在表1-1中ID为001的学生的成绩条数较多,在两个表进行Join时,每个ID相当于一个Key,显然Key001对应的数据量较大,在对Key001对应的task进行处理时,相对于其他Key需要耗费更多的时间。因此,可以说Key001发生了数据倾斜。当然,此处仅是为了更加形象理解数据倾斜做的示例说明,实际应用中倾斜Key对应的数据量判定条件可以根据需要进行设定。
针对上述数据倾斜的问题,现有技术中,通常采用两种方式进行处理。
一种方式是从应用层进行处理:通过Rand等技术将倾斜的Key进行打散,即将倾斜的Key后面加上随机后缀,将原本倾斜的数据进行散裂化。如图2所示,表1-1和表2-1中的Key001通过Rand技术进行散裂化,可以得到表1-2和表2-1中的Key,001-1,001-2和001-3。散裂化后的表1-2和表2-2依据散裂化后的Key。然而,通过该种方式,一方面会破坏原本的业务逻辑,往往把简单问题复杂化,另一方面,一旦发生拉取失败Fetch Failure进行数据重算时,以图2中的Key001为例,需要重新进行散裂化,上一次散裂得到的001-1,可能在下一次散裂中变成001-5,使得同一条数据被分配到不同的数据分区,最终导致数据重复。
另一种方式是从引擎内核层进行处理:Spark内核引入自适应查询执行技术(Adaptive Query Execution,AQE),AQE针对上述数据倾斜问题使用运行时的统计信息自动优化查询执行,动态的发现倾斜数据的数量,并且把倾斜的分区分成更小的子分区来处理。然而,通过该种方式处理,一方面AQE技术强依赖运行时的统计信息,如果统计信息存在不准确情况会导致数据倾斜误判或遗漏,另一方面,AQE技术仅支持同一个阶段Stage里面只有一个Join的场景,对于多表Join的场景并不支持,并且对于Join后有Shuffle的场景也不会触发AQE数据倾斜的优化逻辑,再一方面,基于AQE处理数据倾斜,本身定位是分区Partition粒度的倾斜治理,如果倾斜数据是同一个Mapper产生的,则无法解决。
由此可见,无论是从应用层进行的优化,还是基于Spark内核引入AQE技术进行的优化,都有其缺陷。针对上述技术问题,发明人研究发现,AQE技术属于对物理执行计划Physical Plan进行的优化,在Spark SQL整个执行计划中,主要包括:逻辑执行计划Logical Plan和物理执行计划Physical Plan,后者是由前者转化得到的,也即如果从逻辑执行计划入手,对数据倾斜进行优化处理,那么可以从根源上解决数据倾斜的问题,避免了从应用层或物理执行计划层面的缺陷。基于此,本发明实施例提供了一种数据倾斜处理方法,通过对逻辑执行计划进行修改,来有效划分数据分片,将倾斜key从Reduce Join优化成Map Join以提升数据处理能力,从根源上规避了数据倾斜带来的诸多问题,减少了场景限制,避免了对统计信息的依赖,提高了数据倾斜处理的全面性和准确性。
下面以具体地实施例对本发明的技术方案进行详细说明。下面这几个具体的实施例可以相互结合,对于相同或相似的概念或过程可能在某些实施例不再赘述。
图3为本发明一实施例提供的数据倾斜处理方法的流程示意图。如图3所示,该方法包括:
301、通过逻辑执行计划中的查询节点对待连接数据表进行查询,获得数据倾斜的键Key。
本实施例中,待连接数据表可以至少包括两个数据表,例如,可以包括第一数据表和第二数据表,通过逻辑执行计划中的查询节点可以分别对第一数据表和第二数据表分别进行查询,还可以包括第一数据表、第二数据表和第三数据表等三个以上的数据表,在查询过程中可以依次对第一数据表、第二数据表、第三数据表等进行查询。本实施例对待连接数据表的数量以及查询顺序不做限定。
可选地,在一些实施例中,所述通过逻辑执行计划中的查询节点对待连接数据表进行查询,获得数据倾斜的Key,包括:针对所述待连接数据表的每个Key,将所述Key对应的数据量与第一预设阈值进行对比;若所述Key对应的数据量大于所述第一预设阈值,则将所述Key确定为数据倾斜的Key。
具体的,在通过逻辑执行计划中的查询节点对待连接数据表中的各个数据表进行查询过程中,可以针对每个Key进行查询,如图1所示,假设表1-1和表1-2为待连接数据表,在一种可实现方式中,可以首先对表1-1中的Key001进行查询,再依次查询Key002和Key003等其余Key,再对表2-1中的Key001进行查询,再依次查询Key002和Key003等其余Key。在另一种可实现方式中,可以首先将不同Key对应的条数进行排序,形成新的序列,按照序列中的顺序,从对应条数多到对应条数少,依次对相应的Key进行查询。此种方式有利于尽快找到倾斜的Key,且如果条数少到一定程度,不足以成为倾斜Key的时候,可以及时中止查询,节省运算量。对于具体采用何种查询方式,可根据实际需要确定,本实施例对此不进行限定。
在对每个Key进行查询过程中,可以将该Key对应的数据量与第一预设阈值进行比较。该Key对应的数据量大于第一预设阈值时,将该Key确 定为倾斜的Key。此处的数据量可以为数据的容量的大小,例如多少兆、多少G,还可以为条数。第一预设阈值可以是根据经验确定的一个固定值。
302、根据所述数据倾斜的Key与数据倾斜策略对所述逻辑执行计划进行修改,以使从所述待连接数据表中拆分得到的所述数据倾斜的Key对应的第一待连接子表在分布式计算引擎Spark执行物理执行计划时进行映射端链接Map Join。
本实施例中,通过基于数据倾斜Key和数据倾斜策略对逻辑执行计划进行修改,使得从待连接数据表中拆分得到的数据倾斜Key对应的第一待连接字表在后续的物理执行计划被Spark计算引擎执行时能够进行映射端连接。
映射端链接Map Join和归并端链接Reduce Join均是为了将待连接数据表进行Join操作。也即,不同数据源数据的合并操作。其中,Reduce Join是在Map阶段完成数据的标记,在Reduce阶段完成数据的合并。Map Join是直接在Map阶段完成数据的合并,没有Reduce阶段。
具体的,如图1所示的表1-1和表2-1,以此为例,对Reduce Join过程示例说明,在Reduce Join的Map阶段,会将输入数据统一封装为一个Bean,此Bean包含了表1-1和表2-1的所有公共和非公共属性,相当于进行了全外连接,并新增加一个属性,文件名称,以区分数据是来自于表1-1还是表2-1,便于在Reduce阶段数据的处理;Map输出的Key是学生证号ID,Value是Bean。在Shuffle阶段,根据ID对Bean进行排序,所有ID相同的数据都会被聚合到同一个key下,发往同一个Reduce task;在Reduce过程中,对同一个ID下所有的Bean,首先要区分出来源,是表1-1还是表2-1。而如果对表1-1和表2-1进行Map Join的话,没有Reduce过程,所有的工作都在Map阶段完成,极大减少了网络传输和输入输出的代价。具体实现过程中:可以将表1-1或表2-1,例如将表2-1预先缓存于各个Map task节点,然后等到表1-1的数据传输过来时,直接用表1-1的数据连接已经预存的表2-1的数据并输出即可。
本实施例中,以图1中的表1-1和表2-1为例,数据倾斜的Key为001的话,那么该第一待连接子表,包括来自于表1-1的001对应的第一子数据表,来自于表2-1的001对应的第二子数据表。所述从所述待连接数据表中拆分得到的所述数据倾斜的Key对应的第一待连接子表在分布式计算 引擎Spark执行物理执行计划时进行映射端链接Map Join,可以是在Sark执行物理执行计划时,将第一子数据表和第二子数据表进行Map Join,具体的,可以将第一子数据表或第二子数据表,例如将第二子数据表预先缓存于各个Map task节点,然后等到第一子数据表的数据传输过来时,直接用第一子数据表的数据连接已经预存的第二子数据表的数据并输出即可。
303、根据修改后的所述逻辑执行计划,生成所述物理执行计划,以通过Spark执行所述物理执行计划。
本实施例中,Spark对代码中API的执行主要包括以下步骤:首先编写DataFrame/Dataset/SQL代码;其次,如果编写的代码没有错误,Spark会将这些代码转换成逻辑执行计划;再次,Spark会将生成的逻辑执行计划进行一系列优化后,将优化后的逻辑执行计划转换为物理执行计划;最后,Spark执行该物理执行计划,也即在集群上对弹性分布式数据集(Resilient Distributed Datasets,RDD)进行一系列操作。
本实施例中,在对逻辑执行计划根据数据倾斜的Key和数据倾斜策略修改完成后,可以基于该修改后的逻辑执行计划生成物理执行计划。当然,待修改的逻辑执行计划可以是优化后的逻辑执行计划,或者是优化前的逻辑执行计划,本实施例对此不进行限定。
本实施例提供的数据倾斜处理方法,通过逻辑执行计划中的查询节点对待连接数据表进行查询,获得数据倾斜的键Key,根据所述数据倾斜的Key与数据倾斜策略对所述逻辑执行计划进行修改,以使从所述待连接数据表中拆分得到的所述数据倾斜的Key对应的第一待连接子表在分布式计算引擎Spark执行物理执行计划时进行映射端链接Map Join,根据修改后的所述逻辑执行计划,生成所述物理执行计划,以通过Spark执行所述物理执行计划。本实施例提供的数据倾斜处理方法通过对逻辑执行计划进行修改,使得对倾斜Key的处理从Reduce Join优化成Map Join,从根源上规避了数据倾斜带来的诸多问题,减少了场景限制,避免了对统计信息的依赖,提高了数据倾斜处理的全面性和准确性。
图4为本发明又一实施例提供的数据倾斜处理方法的流程示意图。如图4所示,在上述实施例的基础上,例如在图3所示实施例的基础上,本实施例中对如何对逻辑修改计划进行修改进行了详细说明,该方法包括:
401、通过逻辑执行计划中的查询节点对待连接数据表进行查询,获得 数据倾斜的键Key。
本实施例中,步骤401与上述实施例中步骤301相类似,此处不再赘述。
402、在所述逻辑执行计划中增加根据所述数据倾斜的Key,将所述待连接数据表的数据进行拆分,得到所述第一待连接子表和数据非倾斜的Key对应的第二待连接子表的处理步骤,以使从所述待连接数据表中拆分得到的所述数据倾斜的Key对应的第一待连接子表在分布式计算引擎Spark执行物理执行计划时进行映射端链接Map Join。
403、在所述逻辑执行计划中增加将连接后的所述第一待连接子表和连接后的所述第二待连接子表进行合并,得到最终的数据表的处理步骤,得到修改后的所述逻辑执行计划。
在一些实施例中,所述待连接数据表包括第一数据表和第二数据表,所述数据倾斜的Key来自于所述第一数据表和/或所述第二数据表。也就是说,待连接数据表中的任何一个数据表都有可能被判定存在数据倾斜的Key。如图1所示,两个数据表中只有一个数据表存在数据倾斜的Key,即表1-1中的Key001。而如图5所示,两个数据表中均存在数据倾斜的Key,即表1-1中数据倾斜的Key是001,表4-1中数据倾斜的Key是003。本实施例中对数据倾斜的Key的来源以及数量不做限定。
为了更加形象的对本实施例中的对逻辑执行计划的修改操作,以下结合图5对待连接数据表表1-1和表4-1的连接过程进行示例说明。
如图5所示,表1-1中的数据倾斜的Key是001,表4-1中的数据倾斜的Key是003。因此,在对表1-1进行拆分后,得到包括数据倾斜Key001和003对应数据的表1-1-1,和包括数据非倾斜Key002的表1-1-2;在对表4-1进行拆分后,得到包括数据倾斜Key001和003对应数据的表4-1-1,和包括数据非倾斜Key002的表4-1-2,也就是说,在对待连接数据表表1-1和表4-1根据数据倾斜的Key进行拆分后,得到表1-1-1和表4-1-1组成的第一待连接子表,以及由表1-1-2和表4-1-2组成的第二待连接子表。图5中的表1-1和表4-1仅为示例说明,为了讲述数据表连接过程仅展示了001至003,3个Key。在实际的数据表中,Key的数据量可以达到万数计或千万级别,也就是说,数据非倾斜的Key会很多,数据倾斜Key的占比会非常小,在此情况下,第一待连接子表中的表1-1-1和表4-1-1均作为小表在 Spark执行物理执行计划时可以被执行Map Join,而第二待连接子表中的表1-1-2和表4-1-2均作为大表在Spark执行物理执行计划时可以被执行Reduce Join。Map Join和Reduce Join的实现过程可以参照步骤302的描述,此处不再赘述。
第一待连接子表表1-1-1和表4-1-1进行Map Join后,得到表5-1,第二待连接子表表1-1-2和表4-1-2进行Reduce Join后,得到表5-2,表5-1和表5-2进行合并后,得到最终的数据表表5。在一些实施例中,所述将连接后的所述第一待连接子表和连接后的所述第二待连接子表进行合并,包括:通过Union算子,将连接后的所述第一待连接子表和连接后的所述第二待连接子表进行合并,得到最终的数据表。
在一些实施例中,所述第二待连接子表Spark执行物理执行计划时进行归并端链接Reduce Join。可选地,所述Map Join为广播表链接BroadcastHashJoin,所述Reduce Join为排序合并链接SortMergeJoin。
实际应用中,第一待连接子表的Map Join的方式有多种,以下结合图7至图8对本实施例中对逻辑执行计划进行修改后,第一待连接子表在Spark执行物理执行计划时进行Map Join的方式进行示例说明,并且结合图6,对采用本实施例提供的数据倾斜处理方法前后的优势对比进行说明。
为了保证数据倾斜的Key对应的第一待连接子表均能实现Map Join,在一些实施例中,所述数据倾斜的Key为多个,所述第一待连接子表为多个,所述数据倾斜的Key与所述第一待连接子表一一对应;所述从所述待连接数据表中拆分得到的所述数据倾斜的Key对应的第一待连接子表在Spark执行物理执行计划时进行Map Join,包括:针对每个数据倾斜的Key,所述数据倾斜的Key对应的第一待连接子表在Spark执行物理执行计划时进行Map Join。如图8所示,以图5中待连接数据表表1-1-1和表4-1-1包括两个数据倾斜Key为例,每个数据倾斜的Key对应一个第一待连接子表,即在对表1-1进行拆分时,可以拆分得到两个第一待连接子表,第一个第一待连接子表仅包括Key001的数据,而另一个待连接子表仅包括Key002的数据。在后续的Map Join过程中,如图8所示,Stage1和Stage2针对一个第一待连接子表,Stage3和Stage4针对另一个第一待连接子表,具体的,均通过BroadcastHashJoin实现数据倾斜的Key的Map Join。而在图8所示的有向无环图中Stage5和Stage6则是针对第二待连接子表,在经过Stage5 和Stage6的处理后,通过SortMergeJoin实现数据非倾斜的Key的Reduce Join。在Stage7中,将执行了BroadcastHashJoin的两个第一待连接子表和一个执行了SortMergeJoin的第二待连接子表进行合并Union,得到最终的数据表。
为了能够减少合并操作的计算量,且减少用于处理第一待连接子表的计算节点的数量,在一些实施例中,所述数据倾斜的Key为多个,所述第一待连接子表为至少一个;所述根据所述数据倾斜的Key与数据倾斜策略对所述逻辑执行计划进行修改,还包括:将所述数据倾斜的Key进行分组,得到多个分组;每个分组的总数据量小于第二预设阈值;每个分组对应一个所述第一待连接子表;所述从所述待连接数据表中拆分得到的所述数据倾斜的Key对应的第一待连接子表在Spark执行物理执行计划时进行Map Join,包括:针对每个分组,所述分组对应的第一待连接子表在Spark执行物理执行计划时进行Map Join。以图5中待连接数据表表1-1-1和表4-1-1包括两个数据倾斜Key为例,可以将数据倾斜的Key001和003基于第二预设阈值进行分组,例如,假设001和003对应的数据量的总和小于第二预设阈值,则可以将001和003如图5中所示分到一个分组,而且待连接数据表有且仅有这一个分组。如图7所示,针对该一个分组,可以得到一个第一待连接子表,针对该一个待连接子表,可以通过执行Stage1和Stage2的处理后,进行BroadcastHashJoin来实现第一待连接子表的Map Join。而在图7所示的有向无环图中Stage3和Stage4则是针对第二待连接子表,在经过Stage3和Stage4的处理后,通过SortMergeJoin实现数据非倾斜的Key的Reduce Join。在Stage5中,将执行了BroadcastHashJoin的第一待连接子表和执行了SortMergeJoin的第二待连接子表进行合并Union,得到最终的数据表。本实施例中,第二预设阈值的设定可以根据经验进行设定,本实施例对此不做限定。
可以理解,如果待连接数据表中的数据倾斜的Key有多个,例如100个,则可以通过多种方式,将这100个数据倾斜的Key基于第二预设阈值进行分组。在一种可实现方式中,可以将数据倾斜的Key按照Key的编号数值进行排序,然后针对排序中的第一个Key的数据量基于第二预设阈值进行判断,若小于第二预设阈值,则将第一个和第二个Key的数据总量基于第二预设阈值进行判断,若仍小于第二预设阈值,则将第一个、第二个 和第三个Key的数据总量基于第二预设阈值进行判断,直至超过第二预设阈值,则将第N-1个之前的Key划入一个分组内,从第N个开始继续进行上述步骤的判断。直至遍历排序中的所有Key。在另一种可实现方式中,可以将数据倾斜的Key按照每个Key对应的数据量进行排序。然后再基于第二预设阈值对排序中的Key进行分组。本实施例中对此不进行限定,可根据实际需要进行选择。
图6为现有技术中提供的两个数据表进行链接操作的有向无环图。图7为本发明又一实施例提供的两个数据表进行链接操作的有向无环图。图8为本发明又一实施例提供的两个数据表进行链接操作的有向无环图。如图6所示,阶段1Stage1和阶段2Stage2均依次包括以下步骤:范围Range、投影Project、交换Exchange、自定义读取CustomShuffleReader和排序Sort;阶段3Stage3包括排序合并链接SortMergeJoin。如图7所示,阶段1Stage1包括以下步骤:范围Range、过滤Filter、投影Project、交换Exchange、自定义读取CustomShuffleReader和广播交换BroadcastExchage;阶段2Stage2包括以下步骤:范围Range、过滤Filter、投影Project、交换Exchange、自定义读取CustomShuffleReader;阶段3Stage3和阶段4Stage4均包括范围Range、过滤Filter、投影Project、交换Exchange、自定义读取CustomShuffleReader和排序Sort;阶段5包括以下步骤:广播表链接BroadcastHashJoin、排序合并链接SortMergeJoin、合并Union和自适应Spark执行计划AdaptiveSparkPlan。
下面还是以图5所示的表1-1和表4-1为例对图6至图8进行示例说明,如图6所示,两个数据表进行链接,通常是对表1-1通过Stage1的处理,对表4-1通过Stage2的处理后,在Stage3进行SortMergeJoin实现Reduce Join。如图7所示,对表1-1-2进行Stage3的处理,对表4-1-1进行Stage4的处理后,进行Stage5中SortMergeJoin实现ReduceJoin,得到表5-2,对表1-1-1和表4-1-2中其中一个表进行Stage1的处理,对另一个表进行Stage2的处理后,进行Stage5中的BroadcastHashJoin实现MapReduce,得到表5-1,最后将表5-1和表5-2进行Union后,进行自适应Spark执行计划的执行。图8相对于图7来说是将数据倾斜的数据拆分为了多组子表,也即在数据倾斜Key数量太多的情况下将表1-1-1再进行细化拆分后得到多个下一级子表,相对应对表4-1-2也拆分得到多个下一级子表,然后针 对每组下一级子表(包括表1-1-1的一个下一级子表,以及该下一级子表对应的表4-1-2的下一级子表),进行Stage1和Stage2的处理后进行BroadcastHashJoin实现多个MapJoin。最终通过Stage7的处理将多个BroadcastHashJoin得到的表和SortMergeJoin得到的表进行合并后,进行自适应Spark执行计划的执行。
采用本发明实施例之前,即优化前如图6所示处理方式中,Spark任务运行时间是5.5分钟,采用本发明实施例之后,即优化后如图7或图8所示处理方式中,Spark任务运行时间是2.1分钟,整体性能提升60%。
404、根据修改后的所述逻辑执行计划,生成所述物理执行计划,以通过Spark执行所述物理执行计划。
本实施例中步骤404与上述实施例中步骤303相类似,此处不再赘述。
本发明实施例提供的数据倾斜处理方法,通过对逻辑执行计划进行修改,对数据倾斜的Key和非数据倾斜的Key进行拆分,使得Spark在执行物理执行计划时,能够使数据倾斜的Key对应的第一待连接子表进行Map Join,大大减少了运行时间。避免了数据倾斜的Key运行时间过长影响整个Spark任务的运行效率。并且该方式没有场景限制,从根源上解决了数据倾斜的问题。
图9为本发明再一实施例提供的数据倾斜处理方法的流程示意图。如图9所示,在上述实施例的基础上,例如在图3所示实施例的基础上,本实施例中对逻辑执行计划的生成过程,以及由修改后的逻辑执行计划生成物理执行计划的过程进行了详细说明。该方法包括:
901、将结构化查询语言SQL文本解析成语法树,生成未解析逻辑执行计划。
902、对所述未解析逻辑执行计划进行解析,得到逻辑执行计划。
903、在所述逻辑执行计划中加入所述查询节点。
本实施例中,逻辑执行计划主要是一系列抽象的转换过程。并不涉及执行器或驱动器,他只是将用户的表达式集合转换为最优的版本。具体的,用户的代码首先会被转换成未解析逻辑执行计划(Unresolved Logical Plan),未解析逻辑计划之所以被称为未解析的,是因为未解析逻辑执行计划并一定是正确的,未解析逻辑执行计划所引用到的表名或者列名可能存在,也可能不存在。Spark之后会使用目录Catalog,一个含有所有数据表table 和数据框架DataFrame的元数据仓库,在解析器(Analyser)中来解析校对所引用的表名或者列名。假如未解析逻辑执行计划通过了验证,则可以得到逻辑执行计划(Resolved Logical Plan)。在逻辑执行计划中增加查询节点(Query Node),以通过该查询节点来对待连接数据表进行查询。
904、通过逻辑执行计划中的查询节点对待连接数据表进行查询,获得数据倾斜的键Key。
905、根据所述数据倾斜的Key与数据倾斜策略对所述逻辑执行计划进行修改,以使从所述待连接数据表中拆分得到的所述数据倾斜的Key对应的第一待连接子表在分布式计算引擎Spark执行物理执行计划时进行映射端链接Map Join。
本实施例中步骤904和步骤905与上述实施例中步骤301和步骤302相类似,此处不再赘述。
906、对修改后的所述逻辑执行计划进行更新,得到更新后的逻辑执行计划。
907、对所述更新后的逻辑执行计划进行优化,得到优化后的逻辑执行计划。
908、将所述优化后的逻辑执行计划转换为物理执行计划。
具体的,逻辑执行计划修改后,需要进行更新,以便后续步骤应用该更新后的逻辑执行计划。将修改后的逻辑执行计划传递到优化器Catalyst Optimizer进行优化,然后被经过一些列优化生成优化后的逻辑执行计划。Spark将此逻辑执行计划转化为一个物理执行计划,检查可行的优化策略,并在此过程中检查优化。物理执行计划通过生成不同的物理执行操作,并通过代价模型进行比较分析,从而确定如何在集群上执行逻辑计划。Spark在选择一个物理计划时,Spark将所有代码运行在Spark的底层编程接口RDD上。Spark在运行时执行进一步优化,生成可以在执行期间优化任务或阶段的本地Java字节码,最终将结果返回给用户。
本发明实施例提供的数据倾斜处理方法,通过在逻辑执行计划优化前加入查询节点,并将查询到的数据倾斜的Key,与数据非倾斜的Key进行拆分,使得Spark在执行物理执行计划时,能够将拆分得到的数据倾斜的Key对应第一待连接子表进行Map Join,从而能够大大节省运行时间。从根源上规避了数据倾斜带来的诸多问题,减少了场景限制,避免了对统计 信息的依赖,提高了数据倾斜处理的全面性和准确性。
图10为本发明一实施例提供的数据倾斜处理设备的结构示意图。如图10所示,该数据倾斜处理设备100包括:查询模块1001、修改模块1002以及生成模块1003。
查询模块1001,用于通过逻辑执行计划中的查询节点对待连接数据表进行查询,获得数据倾斜的键Key。
修改模块1002,用于根据所述数据倾斜的Key与数据倾斜策略对所述逻辑执行计划进行修改,以使从所述待连接数据表中拆分得到的所述数据倾斜的Key对应的第一待连接子表在分布式计算引擎Spark执行物理执行计划时进行映射端链接Map Join。
生成模块1003,用于根据修改后的所述逻辑执行计划,生成所述物理执行计划,以通过Spark执行所述物理执行计划。
本发明实施例提供的数据倾斜处理设备,
在一种可能的设计中,所述查询模块具体用于:
针对所述待连接数据表的每个Key,将所述Key对应的数据量与第一预设阈值进行对比;
若所述Key对应的数据量大于所述第一预设阈值,则将所述Key确定为数据倾斜的Key。
在一种可能的设计中,所述修改模块具体用于:
在所述逻辑执行计划中增加以下处理步骤:
根据所述数据倾斜的Key,将所述待连接数据表的数据进行拆分,得到所述第一待连接子表和数据非倾斜的Key对应的第二待连接子表;
将连接后的所述第一待连接子表和连接后的所述第二待连接子表进行合并,得到最终的数据表。
在一种可能的设计中,所述修改模块具体用于:
通过Union算子,将连接后的所述第一待连接子表和连接后的所述第二待连接子表进行合并,得到最终的数据表。
在一种可能的设计中,所述待连接数据表包括第一数据表和第二数据表,所述数据倾斜的Key来自于所述第一数据表和/或所述第二数据表。
在一种可能的设计中,所述数据倾斜的Key为多个,所述第一待连接子表为多个,所述数据倾斜的Key与所述第一待连接子表一一对应;
所述修改模块具体用于:针对每个数据倾斜的Key,所述数据倾斜的Key对应的第一待连接子表在Spark执行物理执行计划时进行Map Join。
在一种可能的设计中,所述数据倾斜的Key为多个,所述第一待连接子表为至少一个;所述修改模块还用于:
所述数据倾斜的Key为多个,所述第一待连接子表为至少一个;
针对每个分组,所述分组对应的第一待连接子表在Spark执行物理执行计划时进行Map Join。
在一种可能的设计中,所述设备,还包括:
语法分析模块,用于将结构化查询语言SQL文本解析成语法树,生成未解析逻辑执行计划。
解析模块,用于对所述未解析逻辑执行计划进行解析,得到逻辑执行计划。
创建模块,用于在所述逻辑执行计划中加入所述查询节点。
在一种可能的设计中,所述生成模块具体用于:
对修改后的所述逻辑执行计划进行更新,得到更新后的逻辑执行计划;
对所述更新后的逻辑执行计划进行优化,得到优化后的逻辑执行计划;
将所述优化后的逻辑执行计划转换为物理执行计划。
在一种可能的设计中,所述第二待连接子表Spark执行物理执行计划时进行归并端链接Reduce Join。
在一种可能的设计中,所述Map Join为广播表链接BroadcastHashJoin,所述Reduce Join为排序合并链接SortMergeJoin。
本发明实施例提供的数据倾斜处理设备,可用于执行上述的方法实施例,其实现原理和技术效果类似,本实施例此处不再赘述。
图11为本发明一实施例提供的数据倾斜处理设备的硬件结构示意图,该设备可以是计算机,数字广播终端,消息收发设备,游戏控制台,平板设备,医疗设备,健身设备,个人数字助理等。
设备110可以包括以下一个或多个组件:处理组件1101,存储器1102,电源组件1103,输入/输出(I/O)接口1104,以及通信组件1106。
处理组件1101通常控制设备110的整体操作,诸如与显示,电话呼叫,数据通信,相机操作和记录操作相关联的操作。处理组件1101可以包括一个或多个处理器1105来执行指令,以完成上述的方法的全部或部分步骤。此外, 处理组件1101可以包括一个或多个模块,便于处理组件1101和其他组件之间的交互。例如,处理组件1101可以包括多媒体模块,以方便多媒体组件808和处理组件1101之间的交互。
存储器1102被配置为存储各种类型的数据以支持在设备110的操作。这些数据的示例包括用于在设备110上操作的任何应用程序或方法的指令,联系人数据,电话簿数据,消息,图片,视频等。存储器1102可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(SRAM),电可擦除可编程只读存储器(EEPROM),可擦除可编程只读存储器(EPROM),可编程只读存储器(PROM),只读存储器(ROM),磁存储器,快闪存储器,磁盘或光盘。
电源组件1103为设备110的各种组件提供电力。电源组件1103可以包括电源管理系统,一个或多个电源,及其他与为设备110生成、管理和分配电力相关联的组件。
I/O接口1104为处理组件1101和外围接口模块之间提供接口,上述外围接口模块可以是键盘,点击轮,按钮等。这些按钮可包括但不限于:主页按钮、音量按钮、启动按钮和锁定按钮。
通信组件1106被配置为便于设备110和其他设备之间有线或无线方式的通信。设备110可以接入基于通信标准的无线网络,如WiFi,2G或3G,或它们的组合。在一个示例性实施例中,通信组件1106经由广播信道接收来自外部广播管理系统的广播信号或广播相关信息。在一个示例性实施例中,所述通信组件1106还包括近场通信(NFC)模块,以促进短程通信。例如,在NFC模块可基于射频识别(RFID)技术,红外数据协会(IrDA)技术,超宽带(UWB)技术,蓝牙(BT)技术和其他技术来实现。
在示例性实施例中,设备110可以被一个或多个应用专用集成电路(ASIC)、数字信号处理器(DSP)、数字信号处理设备(DSPD)、可编程逻辑器件(PLD)、现场可编程门阵列(FPGA)、控制器、微控制器、微处理器或其他电子元件实现,用于执行上述方法。
本申请还提供一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机执行指令,当处理器执行所述计算机执行指令时,实现如上数据倾斜处理设备执行的数据倾斜处理方法。
上述的计算机可读存储介质,上述可读存储介质可以是由任何类型的易 失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(SRAM),电可擦除可编程只读存储器(EEPROM),可擦除可编程只读存储器(EPROM),可编程只读存储器(PROM),只读存储器(ROM),磁存储器,快闪存储器,磁盘或光盘。可读存储介质可以是通用或专用计算机能够存取的任何可用介质。
一种示例性的可读存储介质耦合至处理器,从而使处理器能够从该可读存储介质读取信息,且可向该可读存储介质写入信息。当然,可读存储介质也可以是处理器的组成部分。处理器和可读存储介质可以位于专用集成电路(Application Specific Integrated Circuits,简称:ASIC)中。当然,处理器和可读存储介质也可以作为分立组件存在于设备中。
本领域普通技术人员可以理解:实现上述各方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成。前述的程序可以存储于一计算机可读取存储介质中。该程序在执行时,执行包括上述各方法实施例的步骤;而前述的存储介质包括:ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。
本发明实施例还提供一种计算机程序产品,包括计算机程序,所述计算机程序被处理器执行时,实现如上数据倾斜处理设备执行的数据倾斜处理方法。
本发明实施例还提供一种运行指令的芯片,所述芯片包括存储器、处理器,所述存储器中存储代码和数据,所述存储器与所述处理器耦合,所述处理器运行所述存储器中的代码使得所述芯片用于执行上述数据倾斜处理设备执行的数据倾斜处理方法。
本发明实施例还提供了一种计算机程序,当所述计算机程序被处理器执行时,用于执行上述数据倾斜处理设备执行的数据倾斜处理方法。
最后应说明的是:以上各实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述各实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。

Claims (27)

  1. 一种数据倾斜处理方法,其特征在于,包括:
    通过逻辑执行计划中的查询节点对待连接数据表进行查询,获得数据倾斜的键Key;
    根据所述数据倾斜的Key与数据倾斜策略对所述逻辑执行计划进行修改,以使从所述待连接数据表中拆分得到的所述数据倾斜的Key对应的第一待连接子表在分布式计算引擎Spark执行物理执行计划时进行映射端链接Map Join;
    根据修改后的所述逻辑执行计划,生成所述物理执行计划,以通过Spark执行所述物理执行计划。
  2. 根据权利要求1所述的方法,其特征在于,所述通过逻辑执行计划中的查询节点对待连接数据表进行查询,获得数据倾斜的Key,包括:
    针对所述待连接数据表的每个Key,将所述Key对应的数据量与第一预设阈值进行对比;
    若所述Key对应的数据量大于所述第一预设阈值,则将所述Key确定为数据倾斜的Key。
  3. 根据权利要求1或2所述的方法,其特征在于,所述根据所述数据倾斜的Key与数据倾斜策略对所述逻辑执行计划进行修改,包括:
    在所述逻辑执行计划中增加以下处理步骤:
    根据所述数据倾斜的Key,将所述待连接数据表的数据进行拆分,得到所述第一待连接子表和数据非倾斜的Key对应的第二待连接子表;
    将连接后的所述第一待连接子表和连接后的所述第二待连接子表进行合并,得到最终的数据表。
  4. 根据权利要求3所述的方法,其特征在于,所述将连接后的所述第一待连接子表和连接后的所述第二待连接子表进行合并,包括:
    通过Union算子,将连接后的所述第一待连接子表和连接后的所述第二待连接子表进行合并,得到最终的数据表。
  5. 根据权利要求3所述的方法,其特征在于,所述待连接数据表包括第一数据表和第二数据表,所述数据倾斜的Key来自于所述第一数据表和/或所述第二数据表。
  6. 根据权利要求5所述的方法,其特征在于,所述数据倾斜的Key为多个,所述第一待连接子表为多个,所述数据倾斜的Key与所述第一待连接子表一一对应;
    所述从所述待连接数据表中拆分得到的所述数据倾斜的Key对应的第一待连接子表在Spark执行物理执行计划时进行Map Join,包括:
    针对每个数据倾斜的Key,所述数据倾斜的Key对应的第一待连接子表在Spark执行物理执行计划时进行Map Join。
  7. 根据权利要求5所述的方法,其特征在于,所述数据倾斜的Key为多个,所述第一待连接子表为至少一个;
    所述根据所述数据倾斜的Key与数据倾斜策略对所述逻辑执行计划进行修改,还包括:
    将所述数据倾斜的Key进行分组,得到多个分组;每个分组的总数据量小于第二预设阈值;
    每个分组对应一个所述第一待连接子表;
    所述从所述待连接数据表中拆分得到的所述数据倾斜的Key对应的第一待连接子表在Spark执行物理执行计划时进行Map Join,包括:
    针对每个分组,所述分组对应的第一待连接子表在Spark执行物理执行计划时进行Map Join。
  8. 根据权利要求1至7任一项所述的方法,其特征在于,所述通过逻辑执行计划中的查询节点对待连接数据表进行查询之前,还包括:
    将结构化查询语言SQL文本解析成语法树,生成未解析逻辑执行计划;对所述未解析逻辑执行计划进行解析,得到逻辑执行计划;
    在所述逻辑执行计划中加入所述查询节点。
  9. 根据权利要求1至8任一项所述的方法,其特征在于,所述根据修改后的所述逻辑执行计划,生成所述物理执行计划,包括:
    对修改后的所述逻辑执行计划进行更新,得到更新后的逻辑执行计划;
    对所述更新后的逻辑执行计划进行优化,得到优化后的逻辑执行计划;
    将所述优化后的逻辑执行计划转换为物理执行计划。
  10. 根据权利要求3至7任一项所述的方法,其特征在于,所述第二待连接子表Spark执行物理执行计划时进行归并端链接Reduce Join。
  11. 根据权利要求10所述的方法,其特征在于,所述Map Join为广 播表链接BroadcastHashJoin,所述Reduce Join为排序合并链接SortMergeJoin。
  12. 一种数据倾斜处理设备,其特征在于,包括:
    查询模块,用于通过逻辑执行计划中的查询节点对待连接数据表进行查询,获得数据倾斜的键Key;
    修改模块,用于根据所述数据倾斜的Key与数据倾斜策略对所述逻辑执行计划进行修改,以使从所述待连接数据表中拆分得到的所述数据倾斜的Key对应的第一待连接子表在分布式计算引擎Spark执行物理执行计划时进行映射端链接Map Join;
    生成模块,用于根据修改后的所述逻辑执行计划,生成所述物理执行计划,以通过Spark执行所述物理执行计划。
  13. 根据权利要求12所述的设备,其特征在于,所述查询模块具体用于:
    针对所述待连接数据表的每个Key,将所述Key对应的数据量与第一预设阈值进行对比;
    若所述Key对应的数据量大于所述第一预设阈值,则将所述Key确定为数据倾斜的Key。
  14. 根据权利要求12或13所述的设备,其特征在于,所述修改模块具体用于:
    在所述逻辑执行计划中增加以下处理步骤:
    根据所述数据倾斜的Key,将所述待连接数据表的数据进行拆分,得到所述第一待连接子表和数据非倾斜的Key对应的第二待连接子表;
    将连接后的所述第一待连接子表和连接后的所述第二待连接子表进行合并,得到最终的数据表。
  15. 根据权利要求14所述的设备,其特征在于,所述修改模块具体用于:
    通过Union算子,将连接后的所述第一待连接子表和连接后的所述第二待连接子表进行合并,得到最终的数据表。
  16. 根据权利要求14所述的设备,其特征在于,所述待连接数据表包括第一数据表和第二数据表,所述数据倾斜的Key来自于所述第一数据表和/或所述第二数据表。
  17. 根据权利要求16所述的设备,其特征在于,所述数据倾斜的Key为多个,所述第一待连接子表为多个,所述数据倾斜的Key与所述第一待连接子表一一对应;
    所述修改模块具体用于:针对每个数据倾斜的Key,所述数据倾斜的Key对应的第一待连接子表在Spark执行物理执行计划时进行Map Join。
  18. 根据权利要求16所述的设备,其特征在于,所述数据倾斜的Key为多个,所述第一待连接子表为至少一个;
    所述修改模块还用于:
    所述数据倾斜的Key为多个,所述第一待连接子表为至少一个;
    针对每个分组,所述分组对应的第一待连接子表在Spark执行物理执行计划时进行Map Join。
  19. 根据权利要求12至18任一项所述的设备,其特征在于,还包括:
    语法分析模块,用于将结构化查询语言SQL文本解析成语法树,生成未解析逻辑执行计划;
    解析模块,用于对所述未解析逻辑执行计划进行解析,得到逻辑执行计划;
    创建模块,用于在所述逻辑执行计划中加入所述查询节点。
  20. 根据权利要求12至19任一项所述的设备,其特征在于,所述生成模块具体用于:
    对修改后的所述逻辑执行计划进行更新,得到更新后的逻辑执行计划;
    对所述更新后的逻辑执行计划进行优化,得到优化后的逻辑执行计划;
    将所述优化后的逻辑执行计划转换为物理执行计划。
  21. 根据权利要求14至18任一项所述的设备,其特征在于,所述第二待连接子表Spark执行物理执行计划时进行归并端链接Reduce Join。
  22. 根据权利要求21所述的设备,其特征在于,所述Map Join为广播表链接BroadcastHashJoin,所述Reduce Join为排序合并链接SortMergeJoin。
  23. 一种数据倾斜处理设备,其特征在于,包括:至少一个处理器和存储器;
    所述存储器存储计算机执行指令;
    所述至少一个处理器执行所述存储器存储的计算机执行指令,使得所 述至少一个处理器执行如权利要求1至11任一项所述的数据倾斜处理方法。
  24. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有计算机执行指令,当处理器执行所述计算机执行指令时,实现如权利要求1至11任一项所述的数据倾斜处理方法。
  25. 一种计算机程序产品,包括计算机程序,其特征在于,所述计算机程序被处理器执行时实现权利要求1至11任一项所述的数据倾斜处理方法。
  26. 一种运行指令的芯片,其特征在于,所述芯片包括存储器、处理器,所述存储器中存储代码和数据,所述存储器与所述处理器耦合,所述处理器运行所述存储器中的代码使得所述芯片用于执行上述权利要求1至11任一项所述的数据倾斜处理方法。
  27. 一种计算机程序,其特征在于,当所述计算机程序被处理器执行时,用于执行上述权利要求1至11任一项所述的数据倾斜处理方法。
PCT/CN2022/084642 2021-09-27 2022-03-31 数据倾斜处理方法、设备、存储介质及程序产品 Ceased WO2023045295A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111139049.1A CN113821541A (zh) 2021-09-27 2021-09-27 数据倾斜处理方法、设备、存储介质及程序产品
CN202111139049.1 2021-09-27

Publications (1)

Publication Number Publication Date
WO2023045295A1 true WO2023045295A1 (zh) 2023-03-30

Family

ID=78921369

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/084642 Ceased WO2023045295A1 (zh) 2021-09-27 2022-03-31 数据倾斜处理方法、设备、存储介质及程序产品

Country Status (2)

Country Link
CN (1) CN113821541A (zh)
WO (1) WO2023045295A1 (zh)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117009094A (zh) * 2023-10-07 2023-11-07 联通在线信息科技有限公司 数据倾斜打散方法、装置、电子设备及存储介质
CN118657141A (zh) * 2024-08-20 2024-09-17 浙江大华技术股份有限公司 倾斜分区的数据分析方法、装置及计算机存储介质
CN119597797A (zh) * 2025-02-10 2025-03-11 北京科杰科技有限公司 基于树形结构转换与hive多表联合的数据库查询方法

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113821541A (zh) * 2021-09-27 2021-12-21 北京沃东天骏信息技术有限公司 数据倾斜处理方法、设备、存储介质及程序产品
CN116126862A (zh) * 2023-02-06 2023-05-16 中国银联股份有限公司 一种数据表的关联方法、装置、设备及存储介质
CN117149717A (zh) * 2023-08-31 2023-12-01 中电云计算技术有限公司 表连接处理方法、装置、设备及存储介质

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105930479A (zh) * 2016-04-28 2016-09-07 乐视控股(北京)有限公司 一种数据倾斜处理方法及装置
CN105975463A (zh) * 2015-09-25 2016-09-28 武汉安天信息技术有限责任公司 一种基于MapReduce识别优化数据倾斜的方法及系统
CN106874322A (zh) * 2016-06-27 2017-06-20 阿里巴巴集团控股有限公司 一种数据表关联方法和装置
CN107066612A (zh) * 2017-05-05 2017-08-18 郑州云海信息技术有限公司 一种基于SparkJoin操作的自适应数据倾斜调整方法
CN109299131A (zh) * 2018-11-14 2019-02-01 百度在线网络技术(北京)有限公司 一种支持可信计算的spark查询方法及系统
CN110673794A (zh) * 2019-09-18 2020-01-10 中兴通讯股份有限公司 分布式数据的均衡处理方法、装置、计算终端和存储介质
US10691597B1 (en) * 2019-08-10 2020-06-23 MIFrontiers Corporation Method and system for processing big data
CN113821541A (zh) * 2021-09-27 2021-12-21 北京沃东天骏信息技术有限公司 数据倾斜处理方法、设备、存储介质及程序产品

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106156159B (zh) * 2015-04-16 2019-08-16 阿里巴巴集团控股有限公司 一种表连接处理方法、装置和云计算系统
CN108536824B (zh) * 2018-04-10 2020-11-20 中国农业银行股份有限公司 一种数据处理方法及装置
CN111382174B (zh) * 2018-12-28 2023-10-17 百度在线网络技术(北京)有限公司 多方数据联合查询方法、装置、服务器和存储介质
CN110955553A (zh) * 2019-12-06 2020-04-03 南京录信软件技术有限公司 一种数据倾斜过载保护方法
CN111767265B (zh) * 2020-05-14 2021-03-19 中邮消费金融有限公司 一种连接操作中数据倾斜方法、系统及计算机设备
CN111984685A (zh) * 2020-09-02 2020-11-24 深圳壹账通智能科技有限公司 数据倾斜检测方法、装置、计算机设备及可读存储介质
CN112949172B (zh) * 2021-02-24 2023-07-04 重庆中科云从科技有限公司 一种数据处理方法、装置、机器可读介质及设备
CN113407532B (zh) * 2021-05-25 2025-04-04 南京逸智网络空间技术创新研究院有限公司 Spark SQL多表连接优化方法、装置、计算机设备和存储介质

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105975463A (zh) * 2015-09-25 2016-09-28 武汉安天信息技术有限责任公司 一种基于MapReduce识别优化数据倾斜的方法及系统
CN105930479A (zh) * 2016-04-28 2016-09-07 乐视控股(北京)有限公司 一种数据倾斜处理方法及装置
CN106874322A (zh) * 2016-06-27 2017-06-20 阿里巴巴集团控股有限公司 一种数据表关联方法和装置
CN107066612A (zh) * 2017-05-05 2017-08-18 郑州云海信息技术有限公司 一种基于SparkJoin操作的自适应数据倾斜调整方法
CN109299131A (zh) * 2018-11-14 2019-02-01 百度在线网络技术(北京)有限公司 一种支持可信计算的spark查询方法及系统
US10691597B1 (en) * 2019-08-10 2020-06-23 MIFrontiers Corporation Method and system for processing big data
CN110673794A (zh) * 2019-09-18 2020-01-10 中兴通讯股份有限公司 分布式数据的均衡处理方法、装置、计算终端和存储介质
CN113821541A (zh) * 2021-09-27 2021-12-21 北京沃东天骏信息技术有限公司 数据倾斜处理方法、设备、存储介质及程序产品

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117009094A (zh) * 2023-10-07 2023-11-07 联通在线信息科技有限公司 数据倾斜打散方法、装置、电子设备及存储介质
CN117009094B (zh) * 2023-10-07 2024-02-23 联通在线信息科技有限公司 数据倾斜打散方法、装置、电子设备及存储介质
CN118657141A (zh) * 2024-08-20 2024-09-17 浙江大华技术股份有限公司 倾斜分区的数据分析方法、装置及计算机存储介质
CN119597797A (zh) * 2025-02-10 2025-03-11 北京科杰科技有限公司 基于树形结构转换与hive多表联合的数据库查询方法

Also Published As

Publication number Publication date
CN113821541A (zh) 2021-12-21

Similar Documents

Publication Publication Date Title
WO2023045295A1 (zh) 数据倾斜处理方法、设备、存储介质及程序产品
CN105117417B (zh) 一种读优化的内存数据库Trie树索引方法
US11010415B2 (en) Fixed string dictionary
US8949222B2 (en) Changing the compression level of query plans
CN112231321B (zh) 一种Oracle二级索引及索引实时同步方法
CN102955843B (zh) 一种键值数据库的多键查找实现方法
US20250005079A1 (en) Query Execution On Compressed In-Memory Data
CN103810219B (zh) 一种基于行存储数据库的数据处理方法及装置
US9864776B2 (en) Intelligently utilizing non-matching weighted indexes
CN106933869B (zh) 一种操作数据库的方法和装置
US10783142B2 (en) Efficient data retrieval in staged use of in-memory cursor duration temporary tables
CN104765731A (zh) 数据库查询优化方法和设备
CN107291770B (zh) 一种分布式系统中海量数据的查询方法及装置
US20260003868A1 (en) Data storage method and apparatus, electronic device, computer-readable storage medium, and computer program product
CN116701443A (zh) 一种数据查询方法、装置、计算机设备及存储介质
US10324933B2 (en) Technique for processing query in database management system
CN107832387B (zh) 一种基于fmdb的sql语句解析方法
CN115033597B (zh) 深度学习参与htap数据库执行sql优化的方法和系统
US8321429B2 (en) Accelerating queries using secondary semantic column enumeration
US9305080B2 (en) Accelerating queries using delayed value projection of enumerated storage
CN107145500A (zh) 一种基于Memcached的大数据缓存交互式查询方法
US12619605B2 (en) Zero copy optimization for select * queries
US12572523B2 (en) Method and apparatus for data query
US20230229657A1 (en) Zero Copy Optimization for SELECT * Queries
CN115712639A (zh) 一种自定义执行单元的sql协议扩展定义和实现系统

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22871360

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 050724)

122 Ep: pct application non-entry in european phase

Ref document number: 22871360

Country of ref document: EP

Kind code of ref document: A1