Patent Description:
A data processing system may use one or more computer programs to process data. One or more of the computer programs utilized by the data processing system may be developed as dataflow graphs. A dataflow graph may include components, termed "nodes" or "vertices," representing data processing operations to be performed on input data and links between the components representing flows of data. Nodes of a dataflow graph may include one or more input nodes representing respective input datasets, one or more output nodes representing respective output datasets, and one or more nodes representing data processing operations to be performed on data. Techniques for executing computations encoded by dataflow graphs are described in <CIT>, titled "Executing Computations Expressed as Graphs," and in <CIT>, titled "Managing Parameters for Graph-Based Computations".

<NPL>, describes issues involved in designing and using a cost elevator for query optimization in parallel database environments.

The present invention relates to a method according to independent claim <NUM>, to at least one non-transitory computer readable storage medium according to independent claim <NUM>, and to a data processing system according to independent claim <NUM>. Some of the preferred embodiments are described in the dependent claims, in the description and in the figures.

The foregoing is a non-limiting summary of the invention, which is defined by the attached claims.

Items appearing in multiple figures are indicated by the same or a similar reference number in all the figures in which they appear.

Aspects of the technology described herein are related to increasing the speed and throughput of a data processing system by improving upon conventional techniques for performing data processing operations using dataflow graphs.

As discussed above, nodes of a dataflow graph may represent respective data processing operations that may be applied to data accessed from one or more input datasets. Before applying a data processing operation to data, a processing layout for performing the data processing operation needs to be determined. The processing layout may specify how many computing devices are to be used for performing the data processing operation and may identify the particular computing devices to be used. Thus, before a data processing system may process data using a dataflow graph, processing layouts for nodes in the dataflow graph need to be determined.

Some conventional techniques for automatically determining processing layouts for nodes in a dataflow graph involve assigning processing layouts to each node in the graph such that all the processing layouts have the same degree of parallelism. For example, each node in the graph may be assigned an N-way processing layout specifying that each of the data processing operations represented by the nodes of the dataflow graph are to be performed using N computing devices, where N is an integer greater than or equal to <NUM>. Although different data processing operations may be performed by different groups of computing devices, each such group must have the same number of computing devices (i.e., N devices). As a result, conventional techniques do not allow for one node in a dataflow graph to have an N-way (N > <NUM>) processing layout and another node to have an M-way (N≠ M > <NUM>) processing layout.

The inventors have recognized that a data processing system may process data more quickly and efficiently, if processing layouts having different degrees of parallelism could be assigned to different nodes in the dataflow graph. Allowing different degrees of parallelism for different data processing operations represented by a dataflow graph may significantly increase the speed and throughput of any data processing system using the dataflow graph. As one example, consider the situation where different datasets accessed by a dataflow graph are stored using different degrees of parallelism. For example, one input dataset ("A") may be a file stored in a single location, another input dataset ("B") may be stored across <NUM> different locations using a distributed file system (e.g., the Hadoop Distributed File System), and an output dataset ("C") may be stored in <NUM> different locations using a distributed database system. It may be more efficient to read data from input dataset A using a serial processing layout, read data from input dataset B using a <NUM>-way parallel processing layout, and write data to output dataset C using a <NUM>-way parallel processing layout than to perform all these data processing operations using processing layouts having the same degree of parallelism, as using processing layouts having degrees of parallelism matched to that of the input and output dataset increases the speed of accessing and, subsequently processing the data contained therein. Additionally, some datasets may be accessed (e.g., read from and/or written to) using only a specified degree of parallelism. Different datasets may require different degrees of parallelism. Such datasets could not be accessed using the same dataflow graph without using the techniques described herein.

Consider, for example, the illustrative dataflow graph <NUM> shown in <FIG>, which includes input nodes 102a, 102b, 102c, nodes <NUM>, <NUM>, and <NUM> representing respective filtering operations, node <NUM> representing a sort operation, nodes <NUM> and <NUM> representing respective join operations, and output nodes 114a and 114b. As shown in <FIG>, data from the input dataset represented by node 102a is filtered, sorted and joined with a filtered version of the data from the input dataset represented by node 102b, prior to being written to the output dataset represented by output node 114a. Data from the input dataset represented by node 102b is also filtered and joined with data from the input dataset represented by node 102c prior to being written to the output dataset represented by node 114b. As shown in <FIG>, applying conventional techniques for automatically determining processing layouts results in the same parallel processing layout PL1 being assigned to each of the nodes of dataflow graph <NUM>. On the other hand, if the input and output datasets were stored using different degrees of parallelism, as illustrated in <FIG>, assigning different processing layouts to different nodes in graph <NUM> may be required.

Some embodiments described herein address all of the above-described issues that the inventors have recognized with conventional techniques for performing data processing operations using dataflow graphs. However, not every embodiment described below addresses every one of these issues, and some embodiments may not address any of them. As such, it should be appreciated that embodiments of the technology described herein are not limited to addressing all or any of the above-discussed issues of conventional techniques for performing data processing operations using dataflow graphs.

Some embodiments of the technology described herein are directed to techniques for automatically determining processing layouts for performing the data processing operations represented by one or more nodes in a dataflow graph. Unlike conventional techniques for performing computations using dataflow graphs, the processing layouts determined for different nodes need not be the same - data processing operations represented by different nodes in the graph may be performed using different processing layouts and, in particular, using processing layouts having different degrees of parallelism.

As used herein, a processing layout for a node in a dataflow graph refers to a processing layout used to perform the data processing operation represented by the node. For example, a processing layout for an input node in a dataflow graph refers to a processing layout used to read data from the input dataset represented by the input node. As another example, a processing layout for an output node in a dataflow graph refers to a processing layout used to write data to the output dataset represented by the output node. As yet another example, a processing layout for a node representing a data processing operation (e.g., a filtering operation, a join operation, a rollup operation, etc.) refers to a processing layout for performing the data processing operation.

In some embodiments, a processing layout for a node representing a data processing operation may indicate a degree of parallelism to be used for performing the operation and specify the computing device(s) to be used for performing the operation in accordance with the degree of parallelism. For example, a processing layout for a node may be a serial processing layout having a single degree of parallelism (i.e., serial not parallel processing) and specify a computing device (e.g., a processor, a server, a laptop, etc.) to use for performing the data processing operation represented by the node. As another example, a processing layout for a node may be an N-way (where N ≥ <NUM>) greater than <NUM>) parallel processing layout having N degrees of parallelism and specify N computing devices to use for performing the data processing operation represented by the node. In some embodiments, a processing layout for a node may specify one or more computing devices and/or one or more processes executing on the computing device(s) to use for performing the data processing operation represented by the node.

In some embodiments, determining the processing layouts for the nodes in a dataflow graph may include: (A) obtaining information specifying the dataflow graph; (B) obtaining processing layouts for input nodes in the dataflow graph; (C) obtaining processing layouts for output nodes in the dataflow graph; and (D) determining processing layouts for one or more other nodes (i.e., nodes which are not input or output nodes) based on processing layouts for input nodes, processing layouts for the output nodes, and one or more layout determination rules. Dataflow graph nodes other than the input and output nodes may be referred to as "intermediate" nodes herein. Examples of layout determination rules are described herein including with reference to <FIG>.

In some embodiments, at least two of the processing layouts obtained for the input and output nodes of a dataflow graph may have different degrees of parallelism. For example, processing layouts obtained for two different input nodes may have different degrees of parallelism. As another example, processing layouts obtained for two different output nodes may have different degrees of parallelism. As yet another example, the processing layout obtained for an input node may have a different degree of parallelism from the processing layout obtained for an output node. Notwithstanding, the techniques described herein may be used to automatically determine processing layouts for nodes in a graph where at least two of the processing layouts obtained for the input and output nodes have different degrees of parallelism. As one illustrative example, the techniques described herein may be applied to determining processing layouts of the dataflow graph <NUM> shown in <FIG>. The input and output nodes of dataflow graph <NUM> are associated with three different processing layouts (i.e., serial layout SL1, parallel layout PL1, and parallel layout PL2) and these processing layouts, along with the layout determination rules described herein, may be used to automatically determine the processing layouts for the nodes <NUM>, <NUM>, <NUM>, <NUM>, <NUM>, and <NUM>, as shown in <FIG>.

In some embodiments, the processing layouts for one or more intermediate nodes in a dataflow graph may be determined by: (<NUM>) performing a forward pass (from the input node(s) towards the output node(s)) to determine an initial processing layout for at least some (e.g., all) of the intermediate nodes; and subsequently (<NUM>) performing a backward pass (from the output node(s) towards the input node(s)) to determine a final processing layout for the intermediate nodes. During the forward pass, the initial processing layouts may be determined based on the processing layouts assigned to the input nodes and one or more layout determination rules described herein. For example, the initial processing layouts for the nodes <NUM>, <NUM>, <NUM>, <NUM>, <NUM> and <NUM> may be determined based on the processing layouts assigned to the nodes 102a, 102b, and 102c. During the backward pass, the final processing layouts for the intermediate nodes may be determined based on the processing layouts assigned to the output node(s), the initial processing layouts assigned to at least some of the intermediate nodes, and one or more layout determination rules. For example, the final processing layouts for the nodes <NUM>, <NUM>, <NUM>, <NUM>, <NUM> and <NUM> may be determined based on the initial processing layouts determined for these nodes during the forward pass, the processing layouts assigned to the output nodes 114a and 114b, and one or more layout determination rules.

