提交 df5b0bab 编写于 作者: S slzhou

fix: array[0] not supported in windows

上级 4ef6dd9e
...@@ -73,7 +73,6 @@ typedef struct SUdfDataBlock { ...@@ -73,7 +73,6 @@ typedef struct SUdfDataBlock {
SUdfColumn **udfCols; SUdfColumn **udfCols;
} SUdfDataBlock; } SUdfDataBlock;
// TODO: deprecate SUdfInterBuf.numOfResult
typedef struct SUdfInterBuf { typedef struct SUdfInterBuf {
int32_t bufLen; int32_t bufLen;
char *buf; char *buf;
......
...@@ -308,8 +308,8 @@ void udfdInitializeCPlugin(SUdfScriptPlugin *plugin) { ...@@ -308,8 +308,8 @@ void udfdInitializeCPlugin(SUdfScriptPlugin *plugin) {
plugin->udfAggMergeFunc = udfdCPluginUdfAggMerge; plugin->udfAggMergeFunc = udfdCPluginUdfAggMerge;
plugin->udfAggFinishFunc = udfdCPluginUdfAggFinish; plugin->udfAggFinishFunc = udfdCPluginUdfAggFinish;
SScriptUdfEnvItem items[0]; SScriptUdfEnvItem items[1] = {{"LD_LIBRARY_PATH", tsUdfdLdLibPath}};
plugin->openFunc(items, 0); plugin->openFunc(items, 1);
return; return;
} }
......
...@@ -12,12 +12,15 @@ DLL_EXPORT int32_t udf2_destroy() { return 0; } ...@@ -12,12 +12,15 @@ DLL_EXPORT int32_t udf2_destroy() { return 0; }
DLL_EXPORT int32_t udf2_start(SUdfInterBuf* buf) { DLL_EXPORT int32_t udf2_start(SUdfInterBuf* buf) {
*(int64_t*)(buf->buf) = 0; *(int64_t*)(buf->buf) = 0;
buf->bufLen = sizeof(double); buf->bufLen = sizeof(double);
buf->numOfResult = 0; buf->numOfResult = 1;
return 0; return 0;
} }
DLL_EXPORT int32_t udf2(SUdfDataBlock* block, SUdfInterBuf* interBuf, SUdfInterBuf* newInterBuf) { DLL_EXPORT int32_t udf2(SUdfDataBlock* block, SUdfInterBuf* interBuf, SUdfInterBuf* newInterBuf) {
double sumSquares = *(double*)interBuf->buf; double sumSquares = 0;
if (interBuf->numOfResult == 1) {
sumSquares = *(double*)interBuf->buf;
}
int8_t numNotNull = 0; int8_t numNotNull = 0;
for (int32_t i = 0; i < block->numOfCols; ++i) { for (int32_t i = 0; i < block->numOfCols; ++i) {
SUdfColumn* col = block->udfCols[i]; SUdfColumn* col = block->udfCols[i];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册