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

fetchpb: extract index fetch spec into a separate package #94116

Merged
merged 1 commit into from
Dec 28, 2022

Conversation

yuzefovich
Copy link
Member

@yuzefovich yuzefovich commented Dec 22, 2022

This will allow us to import the index fetch spec into roachpb which
is needed for the KV projection pushdown work.

This required changing the custom cast types used in the spec from type
aliases defined in descpb to one level lower ones from catid.

Epic: CRDB-14837

Release note: None

@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Contributor

@ajwerner ajwerner left a comment

Choose a reason for hiding this comment

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

I'm extremely supportive of this extraction. One note is that @Xiang-Gu has been contemplating just today pulling some proto enums out into an enumpb or catenumpb package that is very low dependency. That'd be a good place for this IndexColumn_ASC/DESC symbol.

import "sql/types/types.proto";
import "sql/catalog/catpb/index.proto";
import "geo/geoindex/config.proto";

// IndexFetchSpec contains the subset of information (from TableDescriptor and
// IndexDescriptor) that is necessary to decode KVs into SQL keys and values.
message IndexFetchSpec {
message Column {
optional uint32 column_id = 1 [(gogoproto.nullable) = false,
Copy link
Contributor

Choose a reason for hiding this comment

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

Keep the cast type and drop it to (gogoproto.casttype) = "[github.com/cockroachdb/cockroach/pkg/sql/sem/catid.ColumnID](http://github.com/cockroachdb/cockroach/pkg/sql/sem/catid.ColumnID)"

@yuzefovich yuzefovich force-pushed the index-fetch-spec branch 3 times, most recently from e5e4ab8 to d8efbbb Compare December 22, 2022 19:07
Copy link
Member Author

@yuzefovich yuzefovich left a comment

Choose a reason for hiding this comment

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

Thanks for the feedback! I extracted out catenumpb with a few things in #94160, and I think that commit is beneficial on its own, so we should merge it regardless of whether the index fetch spec will be used in the BatchRequest. I'll keep this PR about moving the index fetch spec. I'll try the spec cache idea before marking this as ready for review.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @ajwerner)


pkg/sql/catalog/fetchpb/index_fetch.proto line 25 at r1 (raw file):

Previously, ajwerner wrote…

Keep the cast type and drop it to (gogoproto.casttype) = "[github.com/cockroachdb/cockroach/pkg/sql/sem/catid.ColumnID](http://github.com/cockroachdb/cockroach/pkg/sql/sem/catid.ColumnID)"

Good point, done.

@yuzefovich yuzefovich force-pushed the index-fetch-spec branch 2 times, most recently from aae7195 to 6f71c69 Compare December 27, 2022 23:02
@yuzefovich yuzefovich marked this pull request as ready for review December 27, 2022 23:04
@yuzefovich yuzefovich requested review from a team as code owners December 27, 2022 23:04
@yuzefovich yuzefovich requested a review from a team December 27, 2022 23:04
@yuzefovich yuzefovich requested a review from a team as a code owner December 27, 2022 23:04
@yuzefovich yuzefovich requested review from jayshrivastava and rharding6373 and removed request for a team December 27, 2022 23:04
Copy link
Contributor

@ajwerner ajwerner left a comment

Choose a reason for hiding this comment

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

nit: I think it'd be fine or even good to put this not under sql/catalog. At this point, it's feeling like the big thing this is doing is saying that rows and column encoding is a shared concept between sql and KV. Maybe put it near rowenc? I feel like with minimal effort we could make keyside and valueside not depend on sql/catalog and then pull them out of the sql tree altogether?

Anyways, this :lgtm: as a stand-alone PR.

Reviewed 4 of 119 files at r1, 8 of 103 files at r2, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @jayshrivastava and @rharding6373)

This will allow us to import the index fetch spec into `roachpb` which
is needed for the KV projection pushdown work.

This required changing the custom cast types used in the spec from type
aliases defined in `descpb` to one level lower ones from `catid`.

Epic: None

Release note: None
@yuzefovich
Copy link
Member Author

Your reasoning sounds good to me, so I left a TODO with that spirit (since I want to not get distracted for now) and will merge as is.

TFTR!

bors r+

@craig
Copy link
Contributor

craig bot commented Dec 28, 2022

Build succeeded:

@craig craig bot merged commit 21226cf into cockroachdb:master Dec 28, 2022
@yuzefovich yuzefovich deleted the index-fetch-spec branch December 28, 2022 01:26
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