In some embodiments, after the processing layouts for the nodes in a dataflow graph have been determined (e.g., after performing a forward pass and a backward pass), the dataflow graph may be configured to perform a repartitioning operation on any data that is to be processed using a processing layout having a particular degree of parallelism after being processed using a processing layout having a different degree of parallelism. In some embodiments, the dataflow graph may be configured to perform a repartitioning operation on data flowing between adjacent nodes in the graph having processing layouts with different degrees of parallelism. In this way, data that has been processed using one processing layout (using N computing devices, with N ≥ <NUM>) may be adapted for subsequent processing using another processing layout (using M ≠ N computing devices, with M ≥ <NUM>).

For example, as illustrated in <FIG>, adjacent nodes 102a and <NUM> have processing layouts with different degrees of parallelism, as one of the layouts is serial (processing is performed using one computing device) and the other is parallel (processing is performed using multiple computing devices). In this example, the dataflow graph may be configured to partition the data flowing from node 102a to node <NUM>, so that it may be processed in accordance with the processing layout (PL1) determined for node <NUM>, using multiple computing devices, after being processed in accordance with the processing layout (SL1) determined for node 102a, using a single computing device. To this end, the dataflow graph may be configured to perform a repartitioning operation that increases the degree of parallelism (e.g., a partition-by-key operation). Also, in the same example, adjacent nodes 102b and <NUM> have different processing layouts and adjacent nodes <NUM> and <NUM> have different processing layouts, and the dataflow graph <NUM> may be configured to perform a repartitioning operation on data flowing from node <NUM> to node <NUM> and a repartitioning operation (e.g., a gather operation) on data flowing from node <NUM> to node <NUM>.

In some embodiments, a dataflow graph may be configured to perform a repartitioning operation (when the graph is executed) by augmenting the graph with a node representing the repartitioning operation. When the graph is executed, software configured to perform the repartitioning operation may be executed. For example, as shown in <FIG>, the dataflow graph may be augmented with nodes <NUM>, <NUM>, and <NUM>, each of the nodes being associated with a respective repartitioning operation. In other embodiments, one or more existing nodes in the dataflow graph may be configured to perform a repartitioning operation and a new node is not added.

In some embodiments, when a node (node "A") in a dataflow graph is associated with a processing layout having a higher degree of parallelism than that of the following adjacent node in the graph (node "B"), the dataflow graph may be configured to perform a repartitioning operation on data after it is processed in accordance with the data processing operation represented by node "A" and before it is processed in accordance with the data processing operation represented by node "B". In this case, the repartitioning operation may decrease the degree of parallelism and, for example, may be a gather operation<NUM> or a merge operation. <NUM> For example, as shown in <FIG>, the parallel processing layout (PL2) of node <NUM> has a higher degree of parallelism than the serial processing layout (SL1) of the following adjacent node 114b. In this example, node <NUM> associated with a gather operation has been added between nodes <NUM> and 114b. <NUM> A gather operation performed on multiple sets of data records may combine the multiple sets of data records into a single set of data records, but without necessarily maintaining sortedness of the data records in the single set. <NUM> A merge operation performed on multiple sets of data records may combine the multiple sets of data records into a single set of data records, while maintaining sortedness of the data records in the single set.

In some embodiments, when a node (node "A") in a dataflow graph is associated with a processing layout having a lower degree of parallelism than that of the following adjacent node in the graph (node "B"), the dataflow graph may be configured to perform a repartitioning operation on data after it is processed in accordance with the data processing operation represented by node "A" and before it is processed in accordance with the data processing operation represented by node "B". In this case, the repartitioning operation may increase the degree of parallelism and, for example, may be a partition-by-key operation<NUM>, a round-robin partition operation, a partition-by-range operation<NUM>, or any other suitable type of partitioning operation. For example, as shown in <FIG>, the serial processing layout of node 102a (SL1) has a lower degree of parallelism than the parallel processing layout (PL1) of the following adjacent node 114b. Similarly, in this example, the parallel processing layout (PL1) of node 102b has a lower degree of parallelism than the parallel processing layout (PL2) of node <NUM>. In this example, node <NUM> representing a partition by key operation has been added between nodes 102a and <NUM>, and node <NUM> representing a round-robin partition operation followed by a gather operation which achieve a desired reduction in the degree of parallelism. <NUM> In a partition-by-key operation, data records having the same value(s) for the same field(s) (e.g., in the same column(s)) are assigned to the same partition. <NUM> In a partition-by-range operation, different partitions are associated with different non-overlapping ranges of values, and any data record having a field value in a range is assigned to the partition associated with the range.

In some embodiments, when a node (node "A") in a dataflow graph is associated with a processing layout having the same degree of parallelism as that of the following adjacent node in the graph (node "B"), no repartitioning operation is needed.

Although, in some embodiments, processing layouts for intermediate nodes of a dataflow graph may be determined based on the processing layouts assigned to input and output nodes of the graph, the techniques described herein are not limited to determining layouts of intermediate nodes from layouts of input and output nodes. In some embodiments, for example, processing layouts may be obtained for any subset of one or more nodes of a dataflow graph and processing layouts for any other node(s) in the dataflow graph may be determined based on these obtained processing layouts, the structure of the dataflow graph, and one or more layout determination rules.

Some embodiments of the technology described herein may be applied to managing database queries, such as Structured Query Language (SQL) queries, by a data processing system. In some embodiments, a data processing system may: (<NUM>) receive a database query (e.g., a SQL query); (<NUM>) generate a query plan for executing the SQL query (e.g., a plan indicating the database operations that may be performed if the database query were executed); (<NUM>) generate a dataflow graph from the query plan; and (<NUM>) execute the received database query at least in part by executing the dataflow graph. Such embodiments are described in further detail in <CIT>. <CIT> matured from <CIT>.

In some embodiments, techniques described herein may be used for automatically determining processing layouts for one or more nodes in a dataflow graph generated, automatically, from a database query (e.g., a SQL query).

In some embodiments, a data processing system may: (<NUM>) receive a database query (e.g., a SQL) query; (<NUM>) transform the received database query into computer code comprising computer code portions that, when executed, executes the database query; and (<NUM>) automatically determine a processing layout for executing each of the computer code portions. In some embodiments, the processing layouts for executing the computer code portions may be determined using information indicating the order of execution of the computer code portions. For example, in some embodiments, each of the computer code portions may be associated with a respective node in a dataflow graph, and the structure of the graph (e.g., as embodied in the connections among the nodes) may be used to assign processing layouts to the nodes and, by association, to the computer code portions associated with the nodes. However, it should be appreciated that in some embodiments, processing layouts for executing the computer code portions may be determined without using a dataflow graph because information indicating the order of execution of the computer code portions is not limited to being encoded in a dataflow graph.

It should be appreciated that the embodiments described herein may be implemented in any of numerous ways. Examples of specific implementations are provided below for illustrative purposes only. It should be appreciated that these embodiments and the features/capabilities provided may be used individually, all together, or in any combination of two or more, as aspects of the technology described herein are not limited in this respect.

<FIG> is a flowchart of an illustrative process <NUM> for determining a processing configuration for a dataflow graph at least in part by assigning processing layouts to nodes in the dataflow graph, in accordance with some embodiments of the technology described herein. Process <NUM> may be performed by any suitable system and/or computing device and, for example, may be performed by data processing system <NUM> described herein including with reference to <FIG>. After process <NUM> is described, some aspects of process <NUM> are illustrated with reference to the examples shown in <FIG>, <FIG>, and <FIG>. Although the example of <FIG> is described in detail after the description of process <NUM>, this example is also referenced throughout the description of process <NUM> for clarity of exposition.

Process <NUM> begins at act <NUM>, where information specifying a dataflow graph may be accessed. As described herein, a dataflow graph may include multiple nodes including: (a) one or more input nodes representing one or more respective input datasets; (b) one or more output nodes, representing one or more respective output datasets; and/or (c) one or more nodes representing data processing operations that may be performed on the data. Directed links or edges among nodes in the dataflow graph represent flows of data between the nodes. Accordingly, at act <NUM>, information specifying the nodes (including any of the above-described types of nodes) and links of the dataflow graph may be accessed. This information may be accessed from any suitable source, any suitable data structure(s), and may be in any suitable format, as aspects of the technology described herein are not limited in this respect. For example, with reference to the example illustrated in <FIG>, at act <NUM>, information specifying dataflow graph <NUM> may be accessed. In some embodiments, described in further detail below, the dataflow graph about which information is accessed at act <NUM> may have been generated automatically and, for example, may have been generated automatically from a structured query language (SQL) query.

Next, at act <NUM>, processing layouts may be obtained for each input node (i.e., each node representing an input dataset) of the dataflow graph accessed at act <NUM>. For example, with reference to the example of <FIG>, at act <NUM>, processing layouts for input nodes <NUM> and <NUM> may be obtained. In some embodiments, a processing layout for an input node specifies a degree of parallelism (e.g., serial, <NUM>-way parallel, <NUM>-way parallel,. , N-way parallel for any suitable integer N) for reading data from the input dataset represented by the input node. In some embodiments, a processing layout for an input node identifies a set of one or more computing devices (e.g., a set of one or more processors, servers, and/or any other suitable devices) to use for reading data from the input dataset.

The processing layout for an input node may be obtained in any suitable way. In some embodiments, the processing layout for an input node may be determined prior to the start of execution of process <NUM> and, during act <NUM>, the previously-determined processing layout may be accessed. In other embodiments, the processing layout for an input node may be determined dynamically during the execution of process <NUM>. In some embodiments, the processing layout for an input may be partially determined prior to the start of execution of process <NUM>, with the unknown information being determined dynamically during the execution of process <NUM>. For example, prior to the execution of process <NUM> it may be known that processing layout for an input node is serial or parallel, but the specific computing device(s) used to perform the input operation (e.g., reading data from one or more sources) may be determined during execution of process <NUM>. As another example, it may be known in advance of executing process <NUM> that a parallel processing layout is to be assigned to an input node, but the degree of parallelism may be determined during runtime.

