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

Make creation of a Scalar decimal value simpler #2076

Closed
razajafri opened this issue Apr 3, 2021 · 3 comments · Fixed by #4482
Closed

Make creation of a Scalar decimal value simpler #2076

razajafri opened this issue Apr 3, 2021 · 3 comments · Fixed by #4482
Assignees
Labels
task Work required that improves the product but is not user facing

Comments

@razajafri
Copy link
Collaborator

So the original code that this was commented on is

        if (DecimalType.is32BitDecimalType(dt)) {
          withResource(Scalar.fromDecimal(-scale, 0)) { scalar =>
            scalar.sub(input.getBase)
          }
        } else {
          withResource(Scalar.fromDecimal(-scale, 0L)) { scalar =>
            scalar.sub(input.getBase)
          }
        }

Is there a way to make an API where we could combine the two if blocks?
Originally posted by @revans2 in #1717 (comment)

@razajafri razajafri changed the title It would be nice to make creating a Scalar decimal value simpler.ting a Scalar decimal value simpler. That way we could combine the code together a bit better. Make creation of a Scalar decimal value simpler Apr 3, 2021
@sameerz sameerz added the task Work required that improves the product but is not user facing label Dec 7, 2021
@kuhushukla
Copy link
Collaborator

We can add a generic fromDecimal is templated or uses Object and we pass the precision or some metadata bit to do this logic through the API.

@revans2
Copy link
Collaborator

revans2 commented Dec 9, 2021

The code in question is gone now. We already have a GpuScalar.from that does this and has replaced most calls. I think this is good enough.

@kuhushukla
Copy link
Collaborator

kuhushukla commented Dec 9, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
task Work required that improves the product but is not user facing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants