fix issue
This commit is contained in:
parent
21d7820bb5
commit
1bff0e89f4
|
@ -12628,6 +12628,27 @@ static int32_t createParOperatorNode(EOperatorType opType, const char* pLeftCol,
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t createIsOperatorNode(EOperatorType opType, const char* pColName, SNode** pOp) {
|
||||
SOperatorNode* pOper = NULL;
|
||||
int32_t code = nodesMakeNode(QUERY_NODE_OPERATOR, (SNode**)&pOper);
|
||||
if (NULL == pOper) {
|
||||
return code;
|
||||
}
|
||||
|
||||
pOper->opType = opType;
|
||||
code = nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pOper->pLeft);
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
nodesDestroyNode((SNode*)pOper);
|
||||
return code;
|
||||
}
|
||||
pOper->pRight = NULL;
|
||||
|
||||
snprintf(((SColumnNode*)pOper->pLeft)->colName, sizeof(((SColumnNode*)pOper->pLeft)->colName), "%s", pColName);
|
||||
|
||||
*pOp = (SNode*)pOper;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static const char* getTbNameColName(ENodeType type) {
|
||||
const char* colName;
|
||||
switch (type) {
|
||||
|
@ -15190,23 +15211,42 @@ static int32_t rewriteShowAliveStmt(STranslateContext* pCxt, SQuery* pQuery) {
|
|||
return code;
|
||||
}
|
||||
|
||||
// pSubSelect, pTemp1, pTempVal need to free
|
||||
|
||||
pThen = NULL;
|
||||
code = nodesMakeValueNodeFromInt32(1, &pThen);
|
||||
SNode* pCondIsNULL = NULL;
|
||||
code = createIsOperatorNode(OP_TYPE_IS_NULL, pSumColAlias, &pCondIsNULL);
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
nodesDestroyNode((SNode*)pSubSelect);
|
||||
nodesDestroyNode(pTemp1);
|
||||
nodesDestroyNode(pTempVal);
|
||||
return code;
|
||||
}
|
||||
// pSubSelect, pTemp1, pThen, pTempVal need to free
|
||||
|
||||
pWhenThen = NULL;
|
||||
code = createParWhenThenNode(pTemp1, pThen, &pWhenThen);
|
||||
SNode* pCondFull1 = NULL;
|
||||
code = createLogicCondNode(&pTemp1, &pCondIsNULL, &pCondFull1, LOGIC_COND_TYPE_OR);
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
nodesDestroyNode((SNode*)pSubSelect);
|
||||
nodesDestroyNode(pTemp1);
|
||||
nodesDestroyNode(pTempVal);
|
||||
nodesDestroyNode(pCondIsNULL);
|
||||
return code;
|
||||
}
|
||||
|
||||
// pSubSelect, pCondFull1, pTempVal need to free
|
||||
|
||||
pThen = NULL;
|
||||
code = nodesMakeValueNodeFromInt32(1, &pThen);
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
nodesDestroyNode((SNode*)pSubSelect);
|
||||
nodesDestroyNode(pCondFull1);
|
||||
nodesDestroyNode(pTempVal);
|
||||
return code;
|
||||
}
|
||||
// pSubSelect, pCondFull1, pThen, pTempVal need to free
|
||||
|
||||
pWhenThen = NULL;
|
||||
code = createParWhenThenNode(pCondFull1, pThen, &pWhenThen);
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
nodesDestroyNode((SNode*)pSubSelect);
|
||||
nodesDestroyNode(pCondFull1);
|
||||
nodesDestroyNode(pThen);
|
||||
nodesDestroyNode(pTempVal);
|
||||
return code;
|
||||
|
@ -15289,7 +15329,7 @@ static int32_t rewriteShowAliveStmt(STranslateContext* pCxt, SQuery* pQuery) {
|
|||
}
|
||||
// pSubSelect, pWhenThenlist need to free
|
||||
|
||||
// case when leader_col = count_col and count_col > 0 then 1 when leader_col < count_col and count_col > 0 then 2 else
|
||||
// case when leader_col = count_col and leader_col > 0 then 1 when leader_col < count_col and leader_col > 0 then 2 else
|
||||
// 0 end as status
|
||||
pElse = NULL;
|
||||
code = nodesMakeValueNodeFromInt32(0, &pElse);
|
||||
|
|
|
@ -21,6 +21,30 @@ sql create dnode $hostname4 port 7500
|
|||
|
||||
sleep 1000
|
||||
|
||||
$loop_count = 0
|
||||
|
||||
loop00:
|
||||
|
||||
sleep 1000
|
||||
|
||||
$loop_count = $loop_count + 1
|
||||
if $loop_count == 20 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print 0 show cluster alive;
|
||||
sql show cluster alive;
|
||||
|
||||
print res------------------------
|
||||
print $data00 $data01
|
||||
print $data10 $data11
|
||||
|
||||
if $data00 != 1 then
|
||||
print =====data00=$data00
|
||||
goto loop00
|
||||
endi
|
||||
|
||||
|
||||
print =============== create database, stable, table
|
||||
sql create database test vgroups 6;
|
||||
sql use test;
|
||||
|
@ -46,6 +70,15 @@ endi
|
|||
print show cluster alive;
|
||||
sql show cluster alive;
|
||||
|
||||
print res------------------------
|
||||
print $data00 $data01
|
||||
print $data10 $data11
|
||||
|
||||
if $rows != 1 then
|
||||
print =====rows=$rows
|
||||
goto loop0
|
||||
endi
|
||||
|
||||
if $data00 != 1 then
|
||||
print =====data00=$data00
|
||||
goto loop0
|
||||
|
@ -54,6 +87,15 @@ endi
|
|||
print show test.alive;
|
||||
sql show test.alive;
|
||||
|
||||
print res------------------------
|
||||
print $data00 $data01
|
||||
print $data10 $data11
|
||||
|
||||
if $rows != 1 then
|
||||
print =====rows=$rows
|
||||
goto loop0
|
||||
endi
|
||||
|
||||
if $data00 != 1 then
|
||||
print =====data00=$data00
|
||||
goto loop0
|
||||
|
|
Loading…
Reference in New Issue