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

vector: shorten explain output for vector constants #55406

Conversation

EricZequan
Copy link
Contributor

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

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@ti-chi-bot ti-chi-bot bot added the release-note-none Denotes a PR that doesn't merit a release note. label Aug 14, 2024
Copy link

ti-chi-bot bot commented Aug 14, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign zanmato1984 for approval. For more information see the Code Review Process.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Aug 14, 2024
Copy link

tiprow bot commented Aug 14, 2024

Hi @EricZequan. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

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.

Copy link

codecov bot commented Aug 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (feature/vector-search/vector-data-type@573e1ab). Learn more about missing BASE report.

Current head ec7dc8f differs from pull request most recent head 87cd833

Please upload reports for the commit 87cd833 to get more accurate results.

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           
Flag Coverage Δ
integration 49.2675% <0.0000%> (?)
unit 71.6974% <100.0000%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 52.9656% <0.0000%> (?)
parser ∅ <0.0000%> (?)
br 52.5422% <0.0000%> (?)

@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 14, 2024
@EricZequan
Copy link
Contributor Author

/cc @breezewish PTAL

Copy link

ti-chi-bot bot commented Aug 14, 2024

@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:

/cc @breezewish PTAL

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.

@ti-chi-bot ti-chi-bot bot requested a review from breezewish August 14, 2024 07:27
Comment on lines 103 to 110
// 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 {
Copy link
Member

@breezewish breezewish Aug 14, 2024

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.

@EricZequan EricZequan marked this pull request as draft August 15, 2024 08:17
@ti-chi-bot ti-chi-bot bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 15, 2024
Signed-off-by: “EricZequan” <[email protected]>
@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 16, 2024
@breezewish
Copy link
Member

Close for #55934

@breezewish breezewish closed this Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants