Skip to content

Multiplication operation expression#5186

Merged
sougou merged 27 commits intovitessio:masterfrom
planetscale:rk-newmult
Oct 5, 2019
Merged

Multiplication operation expression#5186
sougou merged 27 commits intovitessio:masterfrom
planetscale:rk-newmult

Conversation

@rasikakale
Copy link
Copy Markdown

partial fix for #5098

  • Implemented Multiply() to return a Value or an error. The output for this function represents the same output when two values are multiplied in MySQL. The following functions were added to achieve this:
    • mutliplyNumericWithError() - operates the same way as addNumericWithError(), and returns a numeric or an error

    • intTimesIntWithError() - operates the same way as intPlusIntWithError(), except both values are multiplied

      • Checks if first value is not equal to zero and if the quotient between the result and the first value is not equal to the second value. Returns a BIGINT error if condition is satisfied.
    • uintTimesIntWithError() - Checks if second value is less than 0 or if int64(first value) if less than 0. If so, then returns BIGINT UNSIGNED error. Otherwise, called uintTimesUintWithError().

    • uintTimesUintWithError() - Checks if result is less than first and second value. If so, then returns a BIGINT UNSIGNED error. Otherwise, returns Uint64 product.

    • floatTimesAny() - Returns a numeric float64 values after multiplying a float64 value and a non-float64 value

Rasika Kale and others added 26 commits August 27, 2019 15:42
…c.go

- Added tests for Multiply() in arithmetic_test.go to cover code coverage
- Implemented additional function floatTimesAny() to account for float values

Signed-off-by: Rasika Kale <rasika@planetscale.com>
Signed-off-by: Rasika Kale <rasika@planetscale.com>
Signed-off-by: Rasika Kale <rasika@planetscale.com>
Signed-off-by: Rasika Kale <rasika@planetscale.com>
- Added more tests in TestMultiply() in arithmetic_test.go to increase code coverage

Signed-off-by: Rasika Kale <rasika@planetscale.com>
- Added more tests in arithmetic_test.go to confirm code is covered and error checking works

Signed-off-by: Rasika Kale <rasika@planetscale.com>
Signed-off-by: Rasika Kale <rasika@planetscale.com>
Signed-off-by: Rasika Kale <rasika@planetscale.com>
Signed-off-by: Rasika Kale <rasika@planetscale.com>

Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
- Added more tests in arithmetic_test.go to fix code coverage
- Added error checking into arithmetic.go
- Implemented function floatMinusAny() for subtraction expression

Signed-off-by: Rasika Kale <rasika@planetscale.com>
Signed-off-by: Rasika Kale <rasika@planetscale.com>
Signed-off-by: Rasika Kale <rasika@planetscale.com>
Signed-off-by: Rasika Kale <rasika@planetscale.com>
…c.go

- Added tests for Multiply() in arithmetic_test.go to cover code coverage
- Implemented additional function floatTimesAny() to account for float values

Signed-off-by: Rasika Kale <rasika@planetscale.com>
Signed-off-by: Rasika Kale <rasika@planetscale.com>
Signed-off-by: Rasika Kale <rasika@planetscale.com>
Signed-off-by: Rasika Kale <rasika@planetscale.com>
- Added more tests in TestMultiply() in arithmetic_test.go to increase code coverage

Signed-off-by: Rasika Kale <rasika@planetscale.com>
- Added more tests in arithmetic_test.go to confirm code is covered and error checking works

Signed-off-by: Rasika Kale <rasika@planetscale.com>
Signed-off-by: Rasika Kale <rasika@planetscale.com>
Signed-off-by: Morgan Tocker <tocker@gmail.com>
… a split

Signed-off-by: Yufei Chen <yufei@squareup.com>
ALso removes unused capabiltities code to silence staticcheck warning.

Signed-off-by: Morgan Tocker <tocker@gmail.com>
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
…wmult

Signed-off-by: Rasika Kale <rasika@planetscale.com>
Signed-off-by: Rasika Kale <rasika@planetscale.com>
@rasikakale rasikakale requested a review from sougou as a code owner September 12, 2019 21:30
Signed-off-by: Rasika Kale <rasika@planetscale.com>
@sougou sougou changed the title WIP: Multiplication operation expression Multiplication operation expression Oct 5, 2019
Copy link
Copy Markdown
Contributor

@sougou sougou left a comment

Choose a reason for hiding this comment

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

We'll get this merged for now. I think further refactoring will be needed after the rest of the operations are added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants