Skip to content

Conversation

@jycor
Copy link
Contributor

@jycor jycor commented Sep 26, 2023

When unioning two SELECT statements that have different column types, we would get -1 during assignExecIndexes, resulting in a panic.

This PR fixes the issue by matching on unqualified column names when we don't have an exact match.
We don't find these matches because the second table has an unqualified alias over the column name because it is wrapping it in a convert node.

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 the additional tests and validation

}
}
n = unqualify(n)
for i := len(s.columns) - 1; i >= 0; i-- {
Copy link
Contributor

Choose a reason for hiding this comment

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

can we not recurse on getIdx(unqualify(n))? documenting that this is only correct for references to SetOp outputs is also useful

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If unqualified n isn't in the scope, then I think that results in an infinite loop.

Copy link
Contributor

Choose a reason for hiding this comment

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

kk, what about unqualifying the comparison columns? Does the union Schema have qualified columns?

@jycor jycor merged commit 9b011db into main Sep 27, 2023
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