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

Potential unsoundness when translating outer joins #3

Open
wsx-ucb opened this issue Dec 19, 2023 · 0 comments
Open

Potential unsoundness when translating outer joins #3

wsx-ucb opened this issue Dec 19, 2023 · 0 comments

Comments

@wsx-ucb
Copy link

wsx-ucb commented Dec 19, 2023

The following logic in JoinParser.java translates an outer join with join condition that is trivially true into an inner join with the same condition.

if (joinCondition.getKind() == SqlKind.LITERAL) {
RexLiteral maybeTrue = (RexLiteral) joinCondition;
if (maybeTrue.isAlwaysTrue()){
return constructNode(result,z3Context);
}
}

However, a left outer join with join condition TRUE would still generate null rows when the right table is empty, making it nonequivalent to an inner join.

The branch right above also seems off.

if (joinCondition.getKind() == SqlKind.IS_TRUE) {
return constructNode(result,z3Context);
}

I believe SqlKind.IS_TRUE indicates the IS TRUE operator, not that the condition is trivially true. Translating R1 LEFT JOIN R2 ON P IS TRUE into R1 INNER JOIN R2 ON P IS TRUE for arbitrary predicate P is clearly not right.

Please let me know if I am misunderstanding anything. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant