COMBINE( leftrecset, rightrecset [, transform ][,LOCAL])
COMBINE( leftrecset, rightrecset, GROUP , transform [,LOCAL] [, UNORDERED | ORDERED( bool ) ] [, STABLE | UNSTABLE ] [, PARALLEL [ ( numthreads ) ] ] [, ALGORITHM( name ) ] )
| leftrecset | The LEFT record set. |
| rightrecset | The RIGHT record set. |
| transform | The TRANSFORM function call. If omitted, COMBINE returns all fields from both the leftrecset and rightrecset, with the second of any duplicate named fields removed. |
| LOCAL | The LOCAL option is required when COMBINE Form 1 is used on Thor. In Thor, COMBINE is evaluated locally, so matching is performed within each node or partition, not only across the global totals. In hThor and Roxie, LOCAL behavior is ignored. |
| GROUP | Specifies the rightrecset has been GROUPed. If this is not the case, an error occurs. |
| UNORDERED | Optional. Specifies the output record order is not significant. |
| ORDERED | Specifies the significance of the output record order. |
| bool | When False, specifies the output record order is not significant. When True, specifies the default output record order. |
| STABLE | Optional. Specifies the input record order is significant. |
| UNSTABLE | Optional. Specifies the input record order is not significant. |
| PARALLEL | Optional. Try to evaluate this activity in parallel. |
| numthreads | Optional. Try to evaluate this activity using numthreads threads. |
| ALGORITHM | Optional. Override the algorithm used for this activity. |
| name | The algorithm to use for this activity. Must be from the list of supported algorithms for the SORT function's STABLE and UNSTABLE options. |
| Return: | COMBINE returns a record set. |
The COMBINE function combines leftrecset and rightrecset on a record-by-record basis in the order in which they appear in each.
On Thor, COMBINE only supports the LOCAL form; there is no global (non-LOCAL) implementation and none is currently planned. This means the leftrecset and rightrecset must each contain the same number of records on each node, not merely the same total number of records overall. A "mismatched input row count for Combine" error indicates that the per-node record counts do not match, even if the overall counts are equal. This restriction applies to both Form 1 and Form 2 of COMBINE. On hThor and Roxie, LOCAL is ignored (since those engines always operate on a single node), so the record counts only need to match overall.
For form 1, the transform function must take at least two parameters: a LEFT record which must be in the same format as the leftrecset and a RIGHT record which must be in the same format as the rightrecset. The format of the resulting record set may be different from the inputs.
For form 2, the transform function must take at least three parameters: a LEFT record which must be in the same format as the leftrecset, a RIGHT record which must be in the same format as the rightrecset, and a ROWS(RIGHT) whose format must be a DATASET(RECORDOF(rightrecset)) parameter. The format of the resulting record set may be different from the inputs.