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

Decimal-128 support for mod and pmod #4794

Merged
merged 3 commits into from
Feb 16, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions docs/supported_ops.md
Original file line number Diff line number Diff line change
Expand Up @@ -9271,7 +9271,7 @@ are limited.
<td> </td>
<td> </td>
<td> </td>
<td><b>NS</b></td>
<td>S</td>
<td> </td>
<td> </td>
<td> </td>
Expand All @@ -9292,7 +9292,7 @@ are limited.
<td> </td>
<td> </td>
<td> </td>
<td><b>NS</b></td>
<td>S</td>
<td> </td>
<td> </td>
<td> </td>
Expand All @@ -9313,7 +9313,7 @@ are limited.
<td> </td>
<td> </td>
<td> </td>
<td><b>NS</b></td>
<td>S</td>
<td> </td>
<td> </td>
<td> </td>
Expand Down Expand Up @@ -10227,7 +10227,7 @@ are limited.
<td> </td>
<td> </td>
<td> </td>
<td><b>NS</b></td>
<td>S</td>
<td> </td>
<td> </td>
<td> </td>
Expand All @@ -10248,7 +10248,7 @@ are limited.
<td> </td>
<td> </td>
<td> </td>
<td><b>NS</b></td>
<td>S</td>
<td> </td>
<td> </td>
<td> </td>
Expand All @@ -10269,7 +10269,7 @@ are limited.
<td> </td>
<td> </td>
<td> </td>
<td><b>NS</b></td>
<td>S</td>
<td> </td>
<td> </td>
<td> </td>
Expand Down
7 changes: 4 additions & 3 deletions integration_tests/src/main/python/arithmetic_ops_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def test_int_division_mixed(lhs, rhs):
'a DIV b'),
conf=allow_negative_scale_of_decimal_conf)

@pytest.mark.parametrize('data_gen', numeric_gens, ids=idfn)
@pytest.mark.parametrize('data_gen', numeric_gens + decimal_128_gens, ids=idfn)
jlowe marked this conversation as resolved.
Show resolved Hide resolved
def test_mod(data_gen):
data_type = data_gen.data_type
assert_gpu_and_cpu_are_equal_collect(
Expand All @@ -245,9 +245,10 @@ def test_mod(data_gen):
f.lit(-12).cast(data_type) % f.col('b'),
f.lit(None).cast(data_type) % f.col('a'),
f.col('b') % f.lit(None).cast(data_type),
f.col('a') % f.col('b')))
f.col('a') % f.col('b')),
conf=allow_negative_scale_of_decimal_conf)

@pytest.mark.parametrize('data_gen', numeric_gens, ids=idfn)
@pytest.mark.parametrize('data_gen', numeric_gens + decimal_128_gens_no_neg, ids=idfn)
def test_pmod(data_gen):
string_type = to_cast_string(data_gen.data_type)
assert_gpu_and_cpu_are_equal_collect(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1827,9 +1827,9 @@ object GpuOverrides extends Logging {
}),
expr[Pmod](
"Pmod",
ExprChecks.binaryProject(TypeSig.integral + TypeSig.fp, TypeSig.cpuNumeric,
("lhs", TypeSig.integral + TypeSig.fp, TypeSig.cpuNumeric),
("rhs", TypeSig.integral + TypeSig.fp, TypeSig.cpuNumeric)),
ExprChecks.binaryProject(TypeSig.gpuNumeric, TypeSig.cpuNumeric,
("lhs", TypeSig.gpuNumeric, TypeSig.cpuNumeric),
("rhs", TypeSig.gpuNumeric, TypeSig.cpuNumeric)),
(a, conf, p, r) => new BinaryExprMeta[Pmod](a, conf, p, r) {
override def convertToGpu(lhs: Expression, rhs: Expression): GpuExpression =
GpuPmod(lhs, rhs)
Expand Down Expand Up @@ -2117,9 +2117,9 @@ object GpuOverrides extends Logging {
expr[Remainder](
"Remainder or modulo",
ExprChecks.binaryProject(
TypeSig.integral + TypeSig.fp, TypeSig.cpuNumeric,
("lhs", TypeSig.integral + TypeSig.fp, TypeSig.cpuNumeric),
("rhs", TypeSig.integral + TypeSig.fp, TypeSig.cpuNumeric)),
TypeSig.gpuNumeric, TypeSig.cpuNumeric,
("lhs", TypeSig.gpuNumeric, TypeSig.cpuNumeric),
("rhs", TypeSig.gpuNumeric, TypeSig.cpuNumeric)),
(a, conf, p, r) => new BinaryExprMeta[Remainder](a, conf, p, r) {
override def convertToGpu(lhs: Expression, rhs: Expression): GpuExpression =
GpuRemainder(lhs, rhs)
Expand Down