Skip to content

Conversation

@nicktobey
Copy link
Contributor

This prevents the panic seen in dolthub/dolt#10051

The join planner assumed that every instance of TableAlias wrapped an implementer of sql.TableNode.

Only tables that support lookups implement sql.TableNode. Table functions that are not backed by an actual table and don't support lookups do not implement this interface.

This panic is happening when testing to see whether we can optimize a join into a RightSemiJoin. The table needs to support lookups for this optimization to be allowed. So if it doesn't implement sql.TableNode, it suffices to skip this join plan, since we wouldn't be able to produce it away.

This does not fix the broader issue of dolthub/dolt#10051, which is that it is currently impossible for table functions that accept non-literal arguments to support efficient lookups. I'm not currently aware of any use cases where this is required, but I'll keep the issue open to track it in case we need to support that in the future.

nicktobey and others added 4 commits November 10, 2025 15:11
…le, which supports lookups, and IntSequenceTable, which doesn't.
…lementer of sql.TableNode.

Only tables that support lookups implement sql.TableNode. Table functions that are not backed by an actual table and don't support lookups do not implement this interface.
@nicktobey nicktobey changed the title Nicktobey/where panic Prevent panic when using table functions in joins and subqueries Nov 10, 2025
Copy link
Contributor

@fulghum fulghum left a comment

Choose a reason for hiding this comment

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

Looks good!

@nicktobey nicktobey merged commit e128bf9 into main Nov 11, 2025
8 checks passed
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.

3 participants