未验证 提交 20a279e6 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #17605 from taosdata/fix/3.0_bugfix_wxy

fix: wrong permissions of 'show variables' command
...@@ -164,9 +164,9 @@ ...@@ -164,9 +164,9 @@
#define TK_SCORES 146 #define TK_SCORES 146
#define TK_TOPICS 147 #define TK_TOPICS 147
#define TK_VARIABLES 148 #define TK_VARIABLES 148
#define TK_BNODES 149 #define TK_CLUSTER 149
#define TK_SNODES 150 #define TK_BNODES 150
#define TK_CLUSTER 151 #define TK_SNODES 151
#define TK_TRANSACTIONS 152 #define TK_TRANSACTIONS 152
#define TK_DISTRIBUTED 153 #define TK_DISTRIBUTED 153
#define TK_CONSUMERS 154 #define TK_CONSUMERS 154
......
...@@ -274,6 +274,7 @@ typedef struct SShowTableDistributedStmt { ...@@ -274,6 +274,7 @@ typedef struct SShowTableDistributedStmt {
typedef struct SShowDnodeVariablesStmt { typedef struct SShowDnodeVariablesStmt {
ENodeType type; ENodeType type;
SNode* pDnodeId; SNode* pDnodeId;
SNode* pLikePattern;
} SShowDnodeVariablesStmt; } SShowDnodeVariablesStmt;
typedef struct SShowVnodesStmt { typedef struct SShowVnodesStmt {
......
...@@ -230,8 +230,8 @@ static const SSysDbTableSchema transSchema[] = { ...@@ -230,8 +230,8 @@ static const SSysDbTableSchema transSchema[] = {
}; };
static const SSysDbTableSchema configSchema[] = { static const SSysDbTableSchema configSchema[] = {
{.name = "name", .bytes = TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, {.name = "name", .bytes = TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
{.name = "value", .bytes = TSDB_CONFIG_VALUE_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, {.name = "value", .bytes = TSDB_CONFIG_VALUE_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
}; };
static const SSysDbTableSchema variablesSchema[] = { static const SSysDbTableSchema variablesSchema[] = {
...@@ -282,7 +282,7 @@ static const SSysTableMeta infosMeta[] = { ...@@ -282,7 +282,7 @@ static const SSysTableMeta infosMeta[] = {
{TSDB_INS_TABLE_USERS, userUsersSchema, tListLen(userUsersSchema), false}, {TSDB_INS_TABLE_USERS, userUsersSchema, tListLen(userUsersSchema), false},
{TSDB_INS_TABLE_LICENCES, grantsSchema, tListLen(grantsSchema), true}, {TSDB_INS_TABLE_LICENCES, grantsSchema, tListLen(grantsSchema), true},
{TSDB_INS_TABLE_VGROUPS, vgroupsSchema, tListLen(vgroupsSchema), true}, {TSDB_INS_TABLE_VGROUPS, vgroupsSchema, tListLen(vgroupsSchema), true},
{TSDB_INS_TABLE_CONFIGS, configSchema, tListLen(configSchema), true}, {TSDB_INS_TABLE_CONFIGS, configSchema, tListLen(configSchema), false},
{TSDB_INS_TABLE_DNODE_VARIABLES, variablesSchema, tListLen(variablesSchema), true}, {TSDB_INS_TABLE_DNODE_VARIABLES, variablesSchema, tListLen(variablesSchema), true},
{TSDB_INS_TABLE_TOPICS, topicSchema, tListLen(topicSchema), false}, {TSDB_INS_TABLE_TOPICS, topicSchema, tListLen(topicSchema), false},
{TSDB_INS_TABLE_SUBSCRIPTIONS, subscriptionSchema, tListLen(subscriptionSchema), false}, {TSDB_INS_TABLE_SUBSCRIPTIONS, subscriptionSchema, tListLen(subscriptionSchema), false},
......
...@@ -203,7 +203,6 @@ int32_t nodesReleaseAllocator(int64_t allocatorId) { ...@@ -203,7 +203,6 @@ int32_t nodesReleaseAllocator(int64_t allocatorId) {
return taosReleaseRef(g_allocatorReqRefPool, allocatorId); return taosReleaseRef(g_allocatorReqRefPool, allocatorId);
} }
int64_t nodesMakeAllocatorWeakRef(int64_t allocatorId) { int64_t nodesMakeAllocatorWeakRef(int64_t allocatorId) {
if (allocatorId <= 0) { if (allocatorId <= 0) {
return 0; return 0;
...@@ -936,6 +935,7 @@ void nodesDestroyNode(SNode* pNode) { ...@@ -936,6 +935,7 @@ void nodesDestroyNode(SNode* pNode) {
} }
case QUERY_NODE_SHOW_DNODE_VARIABLES_STMT: case QUERY_NODE_SHOW_DNODE_VARIABLES_STMT:
nodesDestroyNode(((SShowDnodeVariablesStmt*)pNode)->pDnodeId); nodesDestroyNode(((SShowDnodeVariablesStmt*)pNode)->pDnodeId);
nodesDestroyNode(((SShowDnodeVariablesStmt*)pNode)->pLikePattern);
break; break;
case QUERY_NODE_SHOW_CREATE_DATABASE_STMT: case QUERY_NODE_SHOW_CREATE_DATABASE_STMT:
taosMemoryFreeClear(((SShowCreateDatabaseStmt*)pNode)->pCfg); taosMemoryFreeClear(((SShowCreateDatabaseStmt*)pNode)->pCfg);
......
...@@ -176,7 +176,7 @@ SNode* createShowStmtWithCond(SAstCreateContext* pCxt, ENodeType type, SNode* pD ...@@ -176,7 +176,7 @@ SNode* createShowStmtWithCond(SAstCreateContext* pCxt, ENodeType type, SNode* pD
SNode* createShowCreateDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName); SNode* createShowCreateDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName);
SNode* createShowCreateTableStmt(SAstCreateContext* pCxt, ENodeType type, SNode* pRealTable); SNode* createShowCreateTableStmt(SAstCreateContext* pCxt, ENodeType type, SNode* pRealTable);
SNode* createShowTableDistributedStmt(SAstCreateContext* pCxt, SNode* pRealTable); SNode* createShowTableDistributedStmt(SAstCreateContext* pCxt, SNode* pRealTable);
SNode* createShowDnodeVariablesStmt(SAstCreateContext* pCxt, SNode* pDnodeId); SNode* createShowDnodeVariablesStmt(SAstCreateContext* pCxt, SNode* pDnodeId, SNode* pLikePattern);
SNode* createShowVnodesStmt(SAstCreateContext* pCxt, SNode* pDnodeId, SNode* pDnodeEndpoint); SNode* createShowVnodesStmt(SAstCreateContext* pCxt, SNode* pDnodeId, SNode* pDnodeEndpoint);
SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const SToken* pPassword, int8_t sysinfo); SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const SToken* pPassword, int8_t sysinfo);
SNode* createAlterUserStmt(SAstCreateContext* pCxt, SToken* pUserName, int8_t alterType, const SToken* pVal); SNode* createAlterUserStmt(SAstCreateContext* pCxt, SToken* pUserName, int8_t alterType, const SToken* pVal);
......
...@@ -410,8 +410,9 @@ cmd ::= SHOW QUERIES. ...@@ -410,8 +410,9 @@ cmd ::= SHOW QUERIES.
cmd ::= SHOW SCORES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); } cmd ::= SHOW SCORES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); }
cmd ::= SHOW TOPICS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); } cmd ::= SHOW TOPICS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); }
cmd ::= SHOW VARIABLES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT); } cmd ::= SHOW VARIABLES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT); }
cmd ::= SHOW CLUSTER VARIABLES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT); }
cmd ::= SHOW LOCAL VARIABLES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); } cmd ::= SHOW LOCAL VARIABLES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); }
cmd ::= SHOW DNODE NK_INTEGER(A) VARIABLES. { pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &A)); } cmd ::= SHOW DNODE NK_INTEGER(A) VARIABLES like_pattern_opt(B). { pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &A), B); }
cmd ::= SHOW BNODES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); } cmd ::= SHOW BNODES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); }
cmd ::= SHOW SNODES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); } cmd ::= SHOW SNODES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); }
cmd ::= SHOW CLUSTER. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); } cmd ::= SHOW CLUSTER. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); }
......
...@@ -1372,11 +1372,12 @@ SNode* createShowTableDistributedStmt(SAstCreateContext* pCxt, SNode* pRealTable ...@@ -1372,11 +1372,12 @@ SNode* createShowTableDistributedStmt(SAstCreateContext* pCxt, SNode* pRealTable
return (SNode*)pStmt; return (SNode*)pStmt;
} }
SNode* createShowDnodeVariablesStmt(SAstCreateContext* pCxt, SNode* pDnodeId) { SNode* createShowDnodeVariablesStmt(SAstCreateContext* pCxt, SNode* pDnodeId, SNode* pLikePattern) {
CHECK_PARSER_STATUS(pCxt); CHECK_PARSER_STATUS(pCxt);
SShowDnodeVariablesStmt* pStmt = (SShowDnodeVariablesStmt*)nodesMakeNode(QUERY_NODE_SHOW_DNODE_VARIABLES_STMT); SShowDnodeVariablesStmt* pStmt = (SShowDnodeVariablesStmt*)nodesMakeNode(QUERY_NODE_SHOW_DNODE_VARIABLES_STMT);
CHECK_OUT_OF_MEM(pStmt); CHECK_OUT_OF_MEM(pStmt);
pStmt->pDnodeId = pDnodeId; pStmt->pDnodeId = pDnodeId;
pStmt->pLikePattern = pLikePattern;
return (SNode*)pStmt; return (SNode*)pStmt;
} }
......
...@@ -484,11 +484,6 @@ static int32_t collectMetaKeyFromShowQueries(SCollectMetaKeyCxt* pCxt, SShowStmt ...@@ -484,11 +484,6 @@ static int32_t collectMetaKeyFromShowQueries(SCollectMetaKeyCxt* pCxt, SShowStmt
pCxt->pMetaCache); pCxt->pMetaCache);
} }
static int32_t collectMetaKeyFromShowConfigs(SCollectMetaKeyCxt* pCxt, SShowStmt* pStmt) {
return reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_CONFIGS,
pCxt->pMetaCache);
}
static int32_t collectMetaKeyFromShowVariables(SCollectMetaKeyCxt* pCxt, SShowStmt* pStmt) { static int32_t collectMetaKeyFromShowVariables(SCollectMetaKeyCxt* pCxt, SShowStmt* pStmt) {
return reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_CONFIGS, return reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_CONFIGS,
pCxt->pMetaCache); pCxt->pMetaCache);
......
...@@ -125,7 +125,6 @@ static int32_t authQuery(SAuthCxt* pCxt, SNode* pStmt) { ...@@ -125,7 +125,6 @@ static int32_t authQuery(SAuthCxt* pCxt, SNode* pStmt) {
case QUERY_NODE_SHOW_CLUSTER_STMT: case QUERY_NODE_SHOW_CLUSTER_STMT:
case QUERY_NODE_SHOW_LICENCES_STMT: case QUERY_NODE_SHOW_LICENCES_STMT:
case QUERY_NODE_SHOW_VGROUPS_STMT: case QUERY_NODE_SHOW_VGROUPS_STMT:
case QUERY_NODE_SHOW_VARIABLES_STMT:
case QUERY_NODE_SHOW_CREATE_DATABASE_STMT: case QUERY_NODE_SHOW_CREATE_DATABASE_STMT:
case QUERY_NODE_SHOW_TABLE_DISTRIBUTED_STMT: case QUERY_NODE_SHOW_TABLE_DISTRIBUTED_STMT:
case QUERY_NODE_SHOW_VNODES_STMT: case QUERY_NODE_SHOW_VNODES_STMT:
......
...@@ -6259,16 +6259,28 @@ static int32_t rewriteShowStableTags(STranslateContext* pCxt, SQuery* pQuery) { ...@@ -6259,16 +6259,28 @@ static int32_t rewriteShowStableTags(STranslateContext* pCxt, SQuery* pQuery) {
} }
static int32_t rewriteShowDnodeVariables(STranslateContext* pCxt, SQuery* pQuery) { static int32_t rewriteShowDnodeVariables(STranslateContext* pCxt, SQuery* pQuery) {
SSelectStmt* pStmt = NULL; SShowDnodeVariablesStmt* pStmt = (SShowDnodeVariablesStmt*)pQuery->pRoot;
int32_t code = createSelectStmtForShow(nodeType(pQuery->pRoot), &pStmt); SNode* pDnodeCond = NULL;
SNode* pLikeCond = NULL;
SSelectStmt* pSelect = NULL;
int32_t code = createSelectStmtForShow(nodeType(pQuery->pRoot), &pSelect);
if (TSDB_CODE_SUCCESS == code) {
code = createOperatorNode(OP_TYPE_EQUAL, "dnode_id", pStmt->pDnodeId, &pDnodeCond);
}
if (TSDB_CODE_SUCCESS == code) {
code = createOperatorNode(OP_TYPE_LIKE, "name", pStmt->pLikePattern, &pLikeCond);
}
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = createOperatorNode(OP_TYPE_EQUAL, "dnode_id", ((SShowDnodeVariablesStmt*)pQuery->pRoot)->pDnodeId, if (NULL != pLikeCond) {
&pStmt->pWhere); code = createLogicCondNode(pDnodeCond, pLikeCond, &pSelect->pWhere);
} else {
pSelect->pWhere = pDnodeCond;
}
} }
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
pQuery->showRewrite = true; pQuery->showRewrite = true;
nodesDestroyNode(pQuery->pRoot); nodesDestroyNode(pQuery->pRoot);
pQuery->pRoot = (SNode*)pStmt; pQuery->pRoot = (SNode*)pSelect;
} }
return code; return code;
} }
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
...@@ -100,6 +100,8 @@ TEST_F(ParserShowToUseTest, showDnodeVariables) { ...@@ -100,6 +100,8 @@ TEST_F(ParserShowToUseTest, showDnodeVariables) {
useDb("root", "test"); useDb("root", "test");
run("SHOW DNODE 1 VARIABLES"); run("SHOW DNODE 1 VARIABLES");
run("SHOW DNODE 1 VARIABLES LIKE '%debug%'");
} }
TEST_F(ParserShowToUseTest, showFunctions) { TEST_F(ParserShowToUseTest, showFunctions) {
......
...@@ -2365,7 +2365,7 @@ static int32_t mergeProjectsOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLog ...@@ -2365,7 +2365,7 @@ static int32_t mergeProjectsOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLog
return mergeProjectsOptimizeImpl(pCxt, pLogicSubplan, pProjectNode); return mergeProjectsOptimizeImpl(pCxt, pLogicSubplan, pProjectNode);
} }
static bool tagScanMayBeOptimized(SLogicNode* pNode) { static bool tagScanOptShouldBeOptimized(SLogicNode* pNode) {
if (QUERY_NODE_LOGIC_PLAN_SCAN != nodeType(pNode) || (SCAN_TYPE_TAG == ((SScanLogicNode*)pNode)->scanType)) { if (QUERY_NODE_LOGIC_PLAN_SCAN != nodeType(pNode) || (SCAN_TYPE_TAG == ((SScanLogicNode*)pNode)->scanType)) {
return false; return false;
} }
...@@ -2397,7 +2397,7 @@ static bool tagScanMayBeOptimized(SLogicNode* pNode) { ...@@ -2397,7 +2397,7 @@ static bool tagScanMayBeOptimized(SLogicNode* pNode) {
} }
static int32_t tagScanOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan) { static int32_t tagScanOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan) {
SScanLogicNode* pScanNode = (SScanLogicNode*)optFindPossibleNode(pLogicSubplan->pNode, tagScanMayBeOptimized); SScanLogicNode* pScanNode = (SScanLogicNode*)optFindPossibleNode(pLogicSubplan->pNode, tagScanOptShouldBeOptimized);
if (NULL == pScanNode) { if (NULL == pScanNode) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
...@@ -2440,6 +2440,29 @@ static int32_t tagScanOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubp ...@@ -2440,6 +2440,29 @@ static int32_t tagScanOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubp
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static bool pushDownLimitOptShouldBeOptimized(SLogicNode* pNode) {
if (NULL == pNode->pLimit || 1 != LIST_LENGTH(pNode->pChildren) ||
QUERY_NODE_LOGIC_PLAN_SCAN != nodeType(nodesListGetNode(pNode->pChildren, 0))) {
return false;
}
return true;
}
static int32_t pushDownLimitOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan) {
SLogicNode* pNode = optFindPossibleNode(pLogicSubplan->pNode, pushDownLimitOptShouldBeOptimized);
if (NULL == pNode) {
return TSDB_CODE_SUCCESS;
}
SLogicNode* pChild = (SLogicNode*)nodesListGetNode(pNode->pChildren, 0);
nodesDestroyNode(pChild->pLimit);
pChild->pLimit = pNode->pLimit;
pNode->pLimit = NULL;
pCxt->optimized = true;
return TSDB_CODE_SUCCESS;
}
// clang-format off // clang-format off
static const SOptimizeRule optimizeRuleSet[] = { static const SOptimizeRule optimizeRuleSet[] = {
{.pName = "ScanPath", .optimizeFunc = scanPathOptimize}, {.pName = "ScanPath", .optimizeFunc = scanPathOptimize},
...@@ -2453,7 +2476,8 @@ static const SOptimizeRule optimizeRuleSet[] = { ...@@ -2453,7 +2476,8 @@ static const SOptimizeRule optimizeRuleSet[] = {
{.pName = "RewriteTail", .optimizeFunc = rewriteTailOptimize}, {.pName = "RewriteTail", .optimizeFunc = rewriteTailOptimize},
{.pName = "RewriteUnique", .optimizeFunc = rewriteUniqueOptimize}, {.pName = "RewriteUnique", .optimizeFunc = rewriteUniqueOptimize},
{.pName = "LastRowScan", .optimizeFunc = lastRowScanOptimize}, {.pName = "LastRowScan", .optimizeFunc = lastRowScanOptimize},
{.pName = "TagScan", .optimizeFunc = tagScanOptimize} {.pName = "TagScan", .optimizeFunc = tagScanOptimize},
// {.pName = "PushDownLimit", .optimizeFunc = pushDownLimitOptimize}
}; };
// clang-format on // clang-format on
......
...@@ -84,6 +84,7 @@ static int32_t splCreateExchangeNode(SSplitContext* pCxt, SLogicNode* pChild, SE ...@@ -84,6 +84,7 @@ static int32_t splCreateExchangeNode(SSplitContext* pCxt, SLogicNode* pChild, SE
if (NULL == pExchange) { if (NULL == pExchange) {
return TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY;
} }
pExchange->srcStartGroupId = pCxt->groupId; pExchange->srcStartGroupId = pCxt->groupId;
pExchange->srcEndGroupId = pCxt->groupId; pExchange->srcEndGroupId = pCxt->groupId;
pExchange->node.precision = pChild->precision; pExchange->node.precision = pChild->precision;
...@@ -91,6 +92,13 @@ static int32_t splCreateExchangeNode(SSplitContext* pCxt, SLogicNode* pChild, SE ...@@ -91,6 +92,13 @@ static int32_t splCreateExchangeNode(SSplitContext* pCxt, SLogicNode* pChild, SE
if (NULL == pExchange->node.pTargets) { if (NULL == pExchange->node.pTargets) {
return TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY;
} }
if (NULL != pChild->pLimit) {
pExchange->node.pLimit = nodesCloneNode(pChild->pLimit);
if (NULL == pExchange->node.pLimit) {
return TSDB_CODE_OUT_OF_MEMORY;
}
((SLimitNode*)pChild->pLimit)->offset = 0;
}
*pOutput = pExchange; *pOutput = pExchange;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
...@@ -921,6 +929,13 @@ static int32_t stbSplSplitScanNodeWithoutPartTags(SSplitContext* pCxt, SStableSp ...@@ -921,6 +929,13 @@ static int32_t stbSplSplitScanNodeWithoutPartTags(SSplitContext* pCxt, SStableSp
if (NULL != pInfo->pSplitNode->pParent && QUERY_NODE_LOGIC_PLAN_PROJECT == nodeType(pInfo->pSplitNode->pParent) && if (NULL != pInfo->pSplitNode->pParent && QUERY_NODE_LOGIC_PLAN_PROJECT == nodeType(pInfo->pSplitNode->pParent) &&
NULL == pInfo->pSplitNode->pParent->pLimit && NULL == pInfo->pSplitNode->pParent->pSlimit) { NULL == pInfo->pSplitNode->pParent->pLimit && NULL == pInfo->pSplitNode->pParent->pSlimit) {
pSplitNode = pInfo->pSplitNode->pParent; pSplitNode = pInfo->pSplitNode->pParent;
if (NULL != pInfo->pSplitNode->pLimit) {
pSplitNode->pLimit = nodesCloneNode(pInfo->pSplitNode->pLimit);
if (NULL == pSplitNode->pLimit) {
return TSDB_CODE_OUT_OF_MEMORY;
}
((SLimitNode*)pInfo->pSplitNode->pLimit)->offset = 0;
}
} }
int32_t code = splCreateExchangeNodeForSubplan(pCxt, pInfo->pSubplan, pSplitNode, SUBPLAN_TYPE_MERGE); int32_t code = splCreateExchangeNodeForSubplan(pCxt, pInfo->pSubplan, pSplitNode, SUBPLAN_TYPE_MERGE);
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
......
...@@ -95,9 +95,13 @@ TEST_F(PlanOptimizeTest, eliminateProjection) { ...@@ -95,9 +95,13 @@ TEST_F(PlanOptimizeTest, eliminateProjection) {
useDb("root", "test"); useDb("root", "test");
run("SELECT c1, sum(c3) FROM t1 GROUP BY c1"); run("SELECT c1, sum(c3) FROM t1 GROUP BY c1");
run("SELECT c1 FROM t1"); run("SELECT c1 FROM t1");
run("SELECT * FROM st1"); run("SELECT * FROM st1");
run("SELECT c1 FROM st1s3"); run("SELECT c1 FROM st1s3");
// run("select 1-abs(c1) from (select unique(c1) c1 from st1s3) order by 1 nulls first"); // run("select 1-abs(c1) from (select unique(c1) c1 from st1s3) order by 1 nulls first");
} }
...@@ -136,4 +140,14 @@ TEST_F(PlanOptimizeTest, tagScan) { ...@@ -136,4 +140,14 @@ TEST_F(PlanOptimizeTest, tagScan) {
run("select tag1 from st1 group by tag1"); run("select tag1 from st1 group by tag1");
run("select distinct tag1 from st1"); run("select distinct tag1 from st1");
run("select tag1*tag1 from st1 group by tag1*tag1"); run("select tag1*tag1 from st1 group by tag1*tag1");
} }
\ No newline at end of file
TEST_F(PlanOptimizeTest, pushDownLimit) {
useDb("root", "test");
run("SELECT c1 FROM t1 LIMIT 1");
run("SELECT c1 FROM st1 LIMIT 1");
run("SELECT c1 FROM st1 LIMIT 20 OFFSET 10");
}
...@@ -85,6 +85,8 @@ TEST_F(PlanOtherTest, show) { ...@@ -85,6 +85,8 @@ TEST_F(PlanOtherTest, show) {
run("SHOW DNODE 1 VARIABLES"); run("SHOW DNODE 1 VARIABLES");
run("SHOW DNODE 1 VARIABLES LIKE '%debug%'");
run("SHOW TAGS FROM st1s1"); run("SHOW TAGS FROM st1s1");
run("SHOW TABLE TAGS FROM st1"); run("SHOW TABLE TAGS FROM st1");
......
...@@ -137,10 +137,9 @@ sql_error show create database d2 ...@@ -137,10 +137,9 @@ sql_error show create database d2
sql show create table d2.stb2; sql show create table d2.stb2;
sql show create table d2.ctb2; sql show create table d2.ctb2;
sql show create table d2.ntb2; sql show create table d2.ntb2;
sql_error show variables;
sql show local variables; sql show local variables;
sql_error show dnode 1 variables; sql_error show dnode 1 variables;
sql_error show variables; sql show variables;
print =============== check information_schema print =============== check information_schema
...@@ -167,7 +166,7 @@ sql select * from information_schema.ins_subscriptions ...@@ -167,7 +166,7 @@ sql select * from information_schema.ins_subscriptions
sql select * from information_schema.ins_streams sql select * from information_schema.ins_streams
sql_error select * from information_schema.ins_grants sql_error select * from information_schema.ins_grants
sql_error select * from information_schema.ins_vgroups sql_error select * from information_schema.ins_vgroups
sql_error select * from information_schema.ins_configs sql select * from information_schema.ins_configs
sql_error select * from information_schema.ins_dnode_variables sql_error select * from information_schema.ins_dnode_variables
print =============== check performance_schema print =============== check performance_schema
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册