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

compute: Add Vector data type and functions #9262

Merged
merged 9 commits into from
Jul 31, 2024

Conversation

Lloyd-Pottiger
Copy link
Contributor

@Lloyd-Pottiger Lloyd-Pottiger commented Jul 29, 2024

What problem does this PR solve?

Issue Number: ref #9032

Problem Summary:

What is changed and how it works?

Pick https://github.com/tidbcloud/tiflash-cse/pull/153


Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

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

None

* Add Vector data type (pingcap#141)

Signed-off-by: Wish <[email protected]>

* compute: Add vector functions (pingcap#146)

Signed-off-by: Wish <[email protected]>

* compute: Fix vector precision (pingcap#147)

Signed-off-by: Wish <[email protected]>

* compute: Fix vector distance over NULLs (pingcap#148)

Signed-off-by: Wish <[email protected]>

* [cherry-pick]  Storages: Make DMFile ready for new column indexes/types (pingcap#149)

Signed-off-by: Wish <[email protected]>

---------

Signed-off-by: Wish <[email protected]>
Co-authored-by: Wenxuan <[email protected]>
@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jul 29, 2024
@Lloyd-Pottiger Lloyd-Pottiger changed the base branch from master to vector-index July 29, 2024 05:12
Signed-off-by: Lloyd-Pottiger <[email protected]>
@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Jul 29, 2024
@breezewish
Copy link
Member

/run-all-tests

1 similar comment
@Lloyd-Pottiger
Copy link
Contributor Author

/run-all-tests

@breezewish
Copy link
Member

breezewish commented Jul 29, 2024

Could also manually verify whether it works with these two PRs? Thank you!

As in pingcap/tidb#54635 the function push down is not enabled yet, so we only need to verify TiFlash could store and read out vector data correctly.

if (!isNullAt(n))
return getNestedColumn().getDataAt(n);

throw Exception(
Copy link
Contributor

Choose a reason for hiding this comment

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

The error code and error message should be updated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is by design

normb += b[i] * b[i];
}

Float64 similarity
Copy link
Contributor

@JinheLin JinheLin Jul 31, 2024

Choose a reason for hiding this comment

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

We should guarantee std::sqrt(static_cast<Float64>(norma) * static_cast<Float64>(normb)) is non-zero?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In c++, float / 0 = inf and 0.0 / 0 = nan

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If norma or normb equal to 0, distance must be 0.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will add some comments.

@JaySon-Huang
Copy link
Contributor

/test pull-unit-test

Signed-off-by: Lloyd-Pottiger <[email protected]>
@wuhuizuo
Copy link
Contributor

@Lloyd-Pottiger you can revert the commit: feb28b7

I fixed it in PingCAP-QE/ci#3042

This reverts commit feb28b7.
@ti-chi-bot ti-chi-bot bot added the lgtm label Jul 31, 2024
Copy link
Contributor

ti-chi-bot bot commented Jul 31, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: breezewish, JaySon-Huang

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [JaySon-Huang,breezewish]

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 removed the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Jul 31, 2024
Copy link
Contributor

ti-chi-bot bot commented Jul 31, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-07-29 06:56:21.520725288 +0000 UTC m=+166097.800773355: ☑️ agreed by breezewish.
  • 2024-07-31 14:03:38.29078734 +0000 UTC m=+364534.570835409: ☑️ agreed by JaySon-Huang.

@ti-chi-bot ti-chi-bot bot merged commit 0856586 into pingcap:feature/vector-index Jul 31, 2024
5 of 7 checks passed
@Lloyd-Pottiger Lloyd-Pottiger deleted the cherry-pick-0 branch August 1, 2024 02:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants