-
Notifications
You must be signed in to change notification settings - Fork 191
feat(extensions): add unsigned integer extension types (u8, u16, u32, u64) #953
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
base: main
Are you sure you want to change the base?
Changes from 18 commits
d19c87a
a413f3e
b4bd79b
719ddb5
37a1a40
41cee40
10baf81
078ddbc
0d4aa26
8d37e9e
ec638bf
b7990a8
a14d6d7
856e63d
dbd3c8e
62a4767
7f577ce
4bec245
215fcee
cd6b2a8
fce64b0
04a8882
7c4c54a
3ac870f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,364 @@ | ||||||||||||||||||||||
| %YAML 1.2 | ||||||||||||||||||||||
| --- | ||||||||||||||||||||||
| urn: "extension:io.substrait:unsigned_integers" | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| types: | ||||||||||||||||||||||
| - name: u8 | ||||||||||||||||||||||
| description: Unsigned 8-bit integer (0 to 255) | ||||||||||||||||||||||
| structure: | ||||||||||||||||||||||
| value: str | ||||||||||||||||||||||
| - name: u16 | ||||||||||||||||||||||
| description: Unsigned 16-bit integer (0 to 65535) | ||||||||||||||||||||||
| structure: | ||||||||||||||||||||||
| value: str | ||||||||||||||||||||||
| - name: u32 | ||||||||||||||||||||||
| description: Unsigned 32-bit integer (0 to 4294967295) | ||||||||||||||||||||||
| structure: | ||||||||||||||||||||||
| value: str | ||||||||||||||||||||||
| - name: u64 | ||||||||||||||||||||||
| description: Unsigned 64-bit integer (0 to 18446744073709551615) | ||||||||||||||||||||||
| structure: | ||||||||||||||||||||||
| value: str | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| scalar_functions: | ||||||||||||||||||||||
|
vbarua marked this conversation as resolved.
|
||||||||||||||||||||||
| - | ||||||||||||||||||||||
| name: "add" | ||||||||||||||||||||||
| description: "Add two unsigned integer values." | ||||||||||||||||||||||
| impls: | ||||||||||||||||||||||
| - args: | ||||||||||||||||||||||
| - name: x | ||||||||||||||||||||||
| value: u!u8 | ||||||||||||||||||||||
| - name: y | ||||||||||||||||||||||
| value: u!u8 | ||||||||||||||||||||||
| options: | ||||||||||||||||||||||
| overflow: | ||||||||||||||||||||||
|
kadinrabo marked this conversation as resolved.
|
||||||||||||||||||||||
| values: [ SILENT, SATURATE, ERROR ] | ||||||||||||||||||||||
| return: u!u8 | ||||||||||||||||||||||
| - args: | ||||||||||||||||||||||
| - name: x | ||||||||||||||||||||||
| value: u!u16 | ||||||||||||||||||||||
| - name: y | ||||||||||||||||||||||
| value: u!u16 | ||||||||||||||||||||||
| options: | ||||||||||||||||||||||
| overflow: | ||||||||||||||||||||||
| values: [ SILENT, SATURATE, ERROR ] | ||||||||||||||||||||||
| return: u!u16 | ||||||||||||||||||||||
| - args: | ||||||||||||||||||||||
| - name: x | ||||||||||||||||||||||
| value: u!u32 | ||||||||||||||||||||||
| - name: y | ||||||||||||||||||||||
| value: u!u32 | ||||||||||||||||||||||
| options: | ||||||||||||||||||||||
| overflow: | ||||||||||||||||||||||
| values: [ SILENT, SATURATE, ERROR ] | ||||||||||||||||||||||
| return: u!u32 | ||||||||||||||||||||||
| - args: | ||||||||||||||||||||||
| - name: x | ||||||||||||||||||||||
| value: u!u64 | ||||||||||||||||||||||
| - name: y | ||||||||||||||||||||||
| value: u!u64 | ||||||||||||||||||||||
| options: | ||||||||||||||||||||||
| overflow: | ||||||||||||||||||||||
| values: [ SILENT, SATURATE, ERROR ] | ||||||||||||||||||||||
| return: u!u64 | ||||||||||||||||||||||
| - | ||||||||||||||||||||||
| name: "subtract" | ||||||||||||||||||||||
| description: "Subtract one unsigned integer value from another." | ||||||||||||||||||||||
| impls: | ||||||||||||||||||||||
| - args: | ||||||||||||||||||||||
| - name: x | ||||||||||||||||||||||
| value: u!u8 | ||||||||||||||||||||||
| - name: y | ||||||||||||||||||||||
| value: u!u8 | ||||||||||||||||||||||
| options: | ||||||||||||||||||||||
| overflow: | ||||||||||||||||||||||
| values: [ SILENT, SATURATE, ERROR ] | ||||||||||||||||||||||
| return: u!u8 | ||||||||||||||||||||||
| - args: | ||||||||||||||||||||||
| - name: x | ||||||||||||||||||||||
| value: u!u16 | ||||||||||||||||||||||
| - name: y | ||||||||||||||||||||||
| value: u!u16 | ||||||||||||||||||||||
| options: | ||||||||||||||||||||||
| overflow: | ||||||||||||||||||||||
| values: [ SILENT, SATURATE, ERROR ] | ||||||||||||||||||||||
| return: u!u16 | ||||||||||||||||||||||
| - args: | ||||||||||||||||||||||
| - name: x | ||||||||||||||||||||||
| value: u!u32 | ||||||||||||||||||||||
| - name: y | ||||||||||||||||||||||
| value: u!u32 | ||||||||||||||||||||||
| options: | ||||||||||||||||||||||
| overflow: | ||||||||||||||||||||||
| values: [ SILENT, SATURATE, ERROR ] | ||||||||||||||||||||||
| return: u!u32 | ||||||||||||||||||||||
| - args: | ||||||||||||||||||||||
| - name: x | ||||||||||||||||||||||
| value: u!u64 | ||||||||||||||||||||||
| - name: y | ||||||||||||||||||||||
| value: u!u64 | ||||||||||||||||||||||
| options: | ||||||||||||||||||||||
| overflow: | ||||||||||||||||||||||
| values: [ SILENT, SATURATE, ERROR ] | ||||||||||||||||||||||
| return: u!u64 | ||||||||||||||||||||||
| - | ||||||||||||||||||||||
| name: "multiply" | ||||||||||||||||||||||
| description: "Multiply two unsigned integer values." | ||||||||||||||||||||||
| impls: | ||||||||||||||||||||||
| - args: | ||||||||||||||||||||||
| - name: x | ||||||||||||||||||||||
| value: u!u8 | ||||||||||||||||||||||
| - name: y | ||||||||||||||||||||||
| value: u!u8 | ||||||||||||||||||||||
| options: | ||||||||||||||||||||||
| overflow: | ||||||||||||||||||||||
| values: [ SILENT, SATURATE, ERROR ] | ||||||||||||||||||||||
| return: u!u8 | ||||||||||||||||||||||
| - args: | ||||||||||||||||||||||
| - name: x | ||||||||||||||||||||||
| value: u!u16 | ||||||||||||||||||||||
| - name: y | ||||||||||||||||||||||
| value: u!u16 | ||||||||||||||||||||||
| options: | ||||||||||||||||||||||
| overflow: | ||||||||||||||||||||||
| values: [ SILENT, SATURATE, ERROR ] | ||||||||||||||||||||||
| return: u!u16 | ||||||||||||||||||||||
| - args: | ||||||||||||||||||||||
| - name: x | ||||||||||||||||||||||
| value: u!u32 | ||||||||||||||||||||||
| - name: y | ||||||||||||||||||||||
| value: u!u32 | ||||||||||||||||||||||
| options: | ||||||||||||||||||||||
| overflow: | ||||||||||||||||||||||
| values: [ SILENT, SATURATE, ERROR ] | ||||||||||||||||||||||
| return: u!u32 | ||||||||||||||||||||||
| - args: | ||||||||||||||||||||||
| - name: x | ||||||||||||||||||||||
| value: u!u64 | ||||||||||||||||||||||
| - name: y | ||||||||||||||||||||||
| value: u!u64 | ||||||||||||||||||||||
| options: | ||||||||||||||||||||||
| overflow: | ||||||||||||||||||||||
| values: [ SILENT, SATURATE, ERROR ] | ||||||||||||||||||||||
| return: u!u64 | ||||||||||||||||||||||
| - | ||||||||||||||||||||||
| name: "divide" | ||||||||||||||||||||||
| description: > | ||||||||||||||||||||||
| Divide x by y. Partial values are truncated (rounded towards 0). | ||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what happens if y is zero?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should include the divide description from substrait/extensions/functions_arithmetic.yaml Lines 177 to 186 in 2705258
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can go with something like this, thoughts? |
||||||||||||||||||||||
| impls: | ||||||||||||||||||||||
| - args: | ||||||||||||||||||||||
| - name: x | ||||||||||||||||||||||
| value: u!u8 | ||||||||||||||||||||||
| - name: y | ||||||||||||||||||||||
| value: u!u8 | ||||||||||||||||||||||
| options: | ||||||||||||||||||||||
| overflow: | ||||||||||||||||||||||
| values: [ SILENT, SATURATE, ERROR ] | ||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With signed integers, the overflow cases involve a sign change. With unsigned integers, this case isn't applicable, and in general overflow shouldn't be possible so we can drop this option fully for all of the impls. |
||||||||||||||||||||||
| on_domain_error: | ||||||||||||||||||||||
| values: [ "NULL", ERROR ] | ||||||||||||||||||||||
| on_division_by_zero: | ||||||||||||||||||||||
| values: [ "NULL", ERROR ] | ||||||||||||||||||||||
| return: u!u8 | ||||||||||||||||||||||
| - args: | ||||||||||||||||||||||
| - name: x | ||||||||||||||||||||||
| value: u!u16 | ||||||||||||||||||||||
| - name: y | ||||||||||||||||||||||
| value: u!u16 | ||||||||||||||||||||||
| options: | ||||||||||||||||||||||
| overflow: | ||||||||||||||||||||||
| values: [ SILENT, SATURATE, ERROR ] | ||||||||||||||||||||||
| on_domain_error: | ||||||||||||||||||||||
| values: [ "NULL", ERROR ] | ||||||||||||||||||||||
| on_division_by_zero: | ||||||||||||||||||||||
| values: [ "NULL", ERROR ] | ||||||||||||||||||||||
| return: u!u16 | ||||||||||||||||||||||
| - args: | ||||||||||||||||||||||
| - name: x | ||||||||||||||||||||||
| value: u!u32 | ||||||||||||||||||||||
| - name: y | ||||||||||||||||||||||
| value: u!u32 | ||||||||||||||||||||||
| options: | ||||||||||||||||||||||
| overflow: | ||||||||||||||||||||||
| values: [ SILENT, SATURATE, ERROR ] | ||||||||||||||||||||||
| on_domain_error: | ||||||||||||||||||||||
| values: [ "NULL", ERROR ] | ||||||||||||||||||||||
| on_division_by_zero: | ||||||||||||||||||||||
| values: [ "NULL", ERROR ] | ||||||||||||||||||||||
| return: u!u32 | ||||||||||||||||||||||
| - args: | ||||||||||||||||||||||
| - name: x | ||||||||||||||||||||||
| value: u!u64 | ||||||||||||||||||||||
| - name: y | ||||||||||||||||||||||
| value: u!u64 | ||||||||||||||||||||||
| options: | ||||||||||||||||||||||
| overflow: | ||||||||||||||||||||||
| values: [ SILENT, SATURATE, ERROR ] | ||||||||||||||||||||||
| on_domain_error: | ||||||||||||||||||||||
| values: [ "NULL", ERROR ] | ||||||||||||||||||||||
| on_division_by_zero: | ||||||||||||||||||||||
| values: [ "NULL", ERROR ] | ||||||||||||||||||||||
| return: u!u64 | ||||||||||||||||||||||
| - | ||||||||||||||||||||||
| name: "modulus" | ||||||||||||||||||||||
|
vbarua marked this conversation as resolved.
Outdated
|
||||||||||||||||||||||
| description: > | ||||||||||||||||||||||
| Calculate the remainder when dividing dividend (x) by divisor (y). | ||||||||||||||||||||||
| impls: | ||||||||||||||||||||||
| - args: | ||||||||||||||||||||||
| - name: x | ||||||||||||||||||||||
| value: u!u8 | ||||||||||||||||||||||
| - name: y | ||||||||||||||||||||||
| value: u!u8 | ||||||||||||||||||||||
| options: | ||||||||||||||||||||||
| division_type: | ||||||||||||||||||||||
| values: [ TRUNCATE, FLOOR ] | ||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is substrait/tests/cases/arithmetic/modulus.test Lines 18 to 20 in e4ce3f8
|
||||||||||||||||||||||
| overflow: | ||||||||||||||||||||||
| values: [ SILENT, SATURATE, ERROR ] | ||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can... modulus even overflow? |
||||||||||||||||||||||
| on_domain_error: | ||||||||||||||||||||||
| values: [ "NULL", ERROR ] | ||||||||||||||||||||||
| return: u!u8 | ||||||||||||||||||||||
| - args: | ||||||||||||||||||||||
| - name: x | ||||||||||||||||||||||
| value: u!u16 | ||||||||||||||||||||||
| - name: y | ||||||||||||||||||||||
| value: u!u16 | ||||||||||||||||||||||
| options: | ||||||||||||||||||||||
| division_type: | ||||||||||||||||||||||
| values: [ TRUNCATE, FLOOR ] | ||||||||||||||||||||||
| overflow: | ||||||||||||||||||||||
| values: [ SILENT, SATURATE, ERROR ] | ||||||||||||||||||||||
| on_domain_error: | ||||||||||||||||||||||
| values: [ "NULL", ERROR ] | ||||||||||||||||||||||
| return: u!u16 | ||||||||||||||||||||||
| - args: | ||||||||||||||||||||||
| - name: x | ||||||||||||||||||||||
| value: u!u32 | ||||||||||||||||||||||
| - name: y | ||||||||||||||||||||||
| value: u!u32 | ||||||||||||||||||||||
| options: | ||||||||||||||||||||||
| division_type: | ||||||||||||||||||||||
| values: [ TRUNCATE, FLOOR ] | ||||||||||||||||||||||
| overflow: | ||||||||||||||||||||||
| values: [ SILENT, SATURATE, ERROR ] | ||||||||||||||||||||||
| on_domain_error: | ||||||||||||||||||||||
| values: [ "NULL", ERROR ] | ||||||||||||||||||||||
| return: u!u32 | ||||||||||||||||||||||
| - args: | ||||||||||||||||||||||
| - name: x | ||||||||||||||||||||||
| value: u!u64 | ||||||||||||||||||||||
| - name: y | ||||||||||||||||||||||
| value: u!u64 | ||||||||||||||||||||||
| options: | ||||||||||||||||||||||
| division_type: | ||||||||||||||||||||||
| values: [ TRUNCATE, FLOOR ] | ||||||||||||||||||||||
| overflow: | ||||||||||||||||||||||
| values: [ SILENT, SATURATE, ERROR ] | ||||||||||||||||||||||
| on_domain_error: | ||||||||||||||||||||||
| values: [ "NULL", ERROR ] | ||||||||||||||||||||||
| return: u!u64 | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| aggregate_functions: | ||||||||||||||||||||||
| - name: "sum" | ||||||||||||||||||||||
| description: Sum a set of unsigned integer values. The sum of zero elements yields null. | ||||||||||||||||||||||
|
kadinrabo marked this conversation as resolved.
|
||||||||||||||||||||||
| impls: | ||||||||||||||||||||||
| - args: | ||||||||||||||||||||||
| - name: x | ||||||||||||||||||||||
| value: u!u8 | ||||||||||||||||||||||
| options: | ||||||||||||||||||||||
| overflow: | ||||||||||||||||||||||
| values: [ SILENT, SATURATE, ERROR ] | ||||||||||||||||||||||
| nullability: DECLARED_OUTPUT | ||||||||||||||||||||||
| decomposable: MANY | ||||||||||||||||||||||
| intermediate: u!u64? | ||||||||||||||||||||||
| return: u!u64? | ||||||||||||||||||||||
| - args: | ||||||||||||||||||||||
| - name: x | ||||||||||||||||||||||
| value: u!u16 | ||||||||||||||||||||||
| options: | ||||||||||||||||||||||
| overflow: | ||||||||||||||||||||||
| values: [ SILENT, SATURATE, ERROR ] | ||||||||||||||||||||||
| nullability: DECLARED_OUTPUT | ||||||||||||||||||||||
| decomposable: MANY | ||||||||||||||||||||||
| intermediate: u!u64? | ||||||||||||||||||||||
| return: u!u64? | ||||||||||||||||||||||
| - args: | ||||||||||||||||||||||
| - name: x | ||||||||||||||||||||||
| value: u!u32 | ||||||||||||||||||||||
| options: | ||||||||||||||||||||||
| overflow: | ||||||||||||||||||||||
| values: [ SILENT, SATURATE, ERROR ] | ||||||||||||||||||||||
| nullability: DECLARED_OUTPUT | ||||||||||||||||||||||
| decomposable: MANY | ||||||||||||||||||||||
| intermediate: u!u64? | ||||||||||||||||||||||
| return: u!u64? | ||||||||||||||||||||||
| - args: | ||||||||||||||||||||||
| - name: x | ||||||||||||||||||||||
| value: u!u64 | ||||||||||||||||||||||
| options: | ||||||||||||||||||||||
| overflow: | ||||||||||||||||||||||
| values: [ SILENT, SATURATE, ERROR ] | ||||||||||||||||||||||
| nullability: DECLARED_OUTPUT | ||||||||||||||||||||||
| decomposable: MANY | ||||||||||||||||||||||
| intermediate: u!u64? | ||||||||||||||||||||||
| return: u!u64? | ||||||||||||||||||||||
| - name: "min" | ||||||||||||||||||||||
| description: Min of a set of unsigned integer values. | ||||||||||||||||||||||
| impls: | ||||||||||||||||||||||
| - args: | ||||||||||||||||||||||
| - name: x | ||||||||||||||||||||||
| value: u!u8 | ||||||||||||||||||||||
| nullability: DECLARED_OUTPUT | ||||||||||||||||||||||
| decomposable: MANY | ||||||||||||||||||||||
| intermediate: u!u8? | ||||||||||||||||||||||
| return: u!u8? | ||||||||||||||||||||||
| - args: | ||||||||||||||||||||||
| - name: x | ||||||||||||||||||||||
| value: u!u16 | ||||||||||||||||||||||
| nullability: DECLARED_OUTPUT | ||||||||||||||||||||||
| decomposable: MANY | ||||||||||||||||||||||
| intermediate: u!u16? | ||||||||||||||||||||||
| return: u!u16? | ||||||||||||||||||||||
| - args: | ||||||||||||||||||||||
| - name: x | ||||||||||||||||||||||
| value: u!u32 | ||||||||||||||||||||||
| nullability: DECLARED_OUTPUT | ||||||||||||||||||||||
| decomposable: MANY | ||||||||||||||||||||||
| intermediate: u!u32? | ||||||||||||||||||||||
| return: u!u32? | ||||||||||||||||||||||
| - args: | ||||||||||||||||||||||
| - name: x | ||||||||||||||||||||||
| value: u!u64 | ||||||||||||||||||||||
| nullability: DECLARED_OUTPUT | ||||||||||||||||||||||
| decomposable: MANY | ||||||||||||||||||||||
| intermediate: u!u64? | ||||||||||||||||||||||
| return: u!u64? | ||||||||||||||||||||||
| - name: "max" | ||||||||||||||||||||||
| description: Max of a set of unsigned integer values. | ||||||||||||||||||||||
| impls: | ||||||||||||||||||||||
| - args: | ||||||||||||||||||||||
| - name: x | ||||||||||||||||||||||
| value: u!u8 | ||||||||||||||||||||||
| nullability: DECLARED_OUTPUT | ||||||||||||||||||||||
| decomposable: MANY | ||||||||||||||||||||||
| intermediate: u!u8? | ||||||||||||||||||||||
| return: u!u8? | ||||||||||||||||||||||
| - args: | ||||||||||||||||||||||
| - name: x | ||||||||||||||||||||||
| value: u!u16 | ||||||||||||||||||||||
| nullability: DECLARED_OUTPUT | ||||||||||||||||||||||
| decomposable: MANY | ||||||||||||||||||||||
| intermediate: u!u16? | ||||||||||||||||||||||
| return: u!u16? | ||||||||||||||||||||||
| - args: | ||||||||||||||||||||||
| - name: x | ||||||||||||||||||||||
| value: u!u32 | ||||||||||||||||||||||
| nullability: DECLARED_OUTPUT | ||||||||||||||||||||||
| decomposable: MANY | ||||||||||||||||||||||
| intermediate: u!u32? | ||||||||||||||||||||||
| return: u!u32? | ||||||||||||||||||||||
| - args: | ||||||||||||||||||||||
| - name: x | ||||||||||||||||||||||
| value: u!u64 | ||||||||||||||||||||||
| nullability: DECLARED_OUTPUT | ||||||||||||||||||||||
| decomposable: MANY | ||||||||||||||||||||||
| intermediate: u!u64? | ||||||||||||||||||||||
| return: u!u64? | ||||||||||||||||||||||
|
kadinrabo marked this conversation as resolved.
|
Uh oh!
There was an error while loading. Please reload this page.