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

[C++][Compute] Add floor, ceiling, and truncate kernels #28487

Closed
asfimport opened this issue May 11, 2021 · 5 comments
Closed

[C++][Compute] Add floor, ceiling, and truncate kernels #28487

asfimport opened this issue May 11, 2021 · 5 comments

Comments

@asfimport
Copy link
Collaborator

asfimport commented May 11, 2021

Kernels to round each value in an array of floating point numbers to:

  • the nearest integer less than or equal to it (floor)

  • the nearest integer greater than or equal to it (ceiling)

  • the integral part without fraction digits

    Should return an array of the same type as the input (not an integer type)

Reporter: Ian Cook / @ianmcook
Assignee: Eduardo Ponce / @edponce

Related issues:

PRs and other links:

Note: This issue was originally created as ARROW-12745. Please see the migration documentation for further details.

@asfimport
Copy link
Collaborator Author

Eduardo Ponce / @edponce:
These are special cases of the round kernels (ARROW-12744) or viceversa.

@asfimport
Copy link
Collaborator Author

Eduardo Ponce / @edponce:
@ianmcook why would ceiling/floor spec be to not return integral values? By definition their result is an integral value, and R and SQL both return an integer type. On the other hand, numpy returns float64.

@asfimport
Copy link
Collaborator Author

Ian Cook / @ianmcook:
@edponce I believe that is incorrect; R's ceiling and floor functions return numeric vectors (R's double type). In most SQL engines I've looked at, the ceil and floor functions return a column with the same type as the input.

@asfimport
Copy link
Collaborator Author

Eduardo Ponce / @edponce:
You are correct, I ran examples and R returns "double" type, and SQL engines match output to numeric type of input. I have no objection against this, and now recognize that my doubt arose from mixing the mathematical definition of an integral value with the type system of computing tools. Thanks!

@asfimport
Copy link
Collaborator Author

David Li / @lidavidm:
Issue resolved by pull request 10727
#10727

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

No branches or pull requests

1 participant