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

colexechash: introduce a type alias for keyID #75595

Merged
merged 1 commit into from
Jan 27, 2022

Conversation

yuzefovich
Copy link
Member

@yuzefovich yuzefovich commented Jan 27, 2022

Release note: None

@yuzefovich yuzefovich added the do-not-merge bors won't merge a PR with this label. label Jan 27, 2022
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator

@michae2 michae2 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 doing this!

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @michae2 and @yuzefovich)


pkg/sql/colexec/colexechash/hashtable.go, line 73 at r1 (raw file):

//
// keyID of 0 is reserved to indicate the end of the hash chain.
type keyID uint64

Ah, crap, I misled you. I was wrong, this should probably be a "type alias declaration" not a "type definition" (TIL they are different in go!). In other words, this should probably be:

type keyID = uint64

And by adding that equals sign, we should be able to use []uint64 as []keyID and vice-versa (even without explicit casts). Then you won't need the unsafe.Pointer stuff and in general that will make life much easier. Sorry about that!

Code quote:

type keyID uint64

@yuzefovich yuzefovich removed the do-not-merge bors won't merge a PR with this label. label Jan 27, 2022
@yuzefovich yuzefovich marked this pull request as ready for review January 27, 2022 18:29
@yuzefovich yuzefovich requested review from michae2 and a team January 27, 2022 18:30
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.

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


pkg/sql/colexec/colexechash/hashtable.go, line 73 at r1 (raw file):

Previously, michae2 (Michael Erickson) wrote…

Ah, crap, I misled you. I was wrong, this should probably be a "type alias declaration" not a "type definition" (TIL they are different in go!). In other words, this should probably be:

type keyID = uint64

And by adding that equals sign, we should be able to use []uint64 as []keyID and vice-versa (even without explicit casts). Then you won't need the unsafe.Pointer stuff and in general that will make life much easier. Sorry about that!

Oops, this makes sense, I don't know why I didn't think of this myself right away, I guess I wasn't consciously aware of these differences too. PTAL.

Copy link
Collaborator

@michae2 michae2 left a comment

Choose a reason for hiding this comment

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

:lgtm:

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

@yuzefovich
Copy link
Member Author

TFTR!

bors r+

@craig
Copy link
Contributor

craig bot commented Jan 27, 2022

Build succeeded:

@craig craig bot merged commit 8543bbb into cockroachdb:master Jan 27, 2022
@yuzefovich yuzefovich deleted the hashtable-keyid branch January 27, 2022 19:59
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