I want to pass a dataset as an argument to a C++ embedded function. This code snippet seems to be working when we hardcode the dataset. The dataset is a BLOB type sprayed blk.dat file having hexadecimal data.
#ECL to C++ Mapping Documentation
inRec := { DATA1 id };
ds := DATASET([x'45', x'55'], inRec);
DATA traceDataset(DATASET(inRec) input) := EMBED(C++)
#include <stdio.h>
#include <unordered_map>
using namespace std;
#body
__lenResult = 2;
__result = (void *)(input+0);
ENDEMBED;
OUTPUT(traceDataset(ds)); //**The final output will be 4555**
I am unable to access individual bytes of this dataset within the same C++ embedded function when the dataset is provided as an input. The error message
'System error: 99: Attempt to execute an activity that has not been created'
is shown.
rawrec := RECORD
DATA1 block
END;
rawds := DATASET('~.::bitcoinraw',rawrec,FLAT);
DATA traceDataset(DATASET(rawrec) input) := EMBED(C++)
#include <stdio.h>
#include <unordered_map>
using namespace std;
#body
__lenResult = 2;
__result = (void *)(input+0);
ENDEMBED;
OUTPUT(traceDataset(rawds));
I contacted the developers and they would like you to create a JIRA ticket (https://track.hpccsystems.com) for this issue so they can debug the query. IOW, this looks like a bug that you need to report through the official channel so they can properly address it.