-
Notifications
You must be signed in to change notification settings - Fork 5.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
vector: shorten explain output for vector constants #55406
vector: shorten explain output for vector constants #55406
Conversation
Signed-off-by: “EricZequan” <[email protected]>
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Hi @EricZequan. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## feature/vector-search/vector-data-type #55406 +/- ##
===========================================================================
Coverage ? 74.6738%
===========================================================================
Files ? 1561
Lines ? 440158
Branches ? 0
===========================================================================
Hits ? 328683
Misses ? 91234
Partials ? 20241
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Signed-off-by: “EricZequan” <[email protected]>
/cc @breezewish PTAL |
@EricZequan: GitHub didn't allow me to request PR reviews from the following users: PTAL. Note that only pingcap members and repo collaborators can review this PR, and authors cannot review their own PRs. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
pkg/types/vector.go
Outdated
// StringWithCtx implements Explainable interface. | ||
// In EXPLAIN context, we truncate the elements to avoid too long output. | ||
func (v VectorFloat32) StringWithCtx(ctx ParamValues, redact string) string { | ||
return v.StringWithRedact(ctx, redact) | ||
} | ||
|
||
// StringWithRedact parse vector into string with redact mode. | ||
func (v VectorFloat32) StringWithRedact(ctx ParamValues, redact string) string { |
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.
ctx
is not used at all. From Vector's perspective you should remove it. Consider that you are a Vector developer. What is ctx? They are all not used, and you don't even know what are them. They are totally not related with Vector at all, and Vector is not relying on them. So they should not be there.
And also, consider about the redact. For a Vector, there is no need to redact part of the string. A vector constant is either fully redacted (becomes ?
or <..>
), or not redacted at all. So this is the chance for Vector to not care about redact as well.
The previous name StringForExplain
could be a good one, or you could use other names, as long as it clearly, precisely describe the functionality, for example, StringTruncated
.
Signed-off-by: “EricZequan” <[email protected]>
Close for #55934 |
What problem does this PR solve?
Issue Number: ref #54245
Problem Summary:
What changed and how does it work?
It is very likely that user passes a vector with very high dimension (e.g. dimension of 1000). Previously we output all values when such SQL is explained, which makes the explain hard to read.
This PR shortens the output and truncates the vector to display only first several elements.
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.