diff --git a/source/libs/function/inc/tudf.h b/source/libs/function/inc/tudf.h index fa009833c6..45e4b2a0f5 100644 --- a/source/libs/function/inc/tudf.h +++ b/source/libs/function/inc/tudf.h @@ -125,6 +125,11 @@ int32_t teardownUdf(UdfHandle handle); typedef int32_t (*TUdfSetupFunc)(); typedef int32_t (*TUdfTeardownFunc)(); +//TODO: another way to manage memory is provide api for UDF to add data to SUdfColumnData and UDF framework will allocate memory. +// then UDF framework will free the memory +//typedef int32_t addFixedLengthColumnData(SColumnData *columnData, int rowIndex, bool isNull, int32_t colBytes, char* data); +//typedef int32_t addVariableLengthColumnData(SColumnData *columnData, int rowIndex, bool isNull, int32_t dataLen, char * data); + typedef int32_t (*TUdfFreeUdfColumnDataFunc)(SUdfColumnData* columnData); typedef int32_t (*TUdfScalarProcFunc)(SUdfDataBlock block, SUdfColumnData *resultData); diff --git a/source/libs/function/inc/tudfInt.h b/source/libs/function/inc/tudfInt.h index 20fc98a08a..7890eef8be 100644 --- a/source/libs/function/inc/tudfInt.h +++ b/source/libs/function/inc/tudfInt.h @@ -51,6 +51,7 @@ typedef struct SUdfCallRequest { SUdfDataBlock block; SUdfInterBuf interBuf; + SUdfInterBuf interBuf2; bool initFirst; } SUdfCallRequest; diff --git a/source/libs/function/src/tudf.c b/source/libs/function/src/tudf.c index 96c3756233..283dfd06bb 100644 --- a/source/libs/function/src/tudf.c +++ b/source/libs/function/src/tudf.c @@ -372,7 +372,6 @@ int32_t serializeUdfInterBuf(SUdfInterBuf *state, char *pBuf) { *(int32_t*)pBuf = state->bufLen; pBuf += sizeof(int32_t); - memcpy(pBuf, state->buf, state->bufLen); pBuf += state->bufLen; @@ -463,6 +462,8 @@ int32_t serializeUdfCallRequest(SUdfCallRequest *call, char *buf) { buf += l; l = serializeUdfInterBuf(&call->interBuf, buf); buf += l; + l = serializeUdfInterBuf(&call->interBuf2, buf); + buf += l; *(bool*)buf = call->initFirst; buf += sizeof(bool); @@ -1253,8 +1254,6 @@ int32_t callUdf(UdfHandle handle, int8_t callType, SUdfDataBlock *input, SUdfInt } } - - udfcRunUvTask(task, UV_TASK_REQ_RSP); SUdfCallResponse *rsp = &task->_call.rsp; diff --git a/source/libs/function/src/udfd.c b/source/libs/function/src/udfd.c index 27b99625fe..a1996133e7 100644 --- a/source/libs/function/src/udfd.c +++ b/source/libs/function/src/udfd.c @@ -393,6 +393,7 @@ int32_t closeUdfdClientRpc(SUdfdContext *ctx) { return 0; } + int main() { debugPrint("libuv version: %x", UV_VERSION_HEX);