-
Notifications
You must be signed in to change notification settings - Fork 11
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
[Func/Arith] Multiply, Division and Modulus #32
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have some questions regarding the modulus function in various kernels.
@@ -67,8 +67,6 @@ scalar_functions: | |||
- name: modulus | |||
local_name: "%" | |||
infix: True | |||
required_options: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
postgres supports modulus with numeric operands, but as per Substrait documentation, it should only work on integer values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll need to update the substrait docs here too
@@ -37,8 +37,6 @@ scalar_functions: | |||
- name: modulus | |||
local_name: "%" | |||
infix: True | |||
required_options: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SQLite supports two different operations for modulus.
%
operator that will not work for non-integer operands.mod
function that shall work for non-integer operands.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to test both?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not right now. AFAIK, right now the BFT assumes every dialect has only one implementation of a function. I will create an issue to make it change.
rounding: TIE_TO_EVEN | ||
on_division_by_zero: LIMIT | ||
on_domain_error: NAN | ||
- name: modulus |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cudf also supports mod
function on floating points, while the substrait documentation states operation on only integer arguments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll make this change in the substrait spec.
is 0. This is the default behavior in many systems because it helps to avoid | ||
bias in rounding. | ||
|
||
#### TIE_AWAY_FROM_ZERO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally we would point to these common options instead of duplicating them everywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sanjibansg let's use this PR to address the duplication issues
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will have some framework-level changes. I have thought to make a separate YAML file containing the definition of such options. Functions that follow such options, and do not have any exceptions, should fetch the definition from that YAML, or should have their own definition here. I will make a separate PR for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR adds the Multiply, Division, and Modulus functions.