more code format
This commit is contained in:
parent
c79cc7e454
commit
c4b3da5032
|
@ -22,11 +22,11 @@ extern "C" {
|
|||
|
||||
#include "os.h"
|
||||
|
||||
#include "tname.h"
|
||||
#include "taosdef.h"
|
||||
#include "tvariant.h"
|
||||
#include "function.h"
|
||||
#include "taosdef.h"
|
||||
#include "tname.h"
|
||||
#include "tudf.h"
|
||||
#include "tvariant.h"
|
||||
|
||||
bool topbot_datablock_filter(SqlFunctionCtx *pCtx, const char *minval, const char *maxval);
|
||||
|
||||
|
|
|
@ -17,14 +17,14 @@
|
|||
#define TDENGINE_QSCRIPT_H
|
||||
|
||||
#if 0
|
||||
#include <lua.h>
|
||||
#include <lauxlib.h>
|
||||
#include <lua.h>
|
||||
#include <lualib.h>
|
||||
|
||||
#include "tutil.h"
|
||||
#include "hash.h"
|
||||
#include "tlist.h"
|
||||
#include "tudf.h"
|
||||
#include "tutil.h"
|
||||
|
||||
#define MAX_FUNC_NAME 64
|
||||
|
||||
|
|
|
@ -61,12 +61,10 @@ typedef struct SUdfCallResponse {
|
|||
SUdfInterBuf resultBuf;
|
||||
} SUdfCallResponse;
|
||||
|
||||
|
||||
typedef struct SUdfTeardownRequest {
|
||||
int64_t udfHandle;
|
||||
} SUdfTeardownRequest;
|
||||
|
||||
|
||||
typedef struct SUdfTeardownResponse {
|
||||
#ifdef WINDOWS
|
||||
size_t avoidCompilationErrors;
|
||||
|
|
|
@ -57,7 +57,6 @@ typedef struct SUdfSetupResponse {
|
|||
int64_t udfHandle;
|
||||
} SUdfSetupResponse;
|
||||
|
||||
|
||||
typedef struct SUdfCallRequest {
|
||||
int64_t udfHandle;
|
||||
int8_t step;
|
||||
|
@ -69,7 +68,6 @@ typedef struct SUdfCallRequest {
|
|||
char *state;
|
||||
} SUdfCallRequest;
|
||||
|
||||
|
||||
typedef struct SUdfCallResponse {
|
||||
int32_t outputBytes;
|
||||
char *output;
|
||||
|
@ -77,12 +75,10 @@ typedef struct SUdfCallResponse {
|
|||
char *newState;
|
||||
} SUdfCallResponse;
|
||||
|
||||
|
||||
typedef struct SUdfTeardownRequest {
|
||||
int64_t udfHandle;
|
||||
} SUdfTeardownRequest;
|
||||
|
||||
|
||||
typedef struct SUdfTeardownResponse {
|
||||
#ifdef WINDOWS
|
||||
size_t avoidCompilationErrors;
|
||||
|
|
|
@ -2977,7 +2977,8 @@ int32_t lastFunction(SqlFunctionCtx* pCtx) {
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static void firstLastTransferInfo(SqlFunctionCtx* pCtx, SFirstLastRes* pInput, SFirstLastRes* pOutput, bool isFirst, int32_t rowIndex) {
|
||||
static void firstLastTransferInfo(SqlFunctionCtx* pCtx, SFirstLastRes* pInput, SFirstLastRes* pOutput, bool isFirst,
|
||||
int32_t rowIndex) {
|
||||
SInputColumnInfoData* pColInfo = &pCtx->input;
|
||||
|
||||
if (pOutput->hasResult) {
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
|
||||
#include "os.h"
|
||||
#include "taosdef.h"
|
||||
#include "tmsg.h"
|
||||
#include "thash.h"
|
||||
#include "tmsg.h"
|
||||
#include "ttypes.h"
|
||||
|
||||
#include "function.h"
|
||||
|
@ -29,9 +29,7 @@
|
|||
#include "ttszip.h"
|
||||
#include "tudf.h"
|
||||
|
||||
void cleanupResultRowEntry(struct SResultRowEntryInfo* pCell) {
|
||||
pCell->initialized = false;
|
||||
}
|
||||
void cleanupResultRowEntry(struct SResultRowEntryInfo* pCell) { pCell->initialized = false; }
|
||||
|
||||
int32_t getNumOfResult(SqlFunctionCtx* pCtx, int32_t num, SSDataBlock* pResBlock) {
|
||||
int32_t maxRows = 0;
|
||||
|
@ -70,6 +68,4 @@ bool isRowEntryCompleted(struct SResultRowEntryInfo* pEntry) {
|
|||
return pEntry->complete;
|
||||
}
|
||||
|
||||
bool isRowEntryInitialized(struct SResultRowEntryInfo* pEntry) {
|
||||
return pEntry->initialized;
|
||||
}
|
||||
bool isRowEntryInitialized(struct SResultRowEntryInfo* pEntry) { return pEntry->initialized; }
|
||||
|
|
|
@ -14,10 +14,10 @@
|
|||
*/
|
||||
#include "os.h"
|
||||
|
||||
#include "thistogram.h"
|
||||
#include "taosdef.h"
|
||||
#include "tmsg.h"
|
||||
#include "thistogram.h"
|
||||
#include "tlosertree.h"
|
||||
#include "tmsg.h"
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
*/
|
||||
|
||||
#include "taoserror.h"
|
||||
#include "tglobal.h"
|
||||
#include "tcompare.h"
|
||||
#include "tglobal.h"
|
||||
|
||||
#include "taosdef.h"
|
||||
#include "tcompare.h"
|
||||
|
@ -25,12 +25,11 @@
|
|||
|
||||
#define DEFAULT_NUM_OF_SLOT 1024
|
||||
|
||||
int32_t getGroupId(int32_t numOfSlots, int32_t slotIndex, int32_t times) {
|
||||
return (times * numOfSlots) + slotIndex;
|
||||
}
|
||||
int32_t getGroupId(int32_t numOfSlots, int32_t slotIndex, int32_t times) { return (times * numOfSlots) + slotIndex; }
|
||||
|
||||
static SFilePage *loadDataFromFilePage(tMemBucket *pMemBucket, int32_t slotIdx) {
|
||||
SFilePage *buffer = (SFilePage *)taosMemoryCalloc(1, pMemBucket->bytes * pMemBucket->pSlots[slotIdx].info.size + sizeof(SFilePage));
|
||||
SFilePage *buffer =
|
||||
(SFilePage *)taosMemoryCalloc(1, pMemBucket->bytes * pMemBucket->pSlots[slotIdx].info.size + sizeof(SFilePage));
|
||||
|
||||
int32_t groupId = getGroupId(pMemBucket->numOfSlots, slotIdx, pMemBucket->times);
|
||||
SArray *pIdList = *(SArray **)taosHashGet(pMemBucket->groupPagesMap, &groupId, sizeof(groupId));
|
||||
|
|
|
@ -13,10 +13,10 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "os.h"
|
||||
#include "tscript.h"
|
||||
#include "ttypes.h"
|
||||
#include "os.h"
|
||||
#include "tstrbuild.h"
|
||||
#include "ttypes.h"
|
||||
//#include "queryLog.h"
|
||||
#include "ttokendef.h"
|
||||
#if 0
|
||||
|
|
|
@ -13,16 +13,18 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "uv.h"
|
||||
|
||||
#include "os.h"
|
||||
|
||||
#include "builtinsimpl.h"
|
||||
#include "fnLog.h"
|
||||
#include "functionMgt.h"
|
||||
#include "querynodes.h"
|
||||
#include "tarray.h"
|
||||
#include "tdatablock.h"
|
||||
#include "tglobal.h"
|
||||
#include "tudf.h"
|
||||
#include "tudfInt.h"
|
||||
#include "tarray.h"
|
||||
#include "tglobal.h"
|
||||
#include "tdatablock.h"
|
||||
#include "querynodes.h"
|
||||
#include "builtinsimpl.h"
|
||||
#include "functionMgt.h"
|
||||
|
||||
typedef struct SUdfdData {
|
||||
bool startCalled;
|
||||
|
@ -135,7 +137,8 @@ static int32_t udfSpawnUdfd(SUdfdData* pData) {
|
|||
JOBOBJECT_EXTENDED_LIMIT_INFORMATION limit_info;
|
||||
memset(&limit_info, 0x0, sizeof(limit_info));
|
||||
limit_info.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE;
|
||||
bool set_auto_kill_ok = SetInformationJobObject(pData->jobHandle, JobObjectExtendedLimitInformation, &limit_info, sizeof(limit_info));
|
||||
bool set_auto_kill_ok =
|
||||
SetInformationJobObject(pData->jobHandle, JobObjectExtendedLimitInformation, &limit_info, sizeof(limit_info));
|
||||
if (!set_auto_kill_ok) {
|
||||
fnError("Set job auto kill udfd failed.");
|
||||
}
|
||||
|
@ -180,8 +183,7 @@ static void udfWatchUdfd(void *args) {
|
|||
|
||||
int32_t udfStartUdfd(int32_t startDnodeId) {
|
||||
if (!tsStartUdfd) {
|
||||
fnInfo("start udfd is disabled.")
|
||||
return 0;
|
||||
fnInfo("start udfd is disabled.") return 0;
|
||||
}
|
||||
SUdfdData *pData = &udfdGlobal;
|
||||
if (pData->startCalled) {
|
||||
|
@ -212,8 +214,7 @@ int32_t udfStartUdfd(int32_t startDnodeId) {
|
|||
|
||||
int32_t udfStopUdfd() {
|
||||
SUdfdData *pData = &udfdGlobal;
|
||||
fnInfo("udfd start to stop, need cleanup:%d, spawn err:%d",
|
||||
pData->needCleanUp, pData->spawnErr);
|
||||
fnInfo("udfd start to stop, need cleanup:%d, spawn err:%d", pData->needCleanUp, pData->spawnErr);
|
||||
if (!pData->needCleanUp || atomic_load_32(&pData->stopCalled)) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -243,27 +244,22 @@ typedef void *QUEUE[2];
|
|||
#define QUEUE_NEXT_PREV(q) (QUEUE_PREV(QUEUE_NEXT(q)))
|
||||
|
||||
/* Public macros. */
|
||||
#define QUEUE_DATA(ptr, type, field) \
|
||||
((type *) ((char *) (ptr) - offsetof(type, field)))
|
||||
#define QUEUE_DATA(ptr, type, field) ((type *)((char *)(ptr)-offsetof(type, field)))
|
||||
|
||||
/* Important note: mutating the list while QUEUE_FOREACH is
|
||||
* iterating over its elements results in undefined behavior.
|
||||
*/
|
||||
#define QUEUE_FOREACH(q, h) \
|
||||
for ((q) = QUEUE_NEXT(h); (q) != (h); (q) = QUEUE_NEXT(q))
|
||||
#define QUEUE_FOREACH(q, h) for ((q) = QUEUE_NEXT(h); (q) != (h); (q) = QUEUE_NEXT(q))
|
||||
|
||||
#define QUEUE_EMPTY(q) \
|
||||
((const QUEUE *) (q) == (const QUEUE *) QUEUE_NEXT(q))
|
||||
#define QUEUE_EMPTY(q) ((const QUEUE *)(q) == (const QUEUE *)QUEUE_NEXT(q))
|
||||
|
||||
#define QUEUE_HEAD(q) \
|
||||
(QUEUE_NEXT(q))
|
||||
#define QUEUE_HEAD(q) (QUEUE_NEXT(q))
|
||||
|
||||
#define QUEUE_INIT(q) \
|
||||
do { \
|
||||
QUEUE_NEXT(q) = (q); \
|
||||
QUEUE_PREV(q) = (q); \
|
||||
} \
|
||||
while (0)
|
||||
} while (0)
|
||||
|
||||
#define QUEUE_ADD(h, n) \
|
||||
do { \
|
||||
|
@ -271,8 +267,7 @@ typedef void *QUEUE[2];
|
|||
QUEUE_NEXT_PREV(n) = QUEUE_PREV(h); \
|
||||
QUEUE_PREV(h) = QUEUE_PREV(n); \
|
||||
QUEUE_PREV_NEXT(h) = (h); \
|
||||
} \
|
||||
while (0)
|
||||
} while (0)
|
||||
|
||||
#define QUEUE_SPLIT(h, q, n) \
|
||||
do { \
|
||||
|
@ -282,8 +277,7 @@ typedef void *QUEUE[2];
|
|||
QUEUE_PREV(h) = QUEUE_PREV(q); \
|
||||
QUEUE_PREV_NEXT(h) = (h); \
|
||||
QUEUE_PREV(q) = (n); \
|
||||
} \
|
||||
while (0)
|
||||
} while (0)
|
||||
|
||||
#define QUEUE_MOVE(h, n) \
|
||||
do { \
|
||||
|
@ -293,8 +287,7 @@ typedef void *QUEUE[2];
|
|||
QUEUE *q = QUEUE_HEAD(h); \
|
||||
QUEUE_SPLIT(h, q, n); \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
} while (0)
|
||||
|
||||
#define QUEUE_INSERT_HEAD(h, q) \
|
||||
do { \
|
||||
|
@ -302,8 +295,7 @@ typedef void *QUEUE[2];
|
|||
QUEUE_PREV(q) = (h); \
|
||||
QUEUE_NEXT_PREV(q) = (q); \
|
||||
QUEUE_NEXT(h) = (q); \
|
||||
} \
|
||||
while (0)
|
||||
} while (0)
|
||||
|
||||
#define QUEUE_INSERT_TAIL(h, q) \
|
||||
do { \
|
||||
|
@ -311,22 +303,15 @@ typedef void *QUEUE[2];
|
|||
QUEUE_PREV(q) = QUEUE_PREV(h); \
|
||||
QUEUE_PREV_NEXT(q) = (q); \
|
||||
QUEUE_PREV(h) = (q); \
|
||||
} \
|
||||
while (0)
|
||||
} while (0)
|
||||
|
||||
#define QUEUE_REMOVE(q) \
|
||||
do { \
|
||||
QUEUE_PREV_NEXT(q) = QUEUE_NEXT(q); \
|
||||
QUEUE_NEXT_PREV(q) = QUEUE_PREV(q); \
|
||||
} \
|
||||
while (0)
|
||||
} while (0)
|
||||
|
||||
|
||||
enum {
|
||||
UV_TASK_CONNECT = 0,
|
||||
UV_TASK_REQ_RSP = 1,
|
||||
UV_TASK_DISCONNECT = 2
|
||||
};
|
||||
enum { UV_TASK_CONNECT = 0, UV_TASK_REQ_RSP = 1, UV_TASK_DISCONNECT = 2 };
|
||||
|
||||
int64_t gUdfTaskSeqNum = 0;
|
||||
typedef struct SUdfcFuncStub {
|
||||
|
@ -471,7 +456,8 @@ int32_t getUdfdPipeName(char* pipeName, int32_t size) {
|
|||
dnodeId[0] = '1';
|
||||
}
|
||||
#ifdef _WIN32
|
||||
snprintf(pipeName, size, "%s.%x.%s", UDF_LISTEN_PIPE_NAME_PREFIX,MurmurHash3_32(tsDataDir, strlen(tsDataDir)), dnodeId);
|
||||
snprintf(pipeName, size, "%s.%x.%s", UDF_LISTEN_PIPE_NAME_PREFIX, MurmurHash3_32(tsDataDir, strlen(tsDataDir)),
|
||||
dnodeId);
|
||||
#else
|
||||
snprintf(pipeName, size, "%s/%s%s", tsDataDir, UDF_LISTEN_PIPE_NAME_PREFIX, dnodeId);
|
||||
#endif
|
||||
|
@ -660,13 +646,9 @@ void* decodeUdfCallResponse(const void* buf, SUdfCallResponse* callRsp) {
|
|||
return (void *)buf;
|
||||
}
|
||||
|
||||
int32_t encodeUdfTeardownResponse(void** buf, const SUdfTeardownResponse* teardownRsp) {
|
||||
return 0;
|
||||
}
|
||||
int32_t encodeUdfTeardownResponse(void **buf, const SUdfTeardownResponse *teardownRsp) { return 0; }
|
||||
|
||||
void* decodeUdfTeardownResponse(const void* buf, SUdfTeardownResponse* teardownResponse) {
|
||||
return (void*)buf;
|
||||
}
|
||||
void *decodeUdfTeardownResponse(const void *buf, SUdfTeardownResponse *teardownResponse) { return (void *)buf; }
|
||||
|
||||
int32_t encodeUdfResponse(void **buf, const SUdfResponse *rsp) {
|
||||
int32_t len = 0;
|
||||
|
@ -745,9 +727,7 @@ void freeUdfColumnData(SUdfColumnData *data, SUdfColumnMeta *meta) {
|
|||
}
|
||||
}
|
||||
|
||||
void freeUdfColumn(SUdfColumn* col) {
|
||||
freeUdfColumnData(&col->colData, &col->colMeta);
|
||||
}
|
||||
void freeUdfColumn(SUdfColumn *col) { freeUdfColumnData(&col->colData, &col->colMeta); }
|
||||
|
||||
void freeUdfDataDataBlock(SUdfDataBlock *block) {
|
||||
for (int32_t i = 0; i < block->numOfCols; ++i) {
|
||||
|
@ -764,7 +744,6 @@ void freeUdfInterBuf(SUdfInterBuf *buf) {
|
|||
buf->buf = NULL;
|
||||
}
|
||||
|
||||
|
||||
int32_t convertDataBlockToUdfDataBlock(SSDataBlock *block, SUdfDataBlock *udfBlock) {
|
||||
udfBlock->numOfRows = block->info.rows;
|
||||
udfBlock->numOfCols = taosArrayGetSize(block->pDataBlock);
|
||||
|
@ -852,9 +831,7 @@ int32_t convertDataBlockToScalarParm(SSDataBlock *input, SScalarParam *output) {
|
|||
output->numOfRows = input->info.rows;
|
||||
|
||||
output->columnData = taosMemoryMalloc(sizeof(SColumnInfoData));
|
||||
memcpy(output->columnData,
|
||||
taosArrayGet(input->pDataBlock, 0),
|
||||
sizeof(SColumnInfoData));
|
||||
memcpy(output->columnData, taosArrayGet(input->pDataBlock, 0), sizeof(SColumnInfoData));
|
||||
output->colAlloced = true;
|
||||
|
||||
return 0;
|
||||
|
@ -893,7 +870,8 @@ int32_t callUdf(UdfcFuncHandle handle, int8_t callType, SSDataBlock *input, SUdf
|
|||
SSDataBlock *output, SUdfInterBuf *newState);
|
||||
int32_t doCallUdfAggInit(UdfcFuncHandle handle, SUdfInterBuf *interBuf);
|
||||
int32_t doCallUdfAggProcess(UdfcFuncHandle handle, SSDataBlock *block, SUdfInterBuf *state, SUdfInterBuf *newState);
|
||||
int32_t doCallUdfAggMerge(UdfcFuncHandle handle, SUdfInterBuf *interBuf1, SUdfInterBuf *interBuf2, SUdfInterBuf *resultBuf);
|
||||
int32_t doCallUdfAggMerge(UdfcFuncHandle handle, SUdfInterBuf *interBuf1, SUdfInterBuf *interBuf2,
|
||||
SUdfInterBuf *resultBuf);
|
||||
int32_t doCallUdfAggFinalize(UdfcFuncHandle handle, SUdfInterBuf *interBuf, SUdfInterBuf *resultData);
|
||||
int32_t doCallUdfScalarFunc(UdfcFuncHandle handle, SScalarParam *input, int32_t numOfCols, SScalarParam *output);
|
||||
int32_t callUdfScalarFunc(char *udfName, SScalarParam *input, int32_t numOfCols, SScalarParam *output);
|
||||
|
@ -932,8 +910,8 @@ int32_t acquireUdfFuncHandle(char* udfName, UdfcFuncHandle* pHandle) {
|
|||
uv_mutex_unlock(&gUdfdProxy.udfStubsMutex);
|
||||
return 0;
|
||||
} else {
|
||||
fnInfo("invalid handle for %s, refCount: %d, last ref time: %"PRId64". remove it from cache",
|
||||
udfName, foundStub->refCount, foundStub->lastRefTime);
|
||||
fnInfo("invalid handle for %s, refCount: %d, last ref time: %" PRId64 ". remove it from cache", udfName,
|
||||
foundStub->refCount, foundStub->lastRefTime);
|
||||
taosArrayRemove(gUdfdProxy.udfStubs, stubIndex);
|
||||
}
|
||||
}
|
||||
|
@ -989,8 +967,8 @@ int32_t cleanUpUdfs() {
|
|||
fnInfo("tear down udf. udf name: %s, handle: %p, ref count: %d", stub->udfName, stub->handle, stub->refCount);
|
||||
doTeardownUdf(stub->handle);
|
||||
} else {
|
||||
fnInfo("udf still in use. udf name: %s, ref count: %d, last ref time: %"PRId64", handle: %p",
|
||||
stub->udfName, stub->refCount, stub->lastRefTime, stub->handle);
|
||||
fnInfo("udf still in use. udf name: %s, ref count: %d, last ref time: %" PRId64 ", handle: %p", stub->udfName,
|
||||
stub->refCount, stub->lastRefTime, stub->handle);
|
||||
UdfcFuncHandle handle = stub->handle;
|
||||
if (handle != NULL && ((SUdfcUvSession *)handle)->udfUvPipe != NULL) {
|
||||
taosArrayPush(udfStubs, stub);
|
||||
|
@ -1020,8 +998,8 @@ int32_t callUdfScalarFunc(char *udfName, SScalarParam *input, int32_t numOfCols,
|
|||
code = TSDB_CODE_UDF_INVALID_OUTPUT_TYPE;
|
||||
} else {
|
||||
if (session->outputType != output->columnData->info.type || session->outputLen != output->columnData->info.bytes) {
|
||||
fnError("udfc scalar function calculate error. type mismatch. session type: %d(%d), output type: %d(%d)", session->outputType,
|
||||
session->outputLen, output->columnData->info.type, output->columnData->info.bytes);
|
||||
fnError("udfc scalar function calculate error. type mismatch. session type: %d(%d), output type: %d(%d)",
|
||||
session->outputType, session->outputLen, output->columnData->info.type, output->columnData->info.bytes);
|
||||
code = TSDB_CODE_UDF_INVALID_OUTPUT_TYPE;
|
||||
}
|
||||
}
|
||||
|
@ -1101,9 +1079,7 @@ int32_t udfAggProcess(struct SqlFunctionCtx *pCtx) {
|
|||
|
||||
SSDataBlock *inputBlock = blockDataExtractBlock(pTempBlock, start, numOfRows);
|
||||
|
||||
SUdfInterBuf state = {.buf = udfRes->interResBuf,
|
||||
.bufLen = session->bufSize,
|
||||
.numOfResult = udfRes->interResNum};
|
||||
SUdfInterBuf state = {.buf = udfRes->interResBuf, .bufLen = session->bufSize, .numOfResult = udfRes->interResNum};
|
||||
SUdfInterBuf newState = {0};
|
||||
|
||||
udfCode = doCallUdfAggProcess(session, inputBlock, &state, &newState);
|
||||
|
@ -1146,11 +1122,8 @@ int32_t udfAggFinalize(struct SqlFunctionCtx *pCtx, SSDataBlock* pBlock) {
|
|||
udfRes->finalResBuf = (char *)udfRes + sizeof(SUdfAggRes);
|
||||
udfRes->interResBuf = (char *)udfRes + sizeof(SUdfAggRes) + session->outputLen;
|
||||
|
||||
|
||||
SUdfInterBuf resultBuf = {0};
|
||||
SUdfInterBuf state = {.buf = udfRes->interResBuf,
|
||||
.bufLen = session->bufSize,
|
||||
.numOfResult = udfRes->interResNum};
|
||||
SUdfInterBuf state = {.buf = udfRes->interResBuf, .bufLen = session->bufSize, .numOfResult = udfRes->interResNum};
|
||||
int32_t udfCallCode = 0;
|
||||
udfCallCode = doCallUdfAggFinalize(session, &state, &resultBuf);
|
||||
if (udfCallCode != 0) {
|
||||
|
@ -1492,8 +1465,7 @@ int32_t udfcStartUvTask(SClientUvTaskNode *uvTask) {
|
|||
break;
|
||||
}
|
||||
default: {
|
||||
fnError("udfc event loop unknown task type.")
|
||||
break;
|
||||
fnError("udfc event loop unknown task type.") break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1520,12 +1492,10 @@ void udfcAsyncTaskCb(uv_async_t *async) {
|
|||
uv_sem_post(&task->taskSem);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void cleanUpUvTasks(SUdfcProxy *udfc) {
|
||||
fnDebug("clean up uv tasks")
|
||||
QUEUE wq;
|
||||
fnDebug("clean up uv tasks") QUEUE wq;
|
||||
|
||||
uv_mutex_lock(&udfc->taskQueueMutex);
|
||||
QUEUE_MOVE(&udfc->taskQueue, &wq);
|
||||
|
@ -1596,8 +1566,7 @@ int32_t udfcOpen() {
|
|||
uv_barrier_wait(&proxy->initBarrier);
|
||||
uv_mutex_init(&proxy->udfStubsMutex);
|
||||
proxy->udfStubs = taosArrayInit(8, sizeof(SUdfcFuncStub));
|
||||
fnInfo("udfc initialized")
|
||||
return 0;
|
||||
fnInfo("udfc initialized") return 0;
|
||||
}
|
||||
|
||||
int32_t udfcClose() {
|
||||
|
@ -1774,7 +1743,8 @@ int32_t doCallUdfAggProcess(UdfcFuncHandle handle, SSDataBlock *block, SUdfInter
|
|||
|
||||
// input: interbuf1, interbuf2
|
||||
// output: resultBuf
|
||||
int32_t doCallUdfAggMerge(UdfcFuncHandle handle, SUdfInterBuf *interBuf1, SUdfInterBuf *interBuf2, SUdfInterBuf *resultBuf) {
|
||||
int32_t doCallUdfAggMerge(UdfcFuncHandle handle, SUdfInterBuf *interBuf1, SUdfInterBuf *interBuf2,
|
||||
SUdfInterBuf *resultBuf) {
|
||||
int8_t callType = TSDB_UDF_CALL_AGG_MERGE;
|
||||
int32_t err = callUdf(handle, callType, NULL, interBuf1, interBuf2, NULL, resultBuf);
|
||||
return err;
|
||||
|
|
|
@ -68,8 +68,7 @@ int scalarFuncTest() {
|
|||
|
||||
SColumnInfoData *col = output.columnData;
|
||||
for (int32_t i = 0; i < output.numOfRows; ++i) {
|
||||
if (i % 100 == 0)
|
||||
fprintf(stderr, "%d\t%d\n", i, *(int32_t *)(col->pData + i * sizeof(int32_t)));
|
||||
if (i % 100 == 0) fprintf(stderr, "%d\t%d\n", i, *(int32_t *)(col->pData + i * sizeof(int32_t)));
|
||||
}
|
||||
colDataDestroy(output.columnData);
|
||||
taosMemoryFree(output.columnData);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#ifdef LINUX
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
@ -9,14 +9,9 @@
|
|||
#endif
|
||||
#include "taosudf.h"
|
||||
|
||||
DLL_EXPORT int32_t udf1_init() { return 0; }
|
||||
|
||||
DLL_EXPORT int32_t udf1_init() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
DLL_EXPORT int32_t udf1_destroy() {
|
||||
return 0;
|
||||
}
|
||||
DLL_EXPORT int32_t udf1_destroy() { return 0; }
|
||||
|
||||
DLL_EXPORT int32_t udf1(SUdfDataBlock *block, SUdfColumn *resultCol) {
|
||||
SUdfColumnMeta *meta = &resultCol->colMeta;
|
||||
|
|
|
@ -1,17 +1,13 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "taosudf.h"
|
||||
|
||||
DLL_EXPORT int32_t udf2_init() {
|
||||
return 0;
|
||||
}
|
||||
DLL_EXPORT int32_t udf2_init() { return 0; }
|
||||
|
||||
DLL_EXPORT int32_t udf2_destroy() {
|
||||
return 0;
|
||||
}
|
||||
DLL_EXPORT int32_t udf2_destroy() { return 0; }
|
||||
|
||||
DLL_EXPORT int32_t udf2_start(SUdfInterBuf* buf) {
|
||||
*(int64_t*)(buf->buf) = 0;
|
||||
|
@ -25,8 +21,7 @@ DLL_EXPORT int32_t udf2(SUdfDataBlock* block, SUdfInterBuf *interBuf, SUdfInterB
|
|||
int8_t numNotNull = 0;
|
||||
for (int32_t i = 0; i < block->numOfCols; ++i) {
|
||||
SUdfColumn* col = block->udfCols[i];
|
||||
if (!(col->colMeta.type == TSDB_DATA_TYPE_INT ||
|
||||
col->colMeta.type == TSDB_DATA_TYPE_DOUBLE)) {
|
||||
if (!(col->colMeta.type == TSDB_DATA_TYPE_INT || col->colMeta.type == TSDB_DATA_TYPE_DOUBLE)) {
|
||||
return TSDB_CODE_UDF_INVALID_INPUT;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ FORMAT_DIR_LIST=(
|
|||
"${PRJ_ROOT_DIR}/source/libs/catalog"
|
||||
"${PRJ_ROOT_DIR}/source/libs/command"
|
||||
"${PRJ_ROOT_DIR}/source/libs/executor"
|
||||
# "${PRJ_ROOT_DIR}/source/libs/function"
|
||||
"${PRJ_ROOT_DIR}/source/libs/function"
|
||||
"${PRJ_ROOT_DIR}/source/libs/index"
|
||||
"${PRJ_ROOT_DIR}/source/libs/monitor"
|
||||
"${PRJ_ROOT_DIR}/source/libs/nodes"
|
||||
|
@ -49,3 +49,5 @@ for d in ${FORMAT_DIR_LIST[@]}; do
|
|||
done
|
||||
|
||||
cd ${ORIGIN_DIR}
|
||||
|
||||
# find source/libs/ -path ./source/libs/qworker -prune -o -regex '.*\.\(cpp\|hpp\|c\|h\)' -print
|
||||
|
|
Loading…
Reference in New Issue