cmu-db / optd

CMU-DB's Cascades optimizer framework
https://cmu-db.github.io/optd/
MIT License
349 stars 19 forks source link

fix: reference the correct column stats for nlj and hash join #164

Closed Gun9niR closed 5 months ago

Gun9niR commented 5 months ago

The indices of ColumnRefExprs in hash join columns are with respect to left or right tables. For example,

image

The plan in this figure means join on 0th column of the left table and 3rd column of the right table.

But for NLJ, the column indices are with respect to the join output. For instance, if the condition is #0 = #5 and the left table has 3 columns, the condition actually means join on 0th column of the left table and 3rd column of the right.