Skip to content

Conversation

@jycor
Copy link
Contributor

@jycor jycor commented Dec 11, 2023

Currently, we don't have proper handling of nodes that aren't RangeHeaps in the RangeJoinIter.
This PR makes it so that we don't create plans that would have these nodes.
Additionally, we error instead of panicking when we see an invalid node in this area.

fixes dolthub/dolt#7139

@jycor jycor requested a review from max-hoffman December 12, 2023 00:12
},
},
{
q: "select * from vals join ranges on val between min and max where min >= 2 and max <= 5",
Copy link
Contributor

Choose a reason for hiding this comment

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

these two trigger the panic? could we get a couple more with some of the other rejected node types, like LIMIT, ORDER BY, PROJECT, DISTINCT. I think LIMIT and DISTINCT are both group properties, so maybe have to be checked separately

},
},
{
q: "select * from vals join (select * from ranges where min >= 2 and max <= 5 limit 1) ranges on val between min and max",
Copy link
Contributor

Choose a reason for hiding this comment

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

i don't think this one is valid as a rangeHeap, should block this transform

Copy link
Contributor

Choose a reason for hiding this comment

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

distinct is another one that might error, because we don't materialize it into the tree until after join planning

Copy link
Contributor

@max-hoffman max-hoffman left a comment

Choose a reason for hiding this comment

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

lgtm, thanks for adding more tests

@jycor jycor merged commit 9831b84 into main Dec 12, 2023
@jycor jycor deleted the james/range branch December 12, 2023 22:45
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.

panic: interface conversion: sql.Node is *plan.Filter, not *plan.RangeHeap

2 participants