enhance: subquery can use expr primary key +/- value as primary key

This commit is contained in:
slzhou 2023-07-27 09:07:13 +08:00
parent 7924d7e0af
commit 9b4bdd819b
1 changed files with 13 additions and 1 deletions

View File

@ -821,7 +821,19 @@ static bool isPrimaryKeyImpl(SNode* pExpr) {
FUNCTION_TYPE_IROWTS == pFunc->funcType) {
return true;
}
}
} else if (QUERY_NODE_OPERATOR == nodeType(pExpr)) {
SOperatorNode* pOper = (SOperatorNode*)pExpr;
if (OP_TYPE_ADD != pOper->opType && OP_TYPE_SUB != pOper->opType) {
return false;
}
if (!isPrimaryKeyImpl(pOper->pLeft)) {
return false;
}
if (QUERY_NODE_VALUE != nodeType(pOper->pRight)) {
return false;
}
return true;
}
return false;
}