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

Add tests for pylibcudf binaryops #15470

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
1b482bf
patch changes from original PR
brandon-b-miller Apr 4, 2024
0a46a0f
first halfway decent testing strategy
brandon-b-miller Apr 4, 2024
f5f33e6
refactor out a lot of repeated code
brandon-b-miller Apr 4, 2024
61ab85b
cleanup
brandon-b-miller Apr 4, 2024
ba03539
add some more tests
brandon-b-miller Apr 4, 2024
4911f33
start to work nulls in
brandon-b-miller Apr 5, 2024
9eba971
merge latest/resolve conflicts
brandon-b-miller Jul 1, 2024
562c765
start to refactor, pass add, almost sub
brandon-b-miller Jul 1, 2024
e533469
simpler approach
brandon-b-miller Jul 8, 2024
b81e017
Merge branch 'branch-24.08' into pylibcudf-binops-tests
brandon-b-miller Jul 8, 2024
e5f34e7
merge latest / resolve conflicts
brandon-b-miller Jul 9, 2024
322a7de
address reviews
brandon-b-miller Jul 9, 2024
ecbb895
refactor again
brandon-b-miller Jul 10, 2024
076b83d
address reviews, add tests
brandon-b-miller Jul 10, 2024
e06d5cd
fix a few ops
brandon-b-miller Jul 11, 2024
473845f
few more fixes
brandon-b-miller Jul 11, 2024
6e0c816
address more reviews
brandon-b-miller Jul 15, 2024
f0a62a9
Merge branch 'branch-24.08' into pylibcudf-binops-tests
brandon-b-miller Jul 16, 2024
77c709f
fix cpp test
brandon-b-miller Jul 16, 2024
4e653d6
fix atan2
brandon-b-miller Jul 16, 2024
6968f95
update assert_column_eq to handle nans
brandon-b-miller Jul 16, 2024
cc8afe9
only check nans for floating
brandon-b-miller Jul 16, 2024
12a748b
Merge branch 'branch-24.08' into pylibcudf-binops-tests
brandon-b-miller Jul 16, 2024
8c44149
address reviews
brandon-b-miller Jul 18, 2024
959e9a7
refactor again
brandon-b-miller Jul 18, 2024
367dfe9
merge /resolve
brandon-b-miller Jul 18, 2024
849e586
adjust docstring
brandon-b-miller Jul 18, 2024
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
25 changes: 24 additions & 1 deletion python/cudf/cudf/_lib/pylibcudf/binaryop.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from cython.operator import dereference

from libcpp cimport bool
from libcpp.memory cimport unique_ptr
from libcpp.utility cimport move

Expand Down Expand Up @@ -86,12 +87,34 @@ cpdef Column binary_operation(
return Column.from_libcudf(move(result))


def is_supported_operation(
cpdef bool is_supported_operation(
DataType out,
DataType lhs,
DataType rhs,
binary_operator op
):
"""Returns true if the binary operator is supported for the given input types.

For details, see :cpp:func:`cudf::binops::is_supported_operation`.

Parameters
----------
out : DataType
The output data type.
lhs : DataType
The left hand side data type.
rhs : DataType
The right hand side data type.
op : BinaryOperator
The operation to check.

Returns
-------
bool
True if the operation is supported, False otherwise

"""

return cpp_binaryop.is_supported_operation(
brandon-b-miller marked this conversation as resolved.
Show resolved Hide resolved
out.c_obj,
lhs.c_obj,
Expand Down
3 changes: 2 additions & 1 deletion python/cudf/cudf/_lib/pylibcudf/libcudf/binaryop.pxd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright (c) 2020-2024, NVIDIA CORPORATION.

from libc.stdint cimport bool, int32_t
from libc.stdint cimport int32_t
from libcpp cimport bool
from libcpp.memory cimport unique_ptr
from libcpp.string cimport string
Expand Down Expand Up @@ -44,6 +44,7 @@ cdef extern from "cudf/binaryop.hpp" namespace "cudf" nogil:
NULL_EQUALS
NULL_MAX
brandon-b-miller marked this conversation as resolved.
Show resolved Hide resolved
NULL_MIN
NULL_NOT_EQUALS
GENERIC_BINARY
NULL_LOGICAL_AND
NULL_LOGICAL_OR
Expand Down
Loading
Loading