Regardless of whether a processing layout for an input node is determined before or during execution of process <NUM>, that determination may be made in any suitable way. For example, in some embodiments, the processing layout for an input node may be specified manually by a user through a user interface (e.g., a graphical user interface, a configuration file, etc.). According to the invention, the processing layout for an input node is determined automatically by the data processing system. The data processing system automatically determines a processing layout for an input node based on how the input dataset represented by the input node is stored. For example, when an input dataset is stored across multiple devices (e.g., <NUM> servers, using a Hadoop cluster, etc.), the data processing system executing process <NUM> may determine that a parallel processing layout (e.g., a four-way parallel processing layout, the number of nodes in the Hadoop cluster) is to be used for reading data records from the input dataset.

Next, at act <NUM>, processing layouts may be obtained for each output node (i.e., each node representing an output dataset) of the dataflow graph accessed at act <NUM>. For example, with reference to the example of <FIG>, at act <NUM>, a processing layout for the output node <NUM> may be obtained. In some embodiments, a processing layout for an output node specifies a degree of parallelism (e.g., serial, <NUM>-way parallel, <NUM>-way parallel,. , N-way parallel for any suitable integer N) for writing data to the output dataset represented by the output node. In some embodiments, a processing layout for an output node identifies a set of one or more computing devices (e.g., a set of one or more processors, servers, and/or any other suitable devices) to use for writing data to the output dataset.

The processing layout for an output node may be obtained in any suitable way. In some embodiments, the processing layout for an output node may be determined prior to the start of execution of process <NUM> and, during act <NUM>, the previously-determined processing layout may be accessed. In other embodiments, the processing layout for an output node may be determined dynamically during the execution of process <NUM>. In some embodiments, the processing layout for an output node may be partially determined prior to the start of execution of process <NUM>, with the unknown information being determined dynamically during the execution of process <NUM>. For example, prior to the execution of process <NUM> it may be known that processing layout for an output node is serial or parallel, but the specific computing device(s) used to perform the output operation (e.g., writing data to one or more output datasets) may be determined during execution of process <NUM>. As another example, it may be known in advance of executing process <NUM> that a parallel processing layout is to be assigned to an output node, but the degree of parallelism may be determined during runtime.

Regardless of whether a processing layout for an output node is determined before or during execution of process <NUM>, that determination may be made in any suitable way including in any of the ways described above for determining a processing layout for an input node. For example, the processing layout for an output node may be specified manually by a user through a user interface or may be determined automatically by the data processing system (e.g., based on how the output dataset represented by the output node is stored).

Next, process <NUM> proceeds to act <NUM>, where the processing layouts are determined for nodes in the dataflow graph other than the input and the output nodes, for which processing layouts have been obtained at acts <NUM> and <NUM>. In some embodiments, a processing layout for an intermediate node specifies a degree of parallelism (e.g., serial, <NUM>-way parallel, <NUM>-way parallel,. , N-way parallel for any suitable integer N) for performing the data processing operation represented by the intermediate node. In some embodiments, a processing layout for an intermediate node identifies a set of one or more computing devices (e.g., a set of one or more processors, servers, and/or any other suitable devices) to use for performing the data processing operation.

In some embodiments, the processing layouts for intermediate nodes may be determined at least in part by using the processing layouts for the input and output nodes (obtained at acts <NUM> and <NUM>). For example, with reference to the example of <FIG>, at act <NUM>, processing layouts for the intermediate nodes <NUM>, <NUM>, <NUM>, and <NUM> may be determined using the processing layouts for the input nodes <NUM> and <NUM> and the output node <NUM>. In some embodiments, the processing layouts for intermediate nodes may be determined further based on the structure of the dataflow graph and one or more layout determination rules.

In some embodiments, the layout determination rules may specify how the processing layout for a node in the dataflow graph may be determined based on processing layouts for one or more other nodes in the dataflow graph. For example, in some embodiments, a layout determination rule may specify how the processing layout for a particular node, which is not associated with any processing layout, may be determined based on the processing layout(s) for one or more other nodes adjacent to the particular node in the graph. As one illustrative example, with reference to the example of <FIG>, a layout processing rule may specify how to determine the processing layout for intermediate node <NUM> based on the processing layout for input node <NUM>. As another illustrative example, if processing layouts for nodes <NUM> and <NUM> were determined, a layout processing rule may specify how to determine the processing layout for node <NUM> based on the processing layouts determined for nodes <NUM> and <NUM>.

As another example, in some embodiments, a layout determination rule may specify how to determine a processing layout for a particular node, which is already associated with a particular processing layout, based on the particular processing layout and the processing layouts of one or more other nodes adjacent to the particular node in the graph. As one illustrative example, with reference to the example of <FIG>, a processing layout for node <NUM> may be determined based on an initial processing layout determined for node <NUM> (layout PL1) and on the processing layout determined for output node <NUM> (layout SL2).

Non-limiting illustrative examples of specific layout determination rules are described below. It should be appreciated that, in some embodiments, one or more other layout determination rules may be used in addition to or instead of the example layout determination rules described herein. It should also be appreciated that any suitable combination of one or more of the example layout rules described herein may be used in some embodiments. The layout determination rules described herein may be implemented in any suitable way (e.g., using software code, one or more configuration parameters, etc.), as aspects of the technology described herein are not limited in this respect.

In some embodiments, in accordance with one example layout determination rule, when determining a processing layout for a particular node, which is not already associated with a processing layout, if the particular node has a neighbor (e.g., a node immediately preceding the particular node in the dataflow graph or a node immediately following the particular node in the dataflow graph) with an associated processing layout, the layout of the neighboring node may be determined as the processing layout of the particular node. In this way, the processing layout of a neighboring node may be "copied" to the particular node. As one illustrative example, in the example of <FIG>, the processing layout of node <NUM> may be determined to be the processing layout of its preceding neighboring node <NUM>. In turn, the processing layout of node <NUM> may be determined to be the processing layout of its preceding node <NUM>. As may be appreciated from this example, this layout determination rule may be applied repeatedly to propagate a layout of an input node (e.g., node <NUM>) to one or more other nodes (e.g., nodes <NUM>, <NUM>, and <NUM>).

In some embodiments, in accordance with another example layout determination rule, when determining a processing layout for a particular node, which is not already associated with a particular processing layout, if the particular node has multiple neighbors (e.g., multiple preceding neighbors or multiple following neighbors) with associated processing layouts, the processing layout for the particular node may be selected from among the layouts of its neighbors. For example, for the dataflow graph of <FIG>, assuming that the layouts of nodes <NUM> and <NUM> were determined but the layout of node <NUM> was not yet determined, the layout for node <NUM> may be selected to be one of the layouts determined for nodes <NUM> and <NUM>.

In some embodiments, in accordance with another example layout determination rule, when determining a processing layout for a particular node that is already associated with a particular processing layout, if the particular node has one or more neighbors associated with respective processing layouts, the layout for the particular node may be determined by selecting from among the particular processing layout already associated with the node and the processing layouts of its neighbors. For example, as shown in <FIG>, node <NUM> is associated with an initial processing layout (PL1) and has a neighboring node <NUM> associated with another processing layout (SL2). In this example, one of these two layouts (i.e., PL1 and SL2) may be selected as an updated (e.g., final) processing layout for node <NUM>.

As may be appreciated from the foregoing, in some embodiments, applying certain layout determination rules involves selecting a processing layout from among two or more processing layouts. This may be done in any of numerous ways. For example, in some embodiments, when selecting a processing layout for a node from a group of two or more processing layouts, the processing layout having the greatest degree of parallelism may be selected. For example, when selecting a processing layout for a node to be either an N-way parallel processing layout (e.g., a <NUM>-way parallel layout) or an M-way (with M < N) parallel processing layout (e.g., a <NUM>-way parallel layout), the N-way parallel processing layout may be selected. As another example, when selecting a processing layout for a node from a parallel processing layout and a serial processing layout, the parallel processing layout may be selected. As one illustrative example, with reference to <FIG>, node <NUM> may be assigned an initial serial processing layout (SL1) (e.g., as a result of propagating that layout from input node <NUM>) and the node <NUM> may be assigned a parallel layout PL1 (e.g., as a result of propagating that layout from input node <NUM>). Then, the processing layout for node <NUM> may be updated to be the parallel layout PL1 because, as between PL1 and SL1, the layout PL1 clearly has a greater degree of parallelism.

As another example, in some embodiments, when selecting a processing layout for a node from among processing layouts having the same degree of parallelism, the processing layout being used to process the larger number of records may be selected. For example, when selecting a processing layout for a node in a dataflow graph from a <NUM>-way layout PL1 assigned to a first preceding neighbor of the node and being used to process <NUM> million data records and a <NUM>-way layout PL2 assigned to a second preceding neighbor of the node and being used to process <NUM> thousand data records, the layout PL1 may be selected for the node. In this way, the data processing operation associated with the node (e.g., a join operation) may be performed using the same processing layout (e.g., the same computing devices) as the one used to process <NUM> million data records. As a result, when the layouts PL1 and PL2 are implemented using non-overlapping sets of computing devices, at most <NUM> thousand data records would need to be moved to the computing devices used to process the <NUM> million data records. On the other hand, if the layout PL2 were selected, then possibly all <NUM> million data records would need to be moved to the computing devices used to process only <NUM> thousand data records, which is clearly inefficient. Thus, selecting a layout that is used to process a greater number of records may serve to improve the performance of the data processing system. An example of this is described further below with reference to <FIG>.

