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

feat: Support MySQL CAST_DECIMAL function #572

Merged
merged 4 commits into from
Jan 14, 2023

Conversation

robbinhan
Copy link
Contributor

What this PR does:
Support MySQL CAST_DECIMAL function #571

@dongzl dongzl added the SQL SQL support label Dec 11, 2022
@dongzl dongzl added this to the 0.2.0 milestone Dec 11, 2022
return nil, errors.WithStack(err)
}
if maxNum == nil {
maxNum = 0
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe the default max num is 10, refer to https://dev.mysql.com/doc/refman/5.6/en/fixed-point-types.html.

@Mulavar
Copy link
Contributor

Mulavar commented Dec 18, 2022

pls resolve the conflict.

# Conflicts:
#	pkg/runtime/function/left.go
#	pkg/runtime/function/power.go
#	pkg/runtime/function/rand.go
#	pkg/runtime/function/rpad.go
#	pkg/runtime/function/sin.go
@codecov-commenter
Copy link

codecov-commenter commented Dec 21, 2022

Codecov Report

Base: 35.50% // Head: 35.50% // No change to project coverage 👍

Coverage data is based on head (769513e) compared to base (9254ad9).
Patch has no changes to coverable lines.

❗ Current head 769513e differs from pull request most recent head 43ea6a5. Consider uploading reports for the commit 43ea6a5 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #572   +/-   ##
=======================================
  Coverage   35.50%   35.50%           
=======================================
  Files         188      188           
  Lines       21490    21490           
=======================================
  Hits         7630     7630           
  Misses      12977    12977           
  Partials      883      883           
Impacted Files Coverage Δ
pkg/runtime/function/power.go 64.00% <ø> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

if err != nil {
return nil, errors.WithStack(err)
}
v := math.ToDecimal(val)
Copy link
Contributor

Choose a reason for hiding this comment

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

Use val.Decimal() instead.

if precision == nil {
precision = 0
}
d, err := strconv.Atoi(fmt.Sprint(precision))
Copy link
Contributor

Choose a reason for hiding this comment

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

Use precision.Int64() instead.

@jjeffcaii jjeffcaii merged commit 100de95 into arana-db:master Jan 14, 2023
GavinLam164 pushed a commit to GavinLam164/arana that referenced this pull request Feb 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SQL SQL support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants