hpcc-systems/HPCC-Platform — Issue #1528: Aggregate,merge codegen bug
Author: jakesmith
Created: 2012-02-13 10:20:27+00:00
State: open

The following example, which was constructed from similar code in one of David's ML queries, appears to illustrate a codegen bug, generating the method for mergeAggregate:

rec := RECORD
unsigned x;
unsigned value;
END;

ds := DATASET([{1,1},{2,2},{3,3}], rec); dds := DISTRIBUTE(ds, x) :
PERSIST('dds');

a := AGGREGATE(dds, rec, TRANSFORM(rec, SELF.value := IF(RIGHT.x<>0,

LEFT.Value*RIGHT.Value, LEFT.Value), SELF := LEFT),
TRANSFORM(rec,
SELF.value := RIGHT1.Value*RIGHT2.Value, SELF := RIGHT2));

OUTPUT(a);

This works on hthor or a 1-way Thor, but if/when it needs the merge, the results are invalid, because the mergeAggregate method is generated as follows:

virtual size32_t mergeAggregate(ARowBuilder & crSelf, const void *
_right) {
unsigned char * right = (unsigned char *) _right;
return 16;
}

i.e. leaving crSelf untouched...

@ghalliday