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

OrderedDistinct passes join tree row during exec #1700

Merged
merged 2 commits into from
Apr 7, 2023

Conversation

max-hoffman
Copy link
Contributor

@max-hoffman max-hoffman commented Apr 6, 2023

Re: dolthub/dolt#5700

OrderedDistinct dropped a parent row while executing a join tree, which caused a field index error in the child.

The query below has a slightly different plan, but the OrderedDistinct in the right half of a join tree, with a join SEMI_JOIN(scalarSubq0, scalarSubq1) as a child is the issue.

Project
 ├─ columns: [SUM(xy.x):0!null as SUM(x)]
 └─ GroupBy
     ├─ select: SUM(xy.x:0!null)
     ├─ group: 
     └─ Project
         ├─ columns: [xy.x:0!null, xy.y:1]
         └─ HashJoin
             ├─ Eq
             │   ├─ xy.x:0!null
             │   └─ scalarSubq0.u:2!null
             ├─ Filter
             │   ├─ Eq
             │   │   ├─ xy.x:0!null
             │   │   └─ 2 (tinyint)
             │   └─ Table
             │       ├─ name: xy
             │       └─ columns: [x y]
             └─ HashLookup
                 ├─ source: TUPLE(xy.x:0!null)
                 ├─ target: TUPLE(scalarSubq0.u:0!null)
                 └─ CachedResults
                     └─ OrderedDistinct
                         └─ Project
                             ├─ columns: [scalarSubq0.u:0!null]
                             └─ SemiJoin
                                 ├─ Eq
                                 │   ├─ scalarSubq0.u:2!null
                                 │   └─ scalarSubq1.a:4!null
                                 ├─ TableAlias(scalarSubq0)
                                 │   └─ Table
                                 │       ├─ name: uv
                                 │       └─ columns: [u v]
                                 └─ Filter
                                     ├─ Eq
                                     │   ├─ scalarSubq1.a:0!null
                                     │   └─ 2 (tinyint)
                                     └─ TableAlias(scalarSubq1)
                                         └─ Table
                                             ├─ name: ab
                                             └─ columns: [a]

Copy link
Member

@zachmu zachmu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@max-hoffman max-hoffman merged commit 76d35db into main Apr 7, 2023
@max-hoffman max-hoffman deleted the max/ordered-distinct-passes-row branch April 7, 2023 20:16
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

Successfully merging this pull request may close these issues.

2 participants