Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: join condition with single param operator #22873

Merged
merged 1 commit into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion source/libs/planner/src/planOptimizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
12 changes: 12 additions & 0 deletions tests/system-test/2-query/stbJoin.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,18 @@ def run(self):
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;")
Expand Down