Record Set
Record Set
Operators
Record Set Operators
The following record set operators are supported (all require that the
files were created using identical RECORD structures
RECORD structure
):
+
Append all records from both files, independent of any
order
&
Append all records from both files, maintaining record order
on each node
-
Subtract records from a file
Example:
MyLayout := RECORD
UNSIGNED Num;
STRING Number;
END;
FirstRecSet := DATASET([{1, 'ONE'}, {2, 'Two'}, {3, 'Three'}, {4, 'Four'}], MyLayout);
SecondRecSet := DATASET([{5, 'FIVE'}, {6, 'SIX'}, {7, 'SEVEN'}, {8, 'EIGHT'}], MyLayout);
ExcludeThese := SecondRecSet(Num > 6);
WholeRecSet := FirstRecSet + SecondRecSet;
ResultSet := WholeRecSet-ExcludeThese;
OUTPUT (WholeRecSet);
OUTPUT(ResultSet);
Prefix Append Operator
(+)
(ds_list)
[, options]
)
(+)
The prefix append operator.
ds_list
A comma-delimited list of record sets to append (two or
more). All the record sets must have identical RECORD
structures.
options
Optional. A comma-delimited list of options from the list
below.
The prefix append operator (+) provides more
flexibility than the simple infix operators described above. It allows
hints and other options to be associated with the operator. Similar syntax
will be added in a future change for other infix operators.
The following options may be used:
[, UNORDERED | ORDERED(
bool ) ] [, STABLE | UNSTABLE ]
[, PARALLEL [ ( numthreads ) ] ] [, ALGORITHM( name
) ]
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.
Example:
ds_1 := (+)(ds1, ds2, UNORDERED);
//equivalent to: ds := ds1 + ds2;
ds_2 := (+)(ds1, ds2);
//equivalent to: ds := ds1 & ds2;
ds_3 := (+)(ds1, ds2, ds3);
//multiple file appends are supported