Skip to content

Potential unsoundness when translating outer joins #3

@wsx-ucb

Description

@wsx-ucb

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions