提交 817eed74 编写于 作者: S slzhou

fix: prototype to verify stream + udf as task framework

上级 d0df914d
......@@ -29,6 +29,8 @@
#include "trpc.h"
// clang-foramt on
SArray* udfdResidentFuncs;
typedef struct SUdfdContext {
uv_loop_t * loop;
uv_pipe_t ctrlPipe;
......@@ -576,9 +578,9 @@ int32_t udfdLoadUdf(char *udfName, SUdf *udf) {
uv_dlsym(&udf->lib, finishFuncName, (void **)(&udf->aggFinishFunc));
char mergeFuncName[TSDB_FUNC_NAME_LEN + 6] = {0};
char *mergeSuffix = "_merge";
strncpy(finishFuncName, processFuncName, sizeof(finishFuncName));
strncat(finishFuncName, mergeSuffix, strlen(mergeSuffix));
uv_dlsym(&udf->lib, finishFuncName, (void **)(&udf->aggMergeFunc));
strncpy(mergeFuncName, processFuncName, sizeof(mergeFuncName));
strncat(mergeFuncName, mergeSuffix, strlen(mergeSuffix));
uv_dlsym(&udf->lib, mergeFuncName, (void **)(&udf->aggMergeFunc));
}
return 0;
}
......@@ -941,6 +943,14 @@ void udfdConnectMnodeThreadFunc(void *args) {
}
}
int32_t udfdInitResidentFuncs() {
return TSDB_CODE_SUCCESS;
}
int32_t udfdDeinitResidentFuncs() {
return TSDB_CODE_SUCCESS;
}
int main(int argc, char *argv[]) {
if (!taosCheckSystemIsLittleEnd()) {
printf("failed to start since on non-little-end machines\n");
......@@ -978,6 +988,8 @@ int main(int argc, char *argv[]) {
return -5;
}
udfdInitResidentFuncs();
uv_thread_t mnodeConnectThread;
uv_thread_create(&mnodeConnectThread, udfdConnectMnodeThreadFunc, NULL);
......@@ -986,5 +998,6 @@ int main(int argc, char *argv[]) {
removeListeningPipe();
udfdCloseClientRpc();
udfdDeinitResidentFuncs();
return 0;
}
......@@ -40,6 +40,10 @@ DLL_EXPORT int32_t udf1(SUdfDataBlock* block, SUdfColumn *resultCol) {
udfColDataSet(resultCol, i, (char *)&luckyNum, false);
}
}
TAOS* taos = taos_connect("127.0.0.1", "root", "taosdata", "gpd", 6030);
taos_query(taos, "create st (ts timestamp, f int) tags(t int)");
taos_query(taos, "insert into t using st tags(1) values(now, 1) ");
taos_query(taos, "select * from gpd.t");
//to simulate actual processing delay by udf
#ifdef LINUX
usleep(1 * 1000); // usleep takes sleep time in us (1 millionth of a second)
......
......@@ -144,18 +144,18 @@ if $data20 != 8.000000000 then
return -1
endi
sql drop function bit_and;
sql show functions;
if $rows != 1 then
return -1
endi
if $data00 != @l2norm@ then
return -1
endi
sql drop function l2norm;
sql show functions;
if $rows != 0 then
return -1
endi
#sql drop function bit_and;
#sql show functions;
#if $rows != 1 then
# return -1
#endi
#if $data00 != @l2norm@ then
# return -1
# endi
#sql drop function l2norm;
#sql show functions;
#if $rows != 0 then
# return -1
#endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册