提交 d9580cff 编写于 作者: S shenglian zhou

runudf call scalar

上级 18943125
......@@ -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();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册