In some embodiments, in accordance with another example layout determination rule, after processing layouts are determined for input nodes and output nodes of a dataflow graph, these processing layouts are not subsequently changed. In embodiments where this rule is utilized, after the processing layouts for the input and output nodes are obtained at acts <NUM> and <NUM>, these processing layouts are not subsequently changed.

In some embodiments, in accordance with another example layout determination rule, a serial processing layout may be assigned to a node representing the limit operation, which is an operation that when applied to a group of data records outputs a fixed number of the data records (e.g., output the data records having the top ten scores after the data records have been sorted based on their respective scores).

In some embodiments, one or more internal nodes in a dataflow graph may be associated with a predetermined processing layout. In some embodiments, nodes of a particular type may be associated with a predetermined processing layout.

In some embodiments, in accordance with another example layout determination rule, when a processing layout is assigned to a particular node in a dataflow graph, an indication may be supplied (e.g., by a user through a user interface such as a graphical user interface or a configuration file) to not propagate the processing layout assigned to the particular node to any other nodes. For example, in some embodiments, an indication to not propagate a processing layout assigned to one or more input nodes and/or one or more output nodes may be provided as part of obtaining the input and/or output processing layouts at acts <NUM> and/or <NUM>.

An example of this is described further below with reference to <FIG>.

Any of the above-described layout determination rules may be used to determine processing layouts for intermediate nodes at act <NUM> of process <NUM>. Although some of the above-described layout determination rules are "local" in that they specify how to determine a processing layout for a particular node based on layouts already assigned to its neighbors, in some embodiments, one or more of these layout determination rules may be applied repeatedly so as to propagate the processing layouts obtained for input and output processing nodes to intermediate nodes. This propagation may be done in any suitable way.

In some embodiments, processing layouts for intermediate nodes may be determined at act <NUM> by: (<NUM>) performing a forward pass at act 208a to determine an initial processing layout for at least some (e.g., all) of the intermediate nodes; and (<NUM>) performing a backward pass at act 208b to determine a final processing layout for at least some (e.g., all) of the intermediate nodes.

During the forward pass, processing layouts obtained for the input node(s) may be propagated to the intermediate nodes in the dataflow graph using one or more of the layout determination rules described herein. The structure of the dataflow graph may guide the order in which processing layouts are determined for nodes during the forward pass. For example, processing layouts for neighbors of the input nodes may be determined first, then processing layouts for the neighbors of the neighbors of the input nodes may be determined, and so on. until all the flows from the input nodes have been followed through to their ends at the output nodes. As one illustrative example, with reference to <FIG>, the processing layouts for input nodes <NUM> and <NUM> may be propagated during the forward pass using one or more layout determination rules to obtain initial processing layouts for nodes <NUM>, <NUM>, <NUM>, and <NUM>.

During the backward pass, processing layouts obtained for the output node(s) may be propagated to the intermediate nodes in the dataflow graph using one or more of the layout determination rules described herein. As in the case of the forward pass, the structure of the dataflow graph may guide the order in which processing layouts are determined for nodes during the backward pass. For example, processing layouts for neighbors of the output nodes may be determined first, then processing layouts for the neighbors of the neighbors of the output nodes may be determined, and so on. until all the edges from the output nodes have been followed through to their ends at the output nodes. The paths followed are the reverse during the backward pass may be reverse of the paths followed in the forward pass. As one illustrative example, with reference to <FIG>, the processing layout for output node <NUM> and the initial processing layouts for nodes <NUM>, <NUM>, <NUM>, and <NUM> may be used during the backward pass together with one or more layout determination rules to obtain the final processing layouts for nodes <NUM>, <NUM>, <NUM>, and <NUM>. This is discussed in more detail below with reference to <FIG>.

After processing layouts have been determined for the intermediate nodes at act <NUM>, process <NUM> proceeds to decision block <NUM>, where it is determined whether any adjacent nodes in the dataflow graph have mismatched layouts. Adjacent nodes "A" and "B" have mismatched layouts when the processing layout determined for node A has a different degree of parallelism from the processing layout determined for node B. For example, when an N-way (N > <NUM>) parallel processing layout is determined for node A and a serial processing layout is determined for a following node B, the nodes have mismatched layouts (there is an N-to-<NUM> transition). As another example, when a serial processing layout is determined for node A and an M-way (M > <NUM>) parallel processing layout is determined for a following node B, the nodes have mismatched layouts (there is a <NUM>-to-M transition). As another example, when an N-way parallel processing layout is determined for node A and an M-way parallel processing layout is determined for adjacent node B, with M ≠ N, the nodes have mismatched layouts (there is an N-to-M transition).

When it is determined, at decision block <NUM>, that there is a pair of adjacent nodes having processing layouts with different degrees of parallelism, process <NUM> proceeds to act <NUM>, where the dataflow graph may be configured to perform one or more repartitioning operations. The repartitioning operation(s) allow for data records being processed using one processing layout using one number of processors to be transitioned for processing using another processing layout using a different number of processors. Examples of repartitioning operations are described herein and include, for example, repartitioning operations for increasing the degree of parallelism in the processing of data (e.g., a partition-by-key operation, a round robin partition operation, a partition by range operation, and/or any other suitable type of partition operation) and repartitioning operations for decreasing the degree of parallelism in the processing of data (e.g., a merge operation and a gather operation). For example, when there is an N-to-<NUM> transition between adjacent nodes A and B, the dataflow graph may be configured to perform a repartitioning operation for decreasing the degree of parallelism (from N to <NUM>) of data processed in accordance with the operation represented by node A and before that data is processed in accordance with the operation represented by node B. As another example, when there is a <NUM>-to-M transition between adjacent nodes A and B, the dataflow graph may be configured to perform a repartitioning operation for increasing the degree of parallelism (from <NUM> to M) of data processed in accordance with the operation represented by node A and before that data is processed in accordance with the operation represented by node B. As yet another example, when there is an N-to-M transition between adjacent nodes A and B, the dataflow graph may be configured to perform multiple repartitioning operations in order to change the degree of parallelism (from N to M) on data processed in accordance with the operation represented by node A and before that data is processed by the operation represented by node B. The multiple repartitioning operations may include a first repartitioning operation to decrease the degree of parallelism (e.g., from N to K) and a second repartitioning operation to increase the degree of parallelism (e.g., from K to M, where K is a common divisor of N and M).

In some embodiments, a dataflow graph may be configured to perform a repartitioning operation by adding a new node representing the repartitioning operation. Examples of this are shown in <FIG>, <FIG>, and <FIG>, which are described below. In such embodiments, a processing layout may be determined for the node representing the repartitioning operation. When the repartitioning operation increases the degree of parallelism (e.g., a partition-by-key operation), the processing layout assigned to the node representing the repartitioning operation may be the processing layout assigned to the preceding node. When the repartitioning operation decreases the degree of parallelism (e.g., a merge operation or a gather operation), the processing layout assigned to the node representing the repartitioning operation may be the processing layout assigned to the following node in the graph. In other embodiments, existing nodes in a dataflow graph may be configured to perform a repartitioning operation.

In some embodiments, the data processing system performing process <NUM> may be programmed to configure the dataflow graph to perform certain types of repartitioning operations in certain situations. For example, in some embodiments, when a dataflow graph is configured to perform a repartitioning operation to decrease the degree of parallelism and the data is sorted, if the sortedness of the data is to be maintained through the repartitioning, then the dataflow graph may be configured to perform a merge operation to decrease the degree of parallelism. Otherwise, a gather operation may be used to decrease the degree of parallelism. As another example, in some embodiments, when a dataflow graph is configured to perform a repartitioning operation to increase the degree of parallelism, when a certain partitioning of the data is desired, the dataflow graph may be configured to perform a partition-by-key operation for a particular key or keys. Otherwise, a round-robin partition operation or another type of partition operation may be used. As another example, in some embodiments, applying a rollup operation to parallel data may require repartitioning, if the data is not already partitioned on a subset of the rollup keys. In this case, when the rollup is estimated to reduce the amount of data significantly (e.g., at least by a factor of <NUM>), then a double-bubble rollup may be performed (i.e., first a rollup in the source layout and partitioning scheme, then a repartition, then a second rollup in the destination layout and partitioning scheme).

On the other hand, when it is determined, at decision block <NUM>, that there are no adjacent nodes having processing layouts with different degrees of parallelism or that, for any adjacent nodes having layouts with different degrees of parallelism, appropriate repartitioning logic has been added to the dataflow graph, process <NUM> completes.

In some embodiments, after the processing layouts have been assigned using process <NUM>, the dataflow graph may be executed in accordance with the assigned layout. In this way, each of one or more data processing operations in the dataflow graph is executed in accordance with the processing layout assigned to that data processing operation.

In some embodiments, process <NUM> may be applied to automatically generated dataflow graphs. For example, in some embodiments, process <NUM> may be applied to dataflow graphs automatically generated from a SQL query, from information specifying a query provided by another database system, and/or from another dataflow graph.

In some embodiments, a dataflow graph may be generated from a SQL query by: (<NUM>) receiving a SQL query; (<NUM>) generating a query plan from the received SQL query; and (<NUM>) generating the dataflow graph from the query plan. In turn, process <NUM> may be applied to the dataflow graph so generated. Each of these three acts (of automatically generating a dataflow graph to which process <NUM> may be applied) is described in more detail below.

In some embodiments, the SQL query may be received by a data processing system (e.g., the data processing system executing process <NUM> such as, for example, data processing system <NUM>) as a result of a user providing the SQL query as input to the data processing system. The user may input the SQL query through a graphical user interface or any other suitable type of interface. In other embodiments, the SQL query may be provided to the data processing system by another computer program. For example, the SQL query may be provided by a computer program configured to cause the data processing system to execute one or more SQL queries, each of which may have been specified by a user or automatically generated. The SQL query may be of any suitable type and may be provided in any suitable format, as aspects of the technology described herein are not limited in this respect.

