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