-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Labels
bugSomething isn't workingSomething isn't workingsubstraitChanges to the substrait crateChanges to the substrait crate
Description
Describe the bug
roundtrip_with_ctx function checks for string equality when comparing plans. However, string compare seems to not give correct results. For e.g Here are two plans which are equivalent but considered different by the function.
Plan 1:
LeftSemi Join: data.a = __correlated_sq_1.a
Inner Join: data.a = data2.a
TableScan: data projection=[a, b, c, d, e, f]
TableScan: data2 projection=[a, b, c, d, e, f]
SubqueryAlias: __correlated_sq_1
Projection: data2.a
Filter: data2.f NOT IN ([Utf8("a"), Utf8("b"), Utf8("c"), Utf8("d")])
TableScan: data2 projection=[a, f], partial_filters=[data2.f NOT IN ([Utf8("a"), Utf8("b"), Utf8("c"), Utf8("d")])]
Plan 2:
LeftSemi Join: data.a = data2.a
Inner Join: data.a = data2.a
TableScan: data projection=[a, b, c, d, e, f]
TableScan: data2 projection=[a, b, c, d, e, f]
Projection: data2.a
Filter: data2.f NOT IN ([Utf8("a"), Utf8("b"), Utf8("c"), Utf8("d")])
TableScan: data2 projection=[a, f], partial_filters=[data2.f NOT IN ([Utf8("a"), Utf8("b"), Utf8("c"), Utf8("d")])]
It might also give incorrect comparison result in case where there are more than one partial_filters but in a different ordering inside the vector.
To Reproduce
Here is an example testcase I used to produce the plans in the Describe the bug section.
#[tokio::test]
async fn roundtrip_inlist_5() -> Result<()> {
roundtrip("SELECT * FROM data, data2 WHERE data.a = data2.a AND data.a IN (SELECT data2.a FROM data2 WHERE f NOT IN ('a', 'b', 'c', 'd'))").await
}Expected behavior
The two plans should be considered equivalent.
Additional context
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingsubstraitChanges to the substrait crateChanges to the substrait crate