In some embodiments, the received SQL query may be used to generate a query plan. The generated query plan may identify one or more data processing operations to be performed if the SQL query were executed. The generated query plan may further specify an order in which the identified data processing operations are to be executed. As such, the generated query plan may represent a sequence of data processing operations to perform in order to execute the received SQL query. The generated query plan may be generated using any suitable type of query plan generator. Some illustrative techniques for generating query plans are described in <CIT>, titled "Managing Data Queries,".

In turn, in some embodiments a dataflow graph may be generated from the query plan, which itself was generated using the received SQL query. In some embodiments, the dataflow graph may be generated from a query plan at least in part by generating the dataflow graph to include a node for each of at least a subset (e.g., some or all) of the data processing operations identified in the query plan. In some embodiments, a single node in a query plan may result in the inclusion of multiple nodes in the dataflow graph. Subsequently, the order of data processing operations specified in the query plan may be used to generate links connecting nodes in the dataflow graph. For example, when the generated query plan indicates that a first data processing operation is performed before a second data processing operation, the generated dataflow graph may have a first node (representing the first data processing operation) and a second node (representing the second data processing operation) and one or more links specifying a path from the first node to the second node.

In some embodiments, generating the dataflow graph from the query plan comprises adding one or more nodes to the graph representing input and/or output data sources. For example, generating the dataflow graph may comprise adding an input node for each of the data sources from which data records are to be read during execution of the SQL query. Each of the input nodes may be configured with parameter values associated with the respective data source. These values may indicate how to access the data records in the data source. As another example, generating the dataflow graph may comprise adding an output node for each of the data sinks to which data records are to be written during execution of the SQL query. Each of the output nodes may be configured with parameter values associated with the respective data sinks. These values may indicate how to write the data records to the data source.

It should be appreciated that the dataflow graph generated from a query plan is different from the query plan itself. A dataflow graph can be executed by a using graph execution environment (e.g., co-operating system <NUM> or any other suitable execution environment for executing dataflow graphs), whereas a query plan cannot be executed by the graph execution engine - it is an intermediate representation that is used to generate the dataflow graph, which dataflow graph is executed by the graph execution engine in order to execute the SQL query. A query plan is not executable and, even in the context of a relational database management system, it needs to be further processed to generate an execution strategy. By contrast, a dataflow graph is executable by the graph execution engine in order to perform the SQL query. In addition, even after further processing by a relational database system, the resulting execution strategy does not allow for reading data from and/or writing data to other types of data sources and/or data sinks, whereas dataflow graphs are not limited in this respect.

In some embodiments, the dataflow graph generated from a query plan may contain a node representing a data processing operation, which is not in the query plan. Conversely, in some embodiments, the dataflow graph generated from a query plan may not contain a node representing a data processing operation, which is in the query plan. Such situations may arise due to various optimizations which may be performed during the process of generating a dataflow graph from a query plan. In some embodiments, the dataflow graph may contain a node representing a data processing operation other than a database operation being performed on a database computer system (e.g., a relational database management system).

In some embodiments, the query plan and the dataflow graph may be embodied in different types of data structures. For example, in some embodiments, the query plan may be embodied in a directed graph in which each node has a single parent node (e.g., a tree, such as, for example, a binary tree), whereas the dataflow graph may be embodied in a directed acyclic graph, which may have at least one node that has multiple parent nodes.

It should be appreciated that process <NUM> is illustrative and that there are variations. For example, although in the illustrated embodiment of <FIG>, processing layouts for intermediate nodes are determined using a forward pass followed by a backward pass, in other embodiments, processing layouts may be determined instead by using backward pass followed by a forward pass. As another example, although in the illustrated embodiments, processing layouts for intermediate nodes were determined based on the layouts assigned to input and output nodes, the processing layout determination techniques described herein may be applied more generally. For example, processing layouts may be obtained for a set of one or more nodes in the dataflow graph and processing layouts may be obtained for other nodes in the dataflow graph based on: (<NUM>) processing layouts for obtained for the set of nodes; (<NUM>) the link structure of the dataflow graph; and (<NUM>) one or more layout determination rules. Although, the set of nodes may include the input and output nodes, it need not. Thus, the set of nodes may include any suitable number (e.g., zero, at least one, all) of input nodes, any suitable number (e.g., zero, at least one, all) of output nodes, and any suitable number of (e.g., zero, at least one, all) other nodes. The only requirement is that the set of nodes not be empty.

In some embodiments, a data processing system may: (<NUM>) receive a database query (e.g., a SQL) query; (<NUM>) transform the received database query into computer code comprising computer code portions that, when executed by the data processing system, execute the received database query; and (<NUM>) automatically determine a processing layout for executing each of the computer code portions. In some embodiments, the processing layouts for executing the computer code portions may be determined using information indicating the order of execution of the computer code portions. For example, in some embodiments, each of the computer code portions may be associated with a respective node in a dataflow graph, and the structure of the graph (e.g., as embodied in the connections among the nodes) along with the layout determination rules described herein may be used to assign processing layouts to the nodes and, by association, to the computer code portions associated with the nodes. However, it should be appreciated that in some embodiments, processing layouts for executing the computer code portions may be determined without using a dataflow graph because information indicating the order of execution of the computer code portions is not limited to being encoded in a dataflow graph and may be encoded in any other suitable way (e.g., another type of data structure or data structures), as aspects of the technology described herein are not limited in this respect.

Accordingly, in some embodiments, a data processing system may obtain (e.g., receive from a remote source and/or over a network connection, access from a local storage, etc.) computer code that, when executed by the data processing system, causes the data processing to execute a database query, wherein the computer code comprises: (A) a first set of one or more computer code portions each representing a data processing operation for reading in a respective input dataset; (B) a second set of one or more computer code portions each representing a data processing operation for writing out a respective output dataset; and (C) a third set of one or more computer code portions each representing a respective data processing operation. Next, data processing system may determine a processing layout for executing each of the computer code portions part of the computer code. For example, in some embodiments, the data processing system may: (A) obtain (e.g., receive, access, etc.) a first set of one or more processing layouts for one or more code portions in the first set of code portions; (B) obtain a second set of one or more processing layouts for one or more code portions in the second set of code portions; and (C) determine a processing layout for each code portion in the third set of code portions based on the first set of processing layouts, the second set of processing layouts, and one or more layout determination rules described herein including at least one rule for selecting among processing layouts having different degrees of parallelism.

In some embodiments, the computer code may be generated from the database query. For example, in some embodiments, a received database query (e.g., SQL query) may be converted to a query plan and the query plan may be processed to generate the computer code. For example, the query plan may be converted to a dataflow graph comprising a plurality of nodes and edges (as described above) and the computer code may include computer code portions, with each code portion comprising code for performing a data processing operation represented by a node in the dataflow graph. In this way, in some embodiments, computer code portions may be associated with respective nodes in a dataflow graph.

In some embodiments in which the computer code is associated with a dataflow graph, the nodes of the dataflow graph may include: (A) a first set of one or more nodes, each node in the first set of nodes representing a respective input dataset, wherein each computer code portion in the first set of computer code portions (described above) is associated with a respective node in the first set of nodes; (B) a second set of one or more nodes, each node in the second set of nodes representing a respective output dataset, wherein each computer code portion in the second set of computer code portions (described above) is associated with a respective node in the second set of nodes; and a third set of one or more nodes, each node in the third set of nodes representing a respective data processing operation. The data processing system may use: (<NUM>) processing layouts with the nodes in the first and second set; (<NUM>) one or more of the layout determination rules described herein; (<NUM>) and the structure of the graph (indicating an ordering among the data processing operations) to assign one or more processing layouts to node(s) in the third set of nodes. These processing layouts, in turn, may be used by the data processing system to execute the computer code portions associated with nodes in the third set of nodes.

<FIG> illustrate determining processing layouts for nodes in an illustrative dataflow graph <NUM> using one or more layout determination rules, in accordance with some embodiments of the technology described herein including the embodiments described with reference to <FIG>. Among other things, the example of <FIG> illustrates that, in some embodiments, when determining a processing layout for a node by selecting the layout from two different processing layouts having different degrees of parallelism, the processing layout having the greater degree of parallelism may be selected as the processing layout for the node.

<FIG> illustrates a dataflow graph <NUM> having: nodes <NUM> and <NUM> representing respective input datasets; nodes <NUM>, <NUM>, <NUM>, and <NUM> representing respective data processing operations; and node <NUM> representing an output dataset. As may be appreciated from the structure of dataflow graph <NUM>, the input dataset represented by node <NUM> is filtered, sorted and then joined with a filtered version of the input dataset represented by node <NUM> prior to being written to the output dataset represented by node <NUM>. In this example, after processing layouts for the input and output datasets are obtained, it may be determined that: serial processing layout SL1 is to be used for reading data from the dataset represented by node <NUM>, parallel layout PL1 is to be used for reading data from the dataset represented by node <NUM>, and serial processing layout SL2 is to be used for writing to the dataset represented by node <NUM>, as shown in <FIG>. Note that although each of serial processing layouts SL1 and SL2 indicates that the data is to be processed serially (i.e., with one degree of parallelism), these serial layouts need not be the same because the serial processing may be performed by different processors (e.g., by a processor of a database storing the input dataset represented by node <NUM> and by a processor of another database storing the output dataset represented by node <NUM>). At this stage, the processing layouts for the data processing operations represented by the nodes <NUM>, <NUM>, <NUM>, and <NUM> have not yet been determined.

<FIG> and <FIG> illustrate determining the processing layouts for the data processing operations represented by the nodes <NUM>, <NUM>, <NUM>, and <NUM> based on the processing layouts obtained for nodes <NUM>, <NUM>, and <NUM>. First, as shown in <FIG>, initial processing layouts are determined for nodes <NUM>, <NUM>, <NUM>, and <NUM> in a forward pass starting from nodes <NUM> and <NUM>, in accordance with the structure of the dataflow graph <NUM> and the layout determination rules described herein. For example, the processing layout for node <NUM> is determined based on the layout of the preceding node in the dataflow graph - node <NUM>. Then, the processing layout for node <NUM> is determined based on the layout of the node that precedes it in the dataflow graph - node <NUM>. After the processing layout for node <NUM> is determined based on the layout of its preceding node (i.e., node <NUM>) and the processing layout for node <NUM> has been determined, the processing layout for node <NUM> is determined based on the layouts of the nodes <NUM> and <NUM>, each which precedes and is connected to node <NUM> in dataflow graph <NUM>.

In this example, during the forward pass, it is determined that the serial layout SL1 of node <NUM> is to be used for performing the data processing operation represented by node <NUM> because there is no node other than node <NUM> immediately preceding node <NUM> and there is no layout already associated with node <NUM>. Then, it is determined that the layout SL1 of node <NUM> is to be used for performing the data processing operation represented by node <NUM> because there is no node other than node <NUM> preceding node <NUM> and there is no layout already associated with node <NUM>. Similarly, it is determined that parallel layout PL1 of node <NUM> is to be used for performing the data processing operation represented by node <NUM> because there is no node other than node <NUM> preceding node <NUM> and there is no layout already associated with node <NUM>. In this way, the layouts SL1 and PL1 are propagated through graph <NUM> from the input nodes <NUM> and <NUM> to any nodes for which a layout has not yet been determined and which are connected to a single preceding node (i.e., nodes <NUM>, <NUM>, and <NUM>, in this illustrative example).

During the forward pass, the processing layout for the node <NUM>, representing the join operation, is selected from the serial layout SL1 for the preceding node <NUM> and the parallel layout PL1 for the preceding node <NUM>. As shown in <FIG>, the parallel layout PL1 is selected for node <NUM> during the forward pass using the layout determination rule indicating that, when selecting between two potential different processing layouts having different degrees of parallelism, the processing layout having the greater degree of parallelism is to be selected. Since the parallel processing layout PL1 has a greater degree of parallelism than the processing layout SL1, the parallel processing layout PL1 is selected for node <NUM> during the forward pass.

Next, as shown in <FIG>, final processing layouts are determined for nodes <NUM>, <NUM>, <NUM>, and <NUM> in a backward pass starting from node <NUM>, in accordance with the structure of the dataflow graph <NUM>, the initial processing layouts shown in <FIG>, and the layout determination rules described herein. For example, the final processing layout for node <NUM> is determined based on the initial processing layout determined for node <NUM> and the layout of node <NUM>. The final processing layout for node <NUM> is determined based on the initial processing layout determined for node <NUM> and the final processing layout determined for node <NUM>. The final processing layout for node <NUM> is determined based on the initial processing layout determined for node <NUM> and the final processing layout determined for node <NUM>. The final processing layout for node <NUM> is determined based on the initial processing layout determined for node <NUM> and the final processing layout determined for node <NUM>.

In this example, during the backward pass, the final processing layout for node <NUM> is selected from the initial processing layout PL1 determined for node <NUM> during the forward pass and the serial processing layout SL2 associated with node <NUM>. As shown in <FIG>, the layout PL1 is determined to be the final processing layout for node <NUM> since layout PL1 has a greater degree of parallelism than layout SL2. The final processing layout for node <NUM> is selected from the initial layout SL1 determined for node <NUM> during the forward pass and the final processing layout PL1 determined for node <NUM> during the backward pass. As shown in <FIG>, the layout PL1 is determined to be the final processing layout for node <NUM> since layout PL1 has a greater degree of parallelism than layout SL1. The final processing layout for node <NUM> is selected from the initial layout SL1 determined for node <NUM> during the forward pass and the final processing layout PL1 determined for node <NUM> during the backward pass. As shown in <FIG>, the layout PL1 is determined to be the final processing layout for node <NUM> since layout PL1 has a greater degree of parallelism than layout SL1. The final processing layout for node <NUM> is determined to be PL1 since the initial the layout determined for node <NUM> during the forward pass is PL1 and the final layout determined for node <NUM> during the backward pass is also PL1.

After the processing layouts have been determined for each of the nodes of dataflow graph <NUM>, as shown in <FIG>, the dataflow graph <NUM> may be configured to perform one or more repartitioning operations. As described herein, the dataflow graph may be configured to perform a repartitioning operation on data records when adjacent nodes in the dataflow graph are configured to perform data processing operations on the data records using processing layouts having different degrees of parallelism. For example, as shown in <FIG>, the processing layouts for adjacent nodes <NUM> (SL1) and <NUM> (PL1) have different degrees of parallelism. The processing layouts for adjacent nodes <NUM> (PL1) and <NUM> (SL2) also have different degrees of parallelism.

In some embodiments, a dataflow graph may be configured to perform a repartitioning operation by adding a new node to the graph representing the repartitioning operation. For example, as illustrated in <FIG>, new node <NUM> representing a partition operation (e.g., a partition-by-key operation) may be added to the dataflow graph between nodes <NUM> and <NUM>. When data records are processed in accordance with the dataflow graph having node <NUM>, the data records are partitioned in accordance with the partitioning operation represented by node <NUM> after being read using the processing layout SL1 of node <NUM>, but before being filtered using the processing layout PL1 of node <NUM>. The partitioning operation may be performed in accordance with the layout SL1 of node <NUM>. In addition, as illustrated in <FIG>, new node <NUM> representing a merge operation may be added to the dataflow graph between nodes <NUM> and <NUM>. When data records are processed in accordance with the dataflow graph having node <NUM>, the data records are merged after being processed using the processing layout PL1 of node <NUM>, but before being output using the processing layout SL2 of node <NUM>. The merging operation may be performed in accordance with the layout SL2 of node <NUM>.

In the illustrative example of <FIG>, two new nodes are added to dataflow graph <NUM> to obtain dataflow graph <NUM>. It should be appreciated, however, that in some embodiments a dataflow graph may be configured to perform one or repartitioning operations without adding new nodes to the graph. In some embodiments, each of one or more existing nodes may be configured to perform a respective repartitioning operation. For example, rather than adding new node <NUM> as shown in the illustrative embodiment of <FIG>, either node <NUM> or node <NUM> may be configured to perform a partitioning operation. As another example, rather than adding new node <NUM>, as shown in the illustrative embodiment of <FIG>, either node <NUM> or node <NUM> may be configured to perform a merging operation.

<FIG> illustrate determining processing layouts for nodes in an illustrative dataflow graph <NUM> using one or more layout determination rules, in accordance with some embodiments of the technology described herein including the embodiments described with reference to <FIG>. Among other things, the example of <FIG> illustrates that, in some embodiments, when determining a processing layout for a node by selecting the layout from two processing layouts having the same degrees of parallelism, the processing layout being applied to a larger number of records may be selected as the processing layout for the node.

<FIG> illustrates a dataflow graph <NUM> having: nodes <NUM> and <NUM> representing respective input datasets; node <NUM> representing a data processing operation, and node <NUM> representing an output dataset. As may be appreciated from the structure of dataflow graph <NUM>, the input dataset having N data records and being represented by node <NUM> is joined with the input dataset having M records (with M being less than N) and being represented by node <NUM>. After the datasets are joined, they are written to output dataset represented by node <NUM>. In this example, after processing layouts for the input and output datasets are obtained, it may be determined that: parallel processing layout PL1 is to be used for reading data from the dataset represented by node <NUM>, parallel processing layout PL2 is to be used for reading data from the dataset represented by node <NUM>, and serial layout SL1 is to be used for writing data records to the output dataset represented by node <NUM>. The processing layouts PL1 and PL2 each have the same degree of parallelism. At this stage, the processing layout for the join operation represented by node <NUM> has not yet been determined.

During the forward pass, the initial processing layout is determined for node <NUM> based on the processing layouts for the nodes <NUM> and <NUM>, which precede node <NUM> in the dataflow graph <NUM>. In the illustrated example, the initial processing layout for node <NUM> is selected from among the processing layout PL1 associated with node <NUM> and the processing layout PL2 associated with node <NUM>. Even though each of the layouts PL1 and PL2 has the same degree of parallelism, the layout PL1 is selected as the initial processing layout for the node <NUM> because PL1 is being applied for processing a greater number of records N (e.g., reading N data records from the input dataset represented by node <NUM>) than layout PL2, which is being applied to processing M < N data records (e.g., reading M data records from the input dataset represented by node <NUM>). This selection may be made for purposes of efficiency because fewer data records may need to moved (e.g., M < N records) when processing the join operation represented by node <NUM> according to layout PL1 than the number of records that would have to be moved (e.g., N records) if the join operation were processed according to layout PL2.

Next, during the backwards pass, the final processing layout for node <NUM> is determined based on the initial processing layout (PL1) determined for node <NUM> and the processing layout (SL1) associated with node <NUM>. Since, layout PL1 has a greater degree of parallelism than layout SL1, PL1 is determined to be the final processing layout for the node <NUM>. Thus, after the forward and backward passes are completed, PL1 is determined to be the final processing layout for node <NUM>, as shown in <FIG>.

After the processing layouts have been determined for each of the nodes of dataflow graph <NUM>, as shown in <FIG>, the dataflow graph <NUM> may be configured to perform one or more repartitioning operations. As described herein, the dataflow graph may be configured to perform a repartitioning operation on data records when adjacent nodes in the dataflow graph are configured to perform data processing operations on the data records using processing layouts having different degrees of parallelism. For example, as shown in <FIG>, the processing layouts for adjacent nodes <NUM> (PL1) and <NUM> (SL1) have different degrees of parallelism.

As discussed herein, in some embodiments, a dataflow graph may be configured to perform a repartitioning operation by adding a new node to the graph representing the repartitioning operation. For example, as illustrated in <FIG>, new node <NUM> representing a merge operation may be added to dataflow graph <NUM> to obtain dataflow graph <NUM>. When data records are processed in accordance with the dataflow graph having node <NUM>, the data records are merged after being processed using the processing layout PL1 of node <NUM>, but before being output using the processing layout SL1 of node <NUM>. The merging operation may be performed in accordance with the layout SL1 of node <NUM>. In other embodiments, one of the existing nodes (e.g., <NUM> or <NUM>) may be configured to perform a merge operation instead of adding a new node to dataflow graph <NUM> to do so.

<FIG> illustrate determining processing layouts for nodes in an illustrative dataflow graph <NUM> using one or more layout determination rules, in accordance with some embodiments of the technology described herein including the embodiments described with reference to <FIG>. Among other things, the example of <FIG> illustrates that, in some embodiments, a processing layout may be designated as a layout for a particular node or nodes that is not to be propagated beyond the particular node(s) when determining processing layouts for other nodes.

<FIG> illustrates a dataflow graph <NUM> having: nodes <NUM> and <NUM> representing respective input datasets; nodes <NUM>, <NUM>, <NUM>, and <NUM> representing respective data processing operations; and node <NUM> representing an output dataset. As may be appreciated from the structure of dataflow graph <NUM>, the input dataset represented by node <NUM> is first filtered, then a rollup operation is performed on the filtered data and the data records obtained as a result of the rollup operation are joined with a filtered version of the input dataset represented by node <NUM> prior to being written to the output dataset represented by node <NUM>. In this example, after processing layouts for the input and output datasets are obtained, it may be determined that: parallel processing layout PL1 is to be used for reading data from the input dataset represented by node <NUM>, serial layout SL1 is to be used for reading data from the input dataset represented by node <NUM>, and serial processing layout SL2 is to be used for writing to the output dataset represented by node <NUM>, as shown in <FIG>. Additionally, in this example, an indication that the processing layout PL1 is not to be propagated to other nodes may be obtained. This indication may be obtained in any suitable way and, for example, may be obtained from a user via a graphical user interface. At this stage, the processing layouts for the data processing operations represented by the nodes <NUM>, <NUM>, <NUM>, and <NUM> have not yet been determined.

<FIG> and <FIG> illustrate determining the processing layouts for the data processing operations represented by the nodes <NUM>, <NUM>, <NUM>, and <NUM> based on the processing layouts obtained for nodes <NUM>, <NUM>, and <NUM>. First, as shown in <FIG>, initial processing layouts are determined for nodes <NUM>, <NUM>, <NUM>, and <NUM> in a forward pass starting from nodes <NUM> and <NUM>, in accordance with the structure of the dataflow graph <NUM> and the layout determination rules described herein. In this example, because an indication that the processing layout PL1 for node <NUM> is not to be propagated has been obtained, the layout PL1 is copied only to the node <NUM> representing the filtering operation (because the filtering operation is a type of operation that may be performed using the same processing layout, indeed the same computing devices, as the layout used for reading data records from the input dataset represented by node <NUM>), but not to any other nodes such as, for example, the node <NUM> representing the rollup operation.

Accordingly, during the forward pass, the initial processing layout for node <NUM> is determined to be PL1, and the initial processing layout for node <NUM> is not determined because PL1 is not propagated beyond node <NUM>. As discussed below, the processing layout for the node <NUM> will be determined in the backward pass.

Additionally, during the forward pass, the initial processing layout for node <NUM> is determined to be the serial layout SL1 of node <NUM> because there is no node other than node <NUM> immediately preceding node <NUM> and there is no layout already associated with node <NUM>. In turn, the initial processing layout SL1 for node <NUM> is also determined to be the initial processing layout for node <NUM> because, node <NUM> is the only node preceding node <NUM> that is associated with a particular layout (as described above, although node <NUM> precedes node <NUM>, it is not associated with any initial processing layout). The initial processing layouts determined as a result of a forward pass are illustrated in <FIG>. All nodes, except node <NUM>, have been assigned an initial processing layout.

Next, as shown in <FIG>, final processing layouts are determined for nodes <NUM>, <NUM>, <NUM>, and <NUM> in a backward pass starting from node <NUM>, in accordance with the structure of the dataflow graph <NUM>, the initial processing layouts shown in <FIG>, and the layout determination rules described herein. For example, the final processing layout for node <NUM> is determined based on the initial processing layout determined for node <NUM> and the processing layout associated with node <NUM>. The final processing layout for node <NUM> is determined based on the final processing layout determined for node <NUM> (no initial layout has been determined for node <NUM> in this example). The final processing layout for node <NUM> is determined based on the initial processing layout determined for node <NUM> and the final processing layout determined for node <NUM>. The final processing layout for node <NUM> is determined based on the initial processing layout determined for node <NUM> and the final processing layout determined for node <NUM>.

In this example, during the backward pass, the final processing layout for node <NUM> is selected from the initial processing layout SL1 determined for node <NUM> during the forward pass and the serial processing layout SL2 associated with node <NUM>. As shown in <FIG>, the layout SL1 is determined to be the final processing layout for node <NUM>. The final processing layout for node <NUM> is determined to be the layout SL1, as this is the final determined layout for node <NUM> and node <NUM> is not associated with any initial processing layout after the forward pass. The final processing layout for node <NUM> is determined to be PL1 (the initial layout determined for node <NUM>) because PL1 has a greater degree of parallelism than layout SL1, which is determined to be the final processing layout for node <NUM>. The final processing layout for node <NUM> is determined to be SL1 since the initial the layout determined for node <NUM> during the forward pass is SL1 and the final layout determined for node <NUM> during the backward pass is also SL1.

As discussed herein, in some embodiments, a dataflow graph may be configured to perform a repartitioning operation by adding a new node to the graph representing the repartitioning operation. For example, as illustrated in <FIG>, new node <NUM> representing a merge operation may be added to dataflow graph <NUM> to obtain dataflow graph <NUM>. When data records are processed in accordance with the dataflow graph having node <NUM>, the data records are gathered after being processed using the processing layout PL1 of node <NUM>, but before being output using the processing layout SL1 of node <NUM>. The gathering operation may be performed in accordance with the layout SL1 of node <NUM>. In other embodiments, one of the existing nodes (e.g., <NUM> or <NUM>) may be configured to perform a gather operation instead of adding a new node to dataflow graph <NUM> to do so.

<FIG> is a block diagram of an illustrative computing environment <NUM>, in which some embodiments of the technology described herein may operate. Environment <NUM> includes data processing system <NUM>, which is configured to access (e.g., read data from and/write data to) data stores <NUM>, <NUM>, <NUM>, and <NUM>. Each of data stores <NUM>, <NUM>, <NUM>, and <NUM> may store one or more datasets. A data store may store any suitable type of data in any suitable way. A data store may store data as a flat text file, a spreadsheet, using a database system (e.g., a relational database system), or in any other suitable way. In some instances, a data store may store transactional data. For example, a data store may store credit card transactions, phone records data, or bank transactions data. It should be appreciated that data processing system <NUM> may be configured to access any suitable number of data stores of any suitable type, as aspects of the technology described herein are not limited in this respect.

Data processing system includes a graphical development environment (GDE) <NUM> that provides an interface for one or more users to create dataflow graphs. The dataflow graphs created using the GDE <NUM> may be executed using co-operating system <NUM> or any other suitable execution environment for executing dataflow graphs. Aspects of graphical development environments and environments for executing dataflow graphs are described in <CIT>, titled "Executing Computations Expressed as Graphs," and in <CIT>, titled "Managing Parameters for Graph-Based Computations,". A dataflow graphs created using GDE <NUM> or obtained in any other suitable way may be stored in dataflow graph store <NUM>, which is part of data processing system <NUM>.

Data processing system <NUM> also includes parallel processing module <NUM>, which is configured to determine processing layouts for nodes in a dataflow graph prior to the execution of that dataflow graph by co-operating system <NUM>. The parallel processing module <NUM> may determine processing layouts for a node in a dataflow graph using any of the techniques described herein including, for example, the techniques described with reference to process <NUM> of <FIG>.

<FIG> illustrates an example of a suitable computing system environment <NUM> on which the technology described herein may be implemented. The computing system environment <NUM> is only one example of a suitable computing environment and is not intended to suggest any limitation as to the scope of use or functionality of the technology described herein. Neither should the computing environment <NUM> be interpreted as having any dependency or requirement relating to any one or combination of components illustrated in the exemplary operating environment <NUM>.

The technology described herein is operational with numerous other general purpose or special purpose computing system environments or configurations. Examples of well-known computing systems, environments, and/or configurations that may be suitable for use with the technology described herein include, but are not limited to, personal computers, server computers, hand-held or laptop devices, multiprocessor systems, microprocessor-based systems, set top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments that include any of the above systems or devices, and the like.

The computing environment may execute computer-executable instructions, such as program modules. The technology described herein may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.

