runudf call scalar
This commit is contained in:
parent
18943125f4
commit
d9580cff53
|
@ -5,6 +5,7 @@
|
|||
#include "uv.h"
|
||||
#include "os.h"
|
||||
#include "tudf.h"
|
||||
#include "tdatablock.h"
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
startUdfService();
|
||||
|
@ -23,17 +24,25 @@ int main(int argc, char *argv[]) {
|
|||
SEpSet epSet;
|
||||
setupUdf("udf1", &epSet, &handle);
|
||||
|
||||
//char state[5000000] = "state";
|
||||
//char input[5000000] = "input";
|
||||
int dataSize = 500;
|
||||
int callCount = 2;
|
||||
if (argc > 1) dataSize = atoi(argv[1]);
|
||||
if (argc > 2) callCount = atoi(argv[2]);
|
||||
char *state = taosMemoryMalloc(dataSize);
|
||||
char *input = taosMemoryMalloc(dataSize);
|
||||
//todo: call udf
|
||||
taosMemoryFree(state);
|
||||
taosMemoryFree(input);
|
||||
SSDataBlock block = {0};
|
||||
SSDataBlock* pBlock = █
|
||||
pBlock->pDataBlock = taosArrayInit(1, sizeof(SColumnInfoData));
|
||||
pBlock->info.numOfCols = 1;
|
||||
pBlock->info.rows = 4;
|
||||
for (int32_t i = 0; i < pBlock->info.numOfCols; ++i) {
|
||||
SColumnInfoData colInfo = {0};
|
||||
colInfo.info.type = TSDB_DATA_TYPE_INT;
|
||||
colInfo.info.bytes = sizeof(int32_t);
|
||||
colInfo.info.colId = 1;
|
||||
for (int32_t j = 0; j < pBlock->info.rows; ++j) {
|
||||
colDataAppendInt32(&colInfo, j, &j);
|
||||
}
|
||||
taosArrayPush(pBlock->pDataBlock, &colInfo);
|
||||
}
|
||||
|
||||
SSDataBlock output = {0};
|
||||
callUdfScalaProcess(handle, pBlock, &output);
|
||||
|
||||
teardownUdf(handle);
|
||||
|
||||
stopUdfService();
|
||||
|
|
Loading…
Reference in New Issue