Merge pull request #22873 from taosdata/fix/TS-3960

fix: join condition with single param operator
This commit is contained in:
dapan1121 2023-09-13 11:08:42 +08:00 committed by GitHub
commit 0be7060928
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -812,7 +812,7 @@ static bool pushDownCondOptIsColEqualOnCond(SJoinLogicNode* pJoin, SNode* pCond,
return false;
}
SOperatorNode* pOper = (SOperatorNode*)pCond;
if (QUERY_NODE_COLUMN != nodeType(pOper->pLeft) || QUERY_NODE_COLUMN != nodeType(pOper->pRight)) {
if (QUERY_NODE_COLUMN != nodeType(pOper->pLeft) || NULL == pOper->pRight || QUERY_NODE_COLUMN != nodeType(pOper->pRight)) {
return false;
}
SColumnNode* pLeft = (SColumnNode*)(pOper->pLeft);

View File

@ -112,6 +112,18 @@ class TDTestCase:
tdSql.query(f"select a.* from sta a join stb b on a.tg1 != b.tg1 and a.ts=b.ts;")
tdSql.checkRows(36)
tdSql.query(f"select a.* from sta a join stb b on a.ts=b.ts and a.ts is null;")
tdSql.checkRows(0)
tdSql.query(f"select a.* from sta a join stb b on a.ts=b.ts and a.ts is not null;")
tdSql.checkRows(48)
tdSql.query(f"select a.* from sta a ,stb b where a.ts=b.ts and a.ts is null;")
tdSql.checkRows(0)
tdSql.query(f"select a.* from sta a ,stb b where a.ts=b.ts and a.ts is not null;")
tdSql.checkRows(48)
# tdSql.checkData(0,1,10)
tdSql.error(f"select a.* from sta a join stb b on a.tg1=b.tg1 where a.ts=b.ts or a.tg2=b.tg2;")