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

Changed how empty set of projected columns is handled #1587

Merged
merged 12 commits into from
Feb 14, 2023

Conversation

zachmu
Copy link
Member

@zachmu zachmu commented Feb 4, 2023

Started with tightening the semantics of the ProjectedTable interface as it relates to an empty projection (nil v. empty slice). Then made changes to printing of ResolvedTable and IndexedTableAccess. This revealed problems in the prune columns rule when all columns were being pruned. Fixed those, which had been masking other bugs, where we hadn't been pruning when we could have been. This was in turn caused by other bugs in the prune rule dealing with case sensitivity.

We should now be able to prune more columns than before, and we can see an empty column projection in plans.

@zachmu
Copy link
Member Author

zachmu commented Feb 4, 2023

Max, I need your eyes on the changes to the plans. They look reasonable at first glance but there's a lot of them and you're more familiar than I am. We are now pruning lots of columns we didn't before.

" │ ├─ static: [{[1, 1]}]\n" +
" │ └─ Table\n" +
" │ └─ name: one_pk\n" +
" │ └─ static: [{[1, 1]}]\n" +
Copy link
Contributor

Choose a reason for hiding this comment

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

this one is missing a columns field

" ├─ static: [{[1, 1], [2, 2]}]\n" +
" └─ Table\n" +
" └─ name: two_pk\n" +
" └─ static: [{[1, 1], [2, 2]}]\n" +
Copy link
Contributor

Choose a reason for hiding this comment

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

Also missing columns

" ├─ static: [{[1, 1], [2, 2]}]\n" +
" └─ Table\n" +
" └─ name: two_pk\n" +
" └─ static: [{[1, 1], [2, 2]}]\n" +
Copy link
Contributor

Choose a reason for hiding this comment

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

missing columns

" │ │ │ │ │ └─ Table\n" +
" │ │ │ │ │ └─ name: WRZVO\n" +
" │ │ │ │ │ └─ IndexedTableAccess(WRZVO)\n" +
" │ │ │ │ │ └─ index: [WRZVO.TVNW2]\n" +
Copy link
Contributor

Choose a reason for hiding this comment

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

missing cols

" │ │ └─ Table\n" +
" │ │ └─ name: TPXBU\n" +
" │ │ └─ IndexedTableAccess(TPXBU)\n" +
" │ │ └─ index: [TPXBU.id]\n" +
Copy link
Contributor

Choose a reason for hiding this comment

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

all of these missing cols

" │ └─ Table\n" +
" │ └─ name: OUBDL\n" +
" │ └─ IndexedTableAccess(OUBDL)\n" +
" │ └─ index: [OUBDL.ZH72S]\n" +
Copy link
Contributor

Choose a reason for hiding this comment

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

missing cols

Comment on lines -8846 to +7974
" │ ├─ rn.WNUNU:89 IS NULL\n" +
" │ └─ rn.HHVLX:90 IS NULL\n" +
" │ ├─ rn.WNUNU:15 IS NULL\n" +
" │ └─ rn.HHVLX:16 IS NULL\n" +
Copy link
Contributor

Choose a reason for hiding this comment

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

damn, should be a lot faster

Copy link
Contributor

Choose a reason for hiding this comment

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

this is query b3, as a reference for tesing correctness next week

@@ -9998,10 +9056,9 @@ WHERE
" │ │ │ ├─ aac.id:67!null\n" +
" │ │ │ └─ SL3S5.M22QN:53!null\n" +
" │ │ └─ TableAlias(aac)\n" +
" │ │ └─ IndexedTableAccess\n" +
" │ │ └─ IndexedTableAccess(TPXBU)\n" +
Copy link
Contributor

Choose a reason for hiding this comment

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

this is query e10

@@ -10761,34 +9791,34 @@ WHERE
" ├─ outerVisibility: false\n" +
" ├─ cacheable: true\n" +
" └─ Project\n" +
" ├─ columns: [bs.T4IBQ:1!null as T4IBQ, pa.DZLIM:3 as ECUWU, pga.DZLIM:15 as GSTQA, pog.B5OUF:13, fc.OZTQF:45, F26ZW.YHYLK:51, nd.TW55N:20 as TW55N]\n" +
" ├─ columns: [bs.T4IBQ:1!null as T4IBQ, pa.DZLIM:3 as ECUWU, pga.DZLIM:12 as GSTQA, pog.B5OUF:10, fc.OZTQF:20, F26ZW.YHYLK:24, nd.TW55N:14 as TW55N]\n" +
Copy link
Contributor

Choose a reason for hiding this comment

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

this is query e19

sql/plan/indexed_table_access.go Show resolved Hide resolved
@max-hoffman
Copy link
Contributor

I'm not seeing any noticeable differences on the sample integration test comparisons.

@zachmu
Copy link
Member Author

zachmu commented Feb 7, 2023

I'm not seeing any noticeable differences on the sample integration test comparisons.

You mean that you're not seeing any difference in performance on the actual integration test queries? This would make sense if the casing of the original queries were correct and we messed that up when obfuscating.

I think this passes other tests now, so give it a final thumbs or thumbs down when you have a minute.

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. I did see some small perf improvements in some cases, maybe ~10%. I meant more that I did not observe any correctness regressions, the changes look correct to my eye and in sample testing.

@zachmu zachmu merged commit c0e5a49 into main Feb 14, 2023
@Hydrocharged Hydrocharged deleted the zachmu/projected-cols branch March 29, 2023 01:10
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.

None yet

2 participants