From df277167c8f175d301cb828af3608e079652d6d4 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Thu, 20 Jan 2022 16:41:42 -0500 Subject: [PATCH] TD-13120 SELECT statement data structure definition --- include/nodes/nodes.h | 18 ++++++------ source/libs/parser/inc/new_sql.y | 0 source/libs/parser/src/astTranslate.c | 18 ++++++++++++ .../src/{nodesClone.c => nodesCloneFuncs.c} | 2 +- .../src/{nodesCode.c => nodesCodeFuncs.c} | 4 +-- .../src/{nodesEqual.c => nodesEqualFuncs.c} | 6 ++-- .../{nodesTraverse.c => nodesTraverseFuncs.c} | 28 +++++++++---------- .../src/{nodesUtil.c => nodesUtilFuncs.c} | 4 +-- src/connector/go | 1 + src/connector/grafanaplugin | 1 + src/connector/hivemq-tdengine-extension | 1 + 11 files changed, 52 insertions(+), 31 deletions(-) create mode 100644 source/libs/parser/inc/new_sql.y create mode 100644 source/libs/parser/src/astTranslate.c rename source/nodes/src/{nodesClone.c => nodesCloneFuncs.c} (93%) rename source/nodes/src/{nodesCode.c => nodesCodeFuncs.c} (82%) rename source/nodes/src/{nodesEqual.c => nodesEqualFuncs.c} (95%) rename source/nodes/src/{nodesTraverse.c => nodesTraverseFuncs.c} (61%) rename source/nodes/src/{nodesUtil.c => nodesUtilFuncs.c} (86%) create mode 160000 src/connector/go create mode 160000 src/connector/grafanaplugin create mode 160000 src/connector/hivemq-tdengine-extension diff --git a/include/nodes/nodes.h b/include/nodes/nodes.h index e6b41adf14..a9ca769042 100644 --- a/include/nodes/nodes.h +++ b/include/nodes/nodes.h @@ -249,20 +249,20 @@ typedef struct SSetOperator { typedef bool (*FQueryNodeWalker)(SNode* pNode, void* pContext); -bool nodeArrayWalker(SArray* pArray, FQueryNodeWalker walker, void* pContext); -bool nodeTreeWalker(SNode* pNode, FQueryNodeWalker walker, void* pContext); +bool nodesWalkArray(SArray* pArray, FQueryNodeWalker walker, void* pContext); +bool nodesWalkNode(SNode* pNode, FQueryNodeWalker walker, void* pContext); -bool stmtWalker(SNode* pNode, FQueryNodeWalker walker, void* pContext); +bool nodesWalkStmt(SNode* pNode, FQueryNodeWalker walker, void* pContext); -bool nodeEqual(const SNode* a, const SNode* b); +bool nodesEqualNode(const SNode* a, const SNode* b); -void cloneNode(const SNode* pNode); +void nodesCloneNode(const SNode* pNode); -int32_t nodeToString(const SNode* pNode, char** pStr, int32_t* pLen); -int32_t stringToNode(const char* pStr, SNode** pNode); +int32_t nodesNodeToString(const SNode* pNode, char** pStr, int32_t* pLen); +int32_t nodesStringToNode(const char* pStr, SNode** pNode); -bool isTimeorderQuery(const SNode* pQuery); -bool isTimelineQuery(const SNode* pQuery); +bool nodesIsTimeorderQuery(const SNode* pQuery); +bool nodesIsTimelineQuery(const SNode* pQuery); #ifdef __cplusplus } diff --git a/source/libs/parser/inc/new_sql.y b/source/libs/parser/inc/new_sql.y new file mode 100644 index 0000000000..e69de29bb2 diff --git a/source/libs/parser/src/astTranslate.c b/source/libs/parser/src/astTranslate.c new file mode 100644 index 0000000000..4c649e0ecc --- /dev/null +++ b/source/libs/parser/src/astTranslate.c @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +int32_t doTranslate() { + +} diff --git a/source/nodes/src/nodesClone.c b/source/nodes/src/nodesCloneFuncs.c similarity index 93% rename from source/nodes/src/nodesClone.c rename to source/nodes/src/nodesCloneFuncs.c index 04f6df5623..2d0a6483ae 100644 --- a/source/nodes/src/nodesClone.c +++ b/source/nodes/src/nodesCloneFuncs.c @@ -15,6 +15,6 @@ #include "nodes.h" -void cloneNode(const SNode* pNode) { +void nodesCloneNode(const SNode* pNode) { } diff --git a/source/nodes/src/nodesCode.c b/source/nodes/src/nodesCodeFuncs.c similarity index 82% rename from source/nodes/src/nodesCode.c rename to source/nodes/src/nodesCodeFuncs.c index 7fe919ffe8..b31980d150 100644 --- a/source/nodes/src/nodesCode.c +++ b/source/nodes/src/nodesCodeFuncs.c @@ -15,10 +15,10 @@ #include "nodes.h" -int32_t nodeToString(const SNode* pNode, char** pStr, int32_t* pLen) { +int32_t nodesNodeToString(const SNode* pNode, char** pStr, int32_t* pLen) { } -int32_t stringToNode(const char* pStr, SNode** pNode) { +int32_t nodesStringToNode(const char* pStr, SNode** pNode) { } diff --git a/source/nodes/src/nodesEqual.c b/source/nodes/src/nodesEqualFuncs.c similarity index 95% rename from source/nodes/src/nodesEqual.c rename to source/nodes/src/nodesEqualFuncs.c index bef025fbea..236326524e 100644 --- a/source/nodes/src/nodesEqual.c +++ b/source/nodes/src/nodesEqualFuncs.c @@ -32,7 +32,7 @@ #define COMPARE_NODE_FIELD(fldname) \ do { \ - if (!nodeEqual(a->fldname, b->fldname)) \ + if (!nodesEqualNode(a->fldname, b->fldname)) \ return false; \ } while (0) @@ -57,7 +57,7 @@ static bool nodeArrayEqual(const SArray* a, const SArray* b) { size_t size = taosArrayGetSize(a); for (size_t i = 0; i < size; ++i) { - if (!nodeEqual((SNode*)taosArrayGetP(a, i), (SNode*)taosArrayGetP(b, i))) { + if (!nodesEqualNode((SNode*)taosArrayGetP(a, i), (SNode*)taosArrayGetP(b, i))) { return false; } } @@ -101,7 +101,7 @@ static bool functionNodeEqual(const SFunctionNode* a, const SFunctionNode* b) { return true; } -bool nodeEqual(const SNode* a, const SNode* b) { +bool nodesEqualNode(const SNode* a, const SNode* b) { if (a == b) { return true; } diff --git a/source/nodes/src/nodesTraverse.c b/source/nodes/src/nodesTraverseFuncs.c similarity index 61% rename from source/nodes/src/nodesTraverse.c rename to source/nodes/src/nodesTraverseFuncs.c index eac8288099..d096bbcc0d 100644 --- a/source/nodes/src/nodesTraverse.c +++ b/source/nodes/src/nodesTraverseFuncs.c @@ -17,17 +17,17 @@ typedef bool (*FQueryNodeWalker)(SNode* pNode, void* pContext); -bool nodeArrayWalker(SArray* pArray, FQueryNodeWalker walker, void* pContext) { +bool nodesWalkArray(SArray* pArray, FQueryNodeWalker walker, void* pContext) { size_t size = taosArrayGetSize(pArray); for (size_t i = 0; i < size; ++i) { - if (!nodeTreeWalker((SNode*)taosArrayGetP(pArray, i), walker, pContext)) { + if (!nodesWalkNode((SNode*)taosArrayGetP(pArray, i), walker, pContext)) { return false; } } return true; } -bool nodeTreeWalker(SNode* pNode, FQueryNodeWalker walker, void* pContext) { +bool nodesWalkNode(SNode* pNode, FQueryNodeWalker walker, void* pContext) { if (NULL == pNode) { return true; } @@ -43,34 +43,34 @@ bool nodeTreeWalker(SNode* pNode, FQueryNodeWalker walker, void* pContext) { return true; case QUERY_NODE_OPERATOR: { SOperatorNode* pOpNode = (SOperatorNode*)pNode; - if (!nodeTreeWalker(pOpNode->pLeft, walker, pContext)) { + if (!nodesWalkNode(pOpNode->pLeft, walker, pContext)) { return false; } - return nodeTreeWalker(pOpNode->pRight, walker, pContext); + return nodesWalkNode(pOpNode->pRight, walker, pContext); } case QUERY_NODE_LOGIC_CONDITION: - return nodeArrayWalker(((SLogicConditionNode*)pNode)->pParameterList, walker, pContext); + return nodesWalkArray(((SLogicConditionNode*)pNode)->pParameterList, walker, pContext); case QUERY_NODE_IS_NULL_CONDITION: - return nodeTreeWalker(((SIsNullCondNode*)pNode)->pExpr, walker, pContext); + return nodesWalkNode(((SIsNullCondNode*)pNode)->pExpr, walker, pContext); case QUERY_NODE_FUNCTION: - return nodeArrayWalker(((SFunctionNode*)pNode)->pParameterList, walker, pContext); + return nodesWalkArray(((SFunctionNode*)pNode)->pParameterList, walker, pContext); case QUERY_NODE_REAL_TABLE: case QUERY_NODE_TEMP_TABLE: return true; // todo case QUERY_NODE_JOIN_TABLE: { SJoinTableNode* pJoinTableNode = (SJoinTableNode*)pNode; - if (!nodeTreeWalker(pJoinTableNode->pLeft, walker, pContext)) { + if (!nodesWalkNode(pJoinTableNode->pLeft, walker, pContext)) { return false; } - if (!nodeTreeWalker(pJoinTableNode->pRight, walker, pContext)) { + if (!nodesWalkNode(pJoinTableNode->pRight, walker, pContext)) { return false; } - return nodeTreeWalker(pJoinTableNode->pOnCond, walker, pContext); + return nodesWalkNode(pJoinTableNode->pOnCond, walker, pContext); } case QUERY_NODE_GROUPING_SET: - return nodeArrayWalker(((SGroupingSetNode*)pNode)->pParameterList, walker, pContext); + return nodesWalkArray(((SGroupingSetNode*)pNode)->pParameterList, walker, pContext); case QUERY_NODE_ORDER_BY_EXPR: - return nodeTreeWalker(((SOrderByExprNode*)pNode)->pExpr, walker, pContext); + return nodesWalkNode(((SOrderByExprNode*)pNode)->pExpr, walker, pContext); default: break; } @@ -78,6 +78,6 @@ bool nodeTreeWalker(SNode* pNode, FQueryNodeWalker walker, void* pContext) { return false; } -bool stmtWalker(SNode* pNode, FQueryNodeWalker walker, void* pContext) { +bool nodesWalkStmt(SNode* pNode, FQueryNodeWalker walker, void* pContext) { } diff --git a/source/nodes/src/nodesUtil.c b/source/nodes/src/nodesUtilFuncs.c similarity index 86% rename from source/nodes/src/nodesUtil.c rename to source/nodes/src/nodesUtilFuncs.c index fe5883d809..5c524d2749 100644 --- a/source/nodes/src/nodesUtil.c +++ b/source/nodes/src/nodesUtilFuncs.c @@ -15,10 +15,10 @@ #include "nodes.h" -bool isTimeorderQuery(const SNode* pQuery) { +bool nodesIsTimeorderQuery(const SNode* pQuery) { } -bool isTimelineQuery(const SNode* pQuery) { +bool nodesIsTimelineQuery(const SNode* pQuery) { } diff --git a/src/connector/go b/src/connector/go new file mode 160000 index 0000000000..b8f76da4a7 --- /dev/null +++ b/src/connector/go @@ -0,0 +1 @@ +Subproject commit b8f76da4a708d158ec3cc4b844571dc4414e36b4 diff --git a/src/connector/grafanaplugin b/src/connector/grafanaplugin new file mode 160000 index 0000000000..4a4d79099b --- /dev/null +++ b/src/connector/grafanaplugin @@ -0,0 +1 @@ +Subproject commit 4a4d79099b076b8ff12d5b4fdbcba54049a6866d diff --git a/src/connector/hivemq-tdengine-extension b/src/connector/hivemq-tdengine-extension new file mode 160000 index 0000000000..ce52010141 --- /dev/null +++ b/src/connector/hivemq-tdengine-extension @@ -0,0 +1 @@ +Subproject commit ce5201014136503d34fecbd56494b67b4961056c -- GitLab