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

Support built-in MySQL functions ABS #9774

Closed
wants to merge 98 commits into from
Closed

Support built-in MySQL functions ABS #9774

wants to merge 98 commits into from

Conversation

tianshishuo
Copy link

Description

evalengine: Support built-in MySQL functions--abs()

Related Issue(s)

Contributes to evalengine: Support all built-in MySQL functions

Checklist

  • Should this PR be backported?
  • Tests were added or are not required
  • Documentation was added or is not required

Deployment Notes

@tianshishuo tianshishuo changed the title Abs function add Support built-in MySQL functions--abs() Feb 24, 2022
@tianshishuo tianshishuo changed the title Support built-in MySQL functions--abs() Support built-in MySQL functions ABS Feb 24, 2022
@vmg vmg self-assigned this Feb 24, 2022
Copy link
Collaborator

@vmg vmg 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 your first contribution to Vitess! I've left some feedback on things that need to be fixed -- particularly related to testing.

go/vt/vtgate/evalengine/abs.go Outdated Show resolved Hide resolved
go/vt/vtgate/evalengine/abs.go Outdated Show resolved Hide resolved
go/vt/vtgate/evalengine/abs_test.go Outdated Show resolved Hide resolved
go/vt/vtgate/evalengine/abs.go Outdated Show resolved Hide resolved
@vmg vmg added the Component: Evalengine changes to the evaluation engine label Feb 28, 2022
"testing"
)

func Test_buildinAbs_call(t *testing.T) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

As I explained on my previous review, these are not good unit tests. They look like they've been auto-generated by an IDE, as the test table contains arguments that are always the same, and most puzzlingly, you're not actually verifying the output of the function you're testing!

You should instead focus on writing integration tests in integration/comparison_test.go. If those tests are comprehensive enough, this particular test will be superfluous.

tianshishuo and others added 20 commits March 1, 2022 19:38
Signed-off-by: tianshishuo <[email protected]>
Signed-off-by: notfelineit <[email protected]>
Signed-off-by: tianshishuo <[email protected]>
Signed-off-by: notfelineit <[email protected]>

Remove stubbed validation errors

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

Restyle page

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

Refactor

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

Add error state

Signed-off-by: notfelineit <[email protected]>
Signed-off-by: tianshishuo <[email protected]>
Signed-off-by: notfelineit <[email protected]>

Remove helper method

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

Cleanup logs

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

Undo accidental , unrelated changes to dynamic discovery

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

Undo changes to env.sh

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

Thread through vtadmin api

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

Hook up UI to ValidateSchemaKeyspace

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

Add comments to ValidateSchemaKeyspace

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

Modify ValidateSchemaKeyspace to match old ValidateSchemaKeyspace in term of params

Signed-off-by: notfelineit <[email protected]>
Signed-off-by: tianshishuo <[email protected]>
Signed-off-by: notfelineit <[email protected]>

connect to vtadmin

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

Fix nil pointer bug

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

Fix linter issues

Signed-off-by: notfelineit <[email protected]>
Signed-off-by: tianshishuo <[email protected]>
Signed-off-by: notfelineit <[email protected]>

Add skipNoPrimary test

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

Add GetVersion to vtctldServer and add test for ValidateVersionKeyspace

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

Switch vtctlclient to use new version of ValidateVersionKeyspace

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

Address PR comments

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

Replace wrangler methods with vtctldserver replacements

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

Fix type issues

Signed-off-by: notfelineit <[email protected]>
Signed-off-by: tianshishuo <[email protected]>
Signed-off-by: notfelineit <[email protected]>
Signed-off-by: tianshishuo <[email protected]>
Signed-off-by: notfelineit <[email protected]>
Signed-off-by: tianshishuo <[email protected]>
Signed-off-by: notfelineit <[email protected]>
Signed-off-by: tianshishuo <[email protected]>
Signed-off-by: Alon Kenneth <[email protected]>
Signed-off-by: tianshishuo <[email protected]>
Signed-off-by: Alon Kenneth <[email protected]>
Signed-off-by: akenneth <[email protected]>
Signed-off-by: tianshishuo <[email protected]>
…rade build

Signed-off-by: Florent Poinsard <[email protected]>
Signed-off-by: tianshishuo <[email protected]>
Signed-off-by: Florent Poinsard <[email protected]>
Signed-off-by: tianshishuo <[email protected]>
ajm188 and others added 10 commits March 1, 2022 19:40
In the original implementation, bidiStream used one channel, `errch`, to
receive both mid-stream errors and "the stream is closed now" errors.
This meant that, due to go's pseudo-random channel selection, if the
stream was closed and there were still messages in the stream (so, both
`ch` and `errch` were select-able), then there was a chance that an
adapter's `Recv()` would return `io.EOF` even though there were still
responses to pull off the stream.

This version moves to a more context-cancel like paradigm, using a
separate context to check if the stream is closed. Then, we adjust the
template for `Recv` to select:

1. Is stream context done
2. Is streamclosed context done
4. Does mid-stream error channel have an error
3. Does message channel have a message

And the template for `Send` to:

1. If streamclosed context done, return `errStreamClosed`; otherwise
2. Send to the message channel and return nil

<hr/>

Note that this commit also makes a more public/exported API for
bidiStream, to set up a simpler (diff-wise) filemove in a later change.

Signed-off-by: Andrew Mason <[email protected]>
Signed-off-by: tianshishuo <[email protected]>
…vt/vtctl`

Turns out this construct is useful for writing stream-based unit tests
for `grpcvtctldserver`, and this lets us reuse this code there without
exporting it completely.

Signed-off-by: Andrew Mason <[email protected]>
Signed-off-by: tianshishuo <[email protected]>
Signed-off-by: Andrew Mason <[email protected]>
Signed-off-by: tianshishuo <[email protected]>
These were undocumented and broken, and they are no longer needed
with the docker_local container being the preferred method for
quick testing.

Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: tianshishuo <[email protected]>
… command path

Signed-off-by: Andrew Mason <[email protected]>
Signed-off-by: tianshishuo <[email protected]>
Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: tianshishuo <[email protected]>
We already do this for BLOB and VARBINARY

Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: tianshishuo <[email protected]>
…e server behavior by version

Signed-off-by: Shlomi Noach <[email protected]>
Signed-off-by: tianshishuo <[email protected]>
Signed-off-by: tianshishuo <[email protected]>
@vmg
Copy link
Collaborator

vmg commented Mar 1, 2022

There are, for some reason, 98 commits in this PR now. It looks like you screwed up a merge or a rebase. You'll need to fix this into (ideally) a single commit so we can review. Thanks!

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Evalengine changes to the evaluation engine
Projects
None yet
Development

Successfully merging this pull request may close these issues.