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

[FEA] More efficient bound check for GpuCast #6130

Closed
ttnghia opened this issue Jul 28, 2022 · 0 comments · Fixed by #6681
Closed

[FEA] More efficient bound check for GpuCast #6130

ttnghia opened this issue Jul 28, 2022 · 0 comments · Fixed by #6681
Assignees
Labels
performance A performance related task/issue

Comments

@ttnghia
Copy link
Collaborator

ttnghia commented Jul 28, 2022

In GpuCast, when ansi mode is enabled, the input column is checked if all its values are within the boundary values of the target type. Such check is performed by calling the assertValuesInRange function.

However, that function is inefficient: It calls lessThan operator, then any, then greaterThan, and then any again. All these operators run in O(N) time. We can achieve the same result but in half of the computation by using a new approach:

  • Call min and max on the input column, which both run in O(N) time, then
  • Compare the min/max values with the boundary values of the target type. This is just O(1) time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance A performance related task/issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants