Skip to main content

Record Set Operators

The following record set operators are supported (all require that the files were created using identical RECORD structures):

+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_listA comma-delimited list of record sets to append (two or more). All the record sets must have identical RECORD structures.
optionsOptional. 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 ) ]

UNORDEREDOptional. Specifies the output record order is not significant.
ORDEREDSpecifies the significance of the output record order.
boolWhen False, specifies the output record order is not significant. When True, specifies the default output record order.
STABLEOptional. Specifies the input record order is significant.
UNSTABLEOptional. Specifies the input record order is not significant.
PARALLELOptional. Try to evaluate this activity in parallel.
numthreadsOptional. Try to evaluate this activity using numthreads threads.
ALGORITHMOptional. Override the algorithm used for this activity.
nameThe 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