adjust funcNodes init
This commit is contained in:
parent
6e1e4702a5
commit
ffc952e31e
|
@ -48,6 +48,7 @@ SBuiltinNodeDefinition funcNodes[QUERY_NODE_END] = {NULL};
|
||||||
static TdThreadOnce functionNodeInit = PTHREAD_ONCE_INIT;
|
static TdThreadOnce functionNodeInit = PTHREAD_ONCE_INIT;
|
||||||
volatile int32_t initNodeCode = -1;
|
volatile int32_t initNodeCode = -1;
|
||||||
|
|
||||||
|
|
||||||
static void setFunc(const char* name, int32_t type, int32_t nodeSize, FExecNodeToJson toJsonFunc,
|
static void setFunc(const char* name, int32_t type, int32_t nodeSize, FExecNodeToJson toJsonFunc,
|
||||||
FExecJsonToNode toNodeFunc, FExecDestoryNode destoryFunc) {
|
FExecJsonToNode toNodeFunc, FExecDestoryNode destoryFunc) {
|
||||||
funcNodes[type].name = name;
|
funcNodes[type].name = name;
|
||||||
|
@ -64,9 +65,9 @@ bool funcArrayCheck(int32_t type) {
|
||||||
nodesError("funcArrayCheck out of range type = %d", type);
|
nodesError("funcArrayCheck out of range type = %d", type);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (initNodeCode != 0) {
|
// only init once, do nothing when initNodeCode == 0
|
||||||
taosThreadOnce(&functionNodeInit, doInitNodeFuncArray);
|
taosThreadOnce(&functionNodeInit, doInitNodeFuncArray);
|
||||||
}
|
|
||||||
if (!funcNodes[type].name) {
|
if (!funcNodes[type].name) {
|
||||||
nodesError("funcArrayCheck unsupported type = %d", type);
|
nodesError("funcArrayCheck unsupported type = %d", type);
|
||||||
return false;
|
return false;
|
||||||
|
@ -7436,6 +7437,10 @@ void nodesDestroyNode(SNode* pNode) {
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static void doInitNodeFuncArray() {
|
static void doInitNodeFuncArray() {
|
||||||
|
if (initNodeCode == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setFunc("Column",
|
setFunc("Column",
|
||||||
QUERY_NODE_COLUMN,
|
QUERY_NODE_COLUMN,
|
||||||
sizeof(SColumnNode),
|
sizeof(SColumnNode),
|
||||||
|
|
Loading…
Reference in New Issue