With reference to <FIG>, an exemplary system for implementing the technology described herein includes a general purpose computing device in the form of a computer <NUM>. Components of computer <NUM> may include, but are not limited to, a processing unit <NUM>, a system memory <NUM>, and a system bus <NUM> that couples various system components including the system memory to the processing unit <NUM>. The system bus <NUM> may be any of several types of bus structures including a memory bus or memory controller, a peripheral bus, and a local bus using any of a variety of bus architectures. By way of example, and not limitation, such architectures include Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MCA) bus, Enhanced ISA (EISA) bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus also known as Mezzanine bus.

Computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can accessed by computer <NUM>. Communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media. By way of example, and not limitation, communication media includes wired media such as a wired network or direct-wired connection, and wireless media such as acoustic, RF, infrared and other wireless media. Combinations of the any of the above should also be included within the scope of computer readable media.

The computer <NUM> may also include other removable/non-removable, volatile/nonvolatile computer storage media. By way of example only, <FIG> illustrates a hard disk drive <NUM> that reads from or writes to non-removable, nonvolatile magnetic media, a flash drive <NUM> that reads from or writes to a removable, nonvolatile memory <NUM> such as flash memory, and an optical disk drive <NUM> that reads from or writes to a removable, nonvolatile optical disk <NUM> such as a CD ROM or other optical media. Other removable/non-removable, volatile/nonvolatile computer storage media that can be used in the exemplary operating environment include, but are not limited to, magnetic tape cassettes, flash memory cards, digital versatile disks, digital video tape, solid state RAM, solid state ROM, and the like. The hard disk drive <NUM> is typically connected to the system bus <NUM> through a non-removable memory interface such as interface <NUM>, and magnetic disk drive <NUM> and optical disk drive <NUM> are typically connected to the system bus <NUM> by a removable memory interface, such as interface <NUM>.

Operating system <NUM>, application programs <NUM>, other program modules <NUM>, and program data <NUM> are given different numbers here to illustrate that, at a minimum, they are different copies. A user may enter commands and information into the computer <NUM> through input devices such as a keyboard <NUM> and pointing device <NUM>, commonly referred to as a mouse, trackball or touch pad. Other input devices (not shown) may include a microphone, joystick, game pad, satellite dish, scanner, or the like. These and other input devices are often connected to the processing unit <NUM> through a user input interface <NUM> that is coupled to the system bus, but may be connected by other interface and bus structures, such as a parallel port, game port or a universal serial bus (USB). A monitor <NUM> or other type of display device is also connected to the system bus <NUM> via an interface, such as a video interface <NUM>.

The computer <NUM> may operate in a networked environment using logical connections to one or more remote computers, such as a remote computer <NUM>. The remote computer <NUM> may be a personal computer, a server, a router, a network PC, a peer device or other common network node, and typically includes many or all of the elements described above relative to the computer <NUM>, although only a memory storage device <NUM> has been illustrated in <FIG>. The logical connections depicted in <FIG> include a local area network (LAN) <NUM> and a wide area network (WAN) <NUM>, but may also include other networks. Such networking environments are commonplace in offices, enterprise-wide computer networks, intranets and the Internet.

The modem <NUM>, which may be internal or external, may be connected to the system bus <NUM> via the user input interface <NUM>, or other appropriate mechanism. In a networked environment, program modules depicted relative to the computer <NUM>, or portions thereof, may be stored in the remote memory storage device. By way of example, and not limitation, <FIG> illustrates remote application programs <NUM> as residing on memory device <NUM>. It will be appreciated that the network connections shown are exemplary and other means of establishing a communications link between the computers may be used.

Having thus described several aspects of at least one embodiment of this invention, it is to be appreciated that various alterations, modifications, and improvements will readily occur to those skilled in the art.

Such alterations, modifications, and improvements are intended to be part of this disclosure, and are intended to be within the scope of the invention, which is defined by the appended claims. Further, though advantages of the present invention are indicated, it should be appreciated that not every embodiment of the technology described herein will include every described advantage. Some embodiments may not implement any features described as advantageous herein and in some instances one or more of the described features may be implemented to achieve further embodiments. Accordingly, the foregoing description and drawings are by way of example only.

The above-described embodiments of the technology described herein can be implemented in any of numerous ways. For example, the embodiments may be implemented using hardware, software or a combination thereof. When implemented in software, the software code can be executed on any suitable processor or collection of processors, whether provided in a single computer or distributed among multiple computers. Such processors may be implemented as integrated circuits, with one or more processors in an integrated circuit component, including commercially available integrated circuit components known in the art by names such as CPU chips, GPU chips, microprocessor, microcontroller, or co-processor. Alternatively, a processor may be implemented in custom circuitry, such as an ASIC, or semicustom circuitry resulting from configuring a programmable logic device. As yet a further alternative, a processor may be a portion of a larger circuit or semiconductor device, whether commercially available, semi-custom or custom. As a specific example, some commercially available microprocessors have multiple cores such that one or a subset of those cores may constitute a processor. However, a processor may be implemented using circuitry in any suitable format.

Further, it should be appreciated that a computer may be embodied in any of a number of forms, such as a rack-mounted computer, a desktop computer, a laptop computer, or a tablet computer. Additionally, a computer may be embedded in a device not generally regarded as a computer but with suitable processing capabilities, including a Personal Digital Assistant (PDA), a smart phone or any other suitable portable or fixed electronic device.

Such computers may be interconnected by one or more networks in any suitable form, including as a local area network or a wide area network, such as an enterprise network or the Internet. Such networks may be based on any suitable technology and may operate according to any suitable protocol and may include wireless networks, wired networks or fiber optic networks.

Also, the various methods or processes outlined herein may be coded as software that is executable on one or more processors that employ any one of a variety of operating systems or platforms. Additionally, such software may be written using any of a number of suitable programming languages and/or programming or scripting tools, and also may be compiled as executable machine language code or intermediate code that is executed on a framework or virtual machine.

In this respect, the invention may be embodied as a computer readable storage medium (or multiple computer readable media) (e.g., a computer memory, one or more floppy discs, compact discs (CD), optical discs, digital video disks (DVD), magnetic tapes, flash memories, circuit configurations in Field Programmable Gate Arrays or other semiconductor devices, or other tangible computer storage medium) encoded with one or more programs that, when executed on one or more computers or other processors, perform methods that implement the various embodiments of the invention discussed above. As is apparent from the foregoing examples, a computer readable storage medium may retain information for a sufficient time to provide computer-executable instructions in a non-transitory form. Such a computer readable storage medium or media can be transportable, such that the program or programs stored thereon can be loaded onto one or more different computers or other processors to implement various aspects of the present invention as discussed above. As used herein, the term "computer-readable storage medium" encompasses only a non-transitory computer-readable medium that can be considered to be a manufacture (i.e., article of manufacture) or a machine. Alternatively or additionally, the invention may be embodied as a computer readable medium other than a computer-readable storage medium, such as a propagating signal.

The terms "program" or "software" are used herein in a generic sense to refer to any type of computer code or set of computer-executable instructions that can be employed to program a computer or other processor to implement various aspects of the present invention as discussed above. Additionally, it should be appreciated that according to one aspect of this embodiment, one or more computer programs that when executed perform methods of the present invention need not reside on a single computer or processor, but may be distributed in a modular fashion amongst a number of different computers or processors to implement various aspects of the present invention.

Such relationships may likewise be achieved by assigning storage for the fields with locations in a computer-readable medium that conveys relationship between the fields.

Various aspects of the present invention may be used alone, in combination, or in a variety of arrangements not specifically discussed in the embodiments described in the foregoing and is therefore not limited in its application to the details and arrangement of components set forth in the foregoing description or illustrated in the drawings. For example, aspects described in one embodiment may be combined in any manner with aspects described in other embodiments.

Also, the invention may be embodied as a method, of which an example has been provided. The acts performed as part of the method may be ordered in any suitable way. Accordingly, embodiments may be constructed in which acts are performed in an order different than illustrated, which may include performing some acts simultaneously, even though shown as sequential acts in illustrative embodiments.

Further, some actions are described as taken by a "user. " It should be appreciated that a "user" need not be a single individual, and that in some embodiments, actions attributable to a "user" may be performed by a team of individuals and/or an individual in combination with computer-assisted tools or other mechanisms.

Claim 1:
A computer-implemented method (<NUM>), comprising:
obtaining computer code that, when executed by at least one computer hardware processor, causes the at least one computer hardware processor to execute a database query, wherein the computer code comprises:
a first set of one or more computer code portions each representing a data processing operation for reading in a respective input dataset;
a second set of one or more computer code portions each representing a data processing operation for writing out a respective output dataset; and
a third set of one or more computer code portions each representing a respective data processing operation;
obtaining (<NUM>) a first set of one or more processing layouts for one or more code portions in the first set of code portions, wherein for each code portion in the first set of one or more computer code portions, the obtaining of the processing layout for the code portion includes:
dynamically determining a portion of the processing layout, including automatically determining the portion of the processing layout such that a degree of parallelism of the processing layout is serial, if the input dataset represented by the code portion is stored in a single storage location, or is N-way parallel, if the input dataset represented by the code portion is stored in a number of N, with N > <NUM>, storage locations;
obtaining (<NUM>) a second set of one or more processing layouts for one or more code portions in the second set of code portions, wherein for each code portion in the second set of one or more computer code portions, the obtaining of the processing layout for the code portion includes:
dynamically determining a portion of the processing layout, including automatically determining the portion of the processing layout such that a degree of parallelism of the processing layout is serial, if the output dataset represented by the code portion is stored in a single storage location, or is N-way parallel, if the output dataset represented by the code portion is stored in a number of N, with N > <NUM>, storage locations; and determining (<NUM>) a processing layout for each code portion in the third set of code portions based on the first set of processing layouts, the second set of processing layouts, and one or more layout determination rules including at least one rule for selecting among processing layouts having different degrees of parallelism.