-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Simplify expr = L1 AND expr != L2 to expr = L1 when L1 != L2
#19731
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -973,19 +973,19 @@ ON e.emp_id = d.emp_id | |
| WHERE ((dept_name != 'Engineering' AND e.name = 'Alice') OR (name != 'Alice' AND e.name = 'Carol')); | ||
| ---- | ||
| logical_plan | ||
| 01)Filter: d.dept_name != Utf8View("Engineering") AND e.name = Utf8View("Alice") OR e.name != Utf8View("Alice") AND e.name = Utf8View("Carol") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this right? It looks like it has rewritten ((dept_name != 'Engineering' AND e.name = 'Alice') OR (name != 'Alice' AND e.name = 'Carol'));to ((dept_name != 'Engineering' AND e.name = 'Alice') OR (e.name = 'Carol'));But
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Update -- looking at this, it seems like actually the predicate actually did resolve both
Maybe we can update this test (in a follow on PR) so it uses the fully qualified column references to make it clearer the intent ((d.dept_name != 'Engineering' AND e.name = 'Alice') OR (e.name != 'Alice' AND e.name = 'Carol')); |
||
| 01)Filter: d.dept_name != Utf8View("Engineering") AND e.name = Utf8View("Alice") OR e.name = Utf8View("Carol") | ||
| 02)--Projection: e.emp_id, e.name, d.dept_name | ||
| 03)----Left Join: e.emp_id = d.emp_id | ||
| 04)------SubqueryAlias: e | ||
| 05)--------Filter: employees.name = Utf8View("Alice") OR employees.name != Utf8View("Alice") AND employees.name = Utf8View("Carol") | ||
| 05)--------Filter: employees.name = Utf8View("Alice") OR employees.name = Utf8View("Carol") | ||
| 06)----------TableScan: employees projection=[emp_id, name] | ||
| 07)------SubqueryAlias: d | ||
| 08)--------TableScan: department projection=[emp_id, dept_name] | ||
| physical_plan | ||
| 01)FilterExec: dept_name@2 != Engineering AND name@1 = Alice OR name@1 != Alice AND name@1 = Carol | ||
| 01)FilterExec: dept_name@2 != Engineering AND name@1 = Alice OR name@1 = Carol | ||
| 02)--RepartitionExec: partitioning=RoundRobinBatch(4), input_partitions=1 | ||
| 03)----HashJoinExec: mode=CollectLeft, join_type=Left, on=[(emp_id@0, emp_id@0)], projection=[emp_id@0, name@1, dept_name@3] | ||
| 04)------FilterExec: name@1 = Alice OR name@1 != Alice AND name@1 = Carol | ||
| 04)------FilterExec: name@1 = Alice OR name@1 = Carol | ||
| 05)--------DataSourceExec: partitions=1, partition_sizes=[1] | ||
| 06)------DataSourceExec: partitions=1, partition_sizes=[1] | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.