-
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
colexec, coldata: add support for INTERVAL type #43517
Conversation
b503a6e
to
f4121eb
Compare
bddde60
to
ced4547
Compare
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.
Do we have an issue that tracks types that need serialization/more efficient serialization? We should also track the need to support other types of operators for certain types, including interval.
duration.Duration
doesn't lend itself to efficient serialization, but I'm not sure what to do about it right now. We might need to write an abstraction layer on top of certain types that have inefficient serialization at some point. This might be something equivalent to flat bytes where we represent []duration.Duration
as a slice of int64
s that are interpreted into durations three by three.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @asubiotto)
ced4547
to
17ec371
Compare
@danhhz are you ok with the second commit here which whitelists many dependencies that |
92e0cd6
to
97ac5ff
Compare
Friendly ping @danhhz |
Woah, that's a lot of stuff! No we probably shouldn't do that. Have you looked into why it brings so much in? |
It looks like the issue is the errEncodeOverflow error returned from Duration.Encode. I haven't looked closely, but it may be an easy fix for that method to return a bool (true for overflow) instead of an error, and turn that into a errEncodeOverflow at the callers |
Thanks for the comments, I'll take a deeper look. |
So I tried prototyping this and quickly found out that this error ends up getting plumbed back all the way even through the KV api (via internal/client/util.marshalValue). I think the issue here is that the pgcode error wrapper, while useful context for the user, has been sprinkled in utility libraries that it probably doesn't belong in. All of this is not your code, I understand. Hmmm.... To be honest, how much do we lose by simply removing the pgcode wrapper from this one place? That certainly seems like the easiest fix. We still get the error message for the user and I somewhat doubt any clients are actually sniffing this code to do something useful |
The other way we could go at this is to make pgerror a lighter dep.
|
I'm leaning toward the last one. It will be functionally identical. Plus, while in theory I think putting these pgerrors in util packages is unfortunate, I must admit that practically it's not worth it to fix them at this point. Cleaning up pgerror lets us sidestep the issue |
Ugh, just noticed that DecodeStackTrace uses log.Errorf |
Okay, I think I made this work. @yuzefovich would you mind cherry-picking this into your PR? https://github.com/cockroachdb/cockroach/compare/master...danhhz:pgerror_deps?expand=1 |
Yeah, that seems to do the trick, thanks! |
00c5b52
to
0bfa84e
Compare
Updated, PTAL. |
LGTM |
0bfa84e
to
9daa2b3
Compare
I needed to make a few tweaks to the commit that cleans up the dependencies, please take another look. |
9daa2b3
to
297aec6
Compare
@danhhz could you please take another quick look that the changes I made to make the linters happy are acceptable. |
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.
Whoops sorry! This got lost in my inbox. LGTM
The pgerror (and pgcode) packages are (perhaps inadvisably) used in low-level utility packages. They had some pretty heavyweight build deps, but this wasn't fundamentally necessary. Clean it up a bit and make these packages more lightweight. Release note: None
This commit adds the support for INTERVAL type that is represented by duration.Duration. Only comparison projections are currently supported. The serialization is also missing. Release note: None
297aec6
to
f7211dd
Compare
TFTRs!
Yep, filed #44195.
So far (I think) the only missing projections are of combination of Timestamps and Intervals. There is an issue for that #42044. bors r+ |
43517: colexec, coldata: add support for INTERVAL type r=yuzefovich a=yuzefovich **pgerror: clean up build deps** The pgerror (and pgcode) packages are (perhaps inadvisably) used in low-level utility packages. They had some pretty heavyweight build deps, but this wasn't fundamentally necessary. Clean it up a bit and make these packages more lightweight. Release note: None **colexec, coldata: add support for INTERVAL type** This commit adds the support for INTERVAL type that is represented by duration.Duration. Only comparison projections are currently supported. The serialization is also missing. Addresses: #42043. Release note: None Co-authored-by: Daniel Harrison <daniel.harrison@gmail.com> Co-authored-by: Yahor Yuzefovich <yahor@cockroachlabs.com>
Build succeeded |
pgerror: clean up build deps
The pgerror (and pgcode) packages are (perhaps inadvisably) used in
low-level utility packages. They had some pretty heavyweight build deps,
but this wasn't fundamentally necessary. Clean it up a bit and make
these packages more lightweight.
Release note: None
colexec, coldata: add support for INTERVAL type
This commit adds the support for INTERVAL type that is represented by
duration.Duration. Only comparison projections are currently supported.
The serialization is also missing.
Addresses: #42043.
Release note: None