-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
partitionccl: make CreatePartitioning idempotent for implicit columns #60696
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making this change!
Couple notes:
- Can we add some tests in partitioning_implicit that test this stuff directly as well
- Can we cleanup some of the complexity in
alter_primary_key
around altering to/from REGIONAL BY ROW tables? I'm thinking around here:cockroach/pkg/sql/alter_primary_key.go
Line 450 in 5744288
// Detect partitioning if we are newly adding a PARTITION BY ALL statement.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @otan)
pkg/ccl/partitionccl/partition.go, line 394 at r1 (raw file):
) } for i, oldColID := range oldImplicitColumnIDs {
Just confirming, we don't need to check for the direction of implicit columns right? There's now way that could change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add some tests in partitioning_implicit that test this stuff directly as well
What tests would do this? We block everywhere you try to change an implicitly partitioned column when using ALTER INDEX, and that's already tested.
Can we cleanup some of the complexity in alter_primary_key around altering to/from REGIONAL BY ROW tables? I'm thinking around here:
No, because in that case we are changing the implicitly partitioned columns to something else. But we are rewriting the index, so it's okay.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @arulajmani)
pkg/ccl/partitionccl/partition.go, line 394 at r1 (raw file):
Previously, arulajmani (Arul Ajmani) wrote…
Just confirming, we don't need to check for the direction of implicit columns right? There's now way that could change?
Nope -- all implicitly partitioned column is ascending
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We block everywhere you try to change an implicitly partitioned column when using ALTER INDEX
I see, I guess I was under the impression that this would no-op and we could test that. I don't think we need to do that in this patch, I'm fine with this as is.
No, because in that case we are changing the implicitly partitioned columns to something else. But we are rewriting the index, so it's okay.
I don't know this code quite well, but the comment says
// column descriptor in front of each index, and calling CreatePartitioning again
// will make these indexes explicit.
The "CreatePartitioning again will make indexes explicit" no longer applies, right? Can't we clean this up?
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @arulajmani)
I see, yes, but that is now needed regardless for the REGIONAL BY ROW -> REGIONAL BY ROW case. |
f549667
to
45ae81b
Compare
Previously, calling CreatePartitioning twice on an implicitly partitioned index would un-implicitly partition that index. This commit changes CreatePartitioning to not un-implicitly partition the index in such a case. Release note: None
bors r=arulajmani |
Build failed (retrying...): |
Build failed (retrying...): |
Build succeeded: |
Previously, calling CreatePartitioning twice on an implicitly
partitioned index would un-implicitly partition that index. This commit
changes CreatePartitioning to not un-implicitly partition the index in
such a case.
Release note: None