Skip to content

Commit

Permalink
more validation
Browse files Browse the repository at this point in the history
  • Loading branch information
galipremsagar committed Dec 7, 2022
1 parent ce12519 commit 082202f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion python/cudf/cudf/_lib/column.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ cdef class Column:
# be expensive.
hasattr(value, "__cuda_array_interface__")
):
if isinstance(value, Buffer):
if isinstance(value, RefCountableBuffer):
value = SimpleNamespace(
__cuda_array_interface__=value._cai,
owner=value
Expand Down
21 changes: 20 additions & 1 deletion python/cudf/cudf/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,25 @@ def _validator(val):
return _validator


def _make_spill_validator(valid_options):
def _validator(val):
try:
if get_option("copy_on_write") and val:
raise ValueError(
"Spilling is not supported when copy on write is enabled. "
"Please set `copy_on_write` to `False`"
)
except KeyError:
pass
if val not in valid_options:
raise ValueError(
f"{val} is not a valid option. "
f"Must be one of {set(valid_options)}."
)

return _validator


def _integer_validator(val):
try:
int(val)
Expand Down Expand Up @@ -230,7 +249,7 @@ def _integer_and_none_validator(val):
\tValid values are True or False. Default is False.
"""
),
_make_contains_validator([False, True]),
_make_spill_validator([False, True]),
)


Expand Down

0 comments on commit 082202f

Please sign in to comment.