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

Raise in query if dtype is not supported #9921

Merged
Merged
Changes from 2 commits
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
25 changes: 24 additions & 1 deletion python/cudf/cudf/utils/queryutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,20 @@
import cudf
from cudf.core.column import column_empty
from cudf.utils import applyutils
from cudf.utils.dtypes import (
BOOL_TYPES,
DATETIME_TYPES,
NUMERIC_TYPES,
TIMEDELTA_TYPES,
)

ENVREF_PREFIX = "__CUDF_ENVREF__"

SUPPORTED_QUERY_TYPES = {
np.dtype(dt)
for dt in NUMERIC_TYPES | DATETIME_TYPES | TIMEDELTA_TYPES | BOOL_TYPES
}


class QuerySyntaxError(ValueError):
pass
Expand Down Expand Up @@ -197,6 +208,18 @@ def query_execute(df, expr, callenv):

# compile
compiled = query_compile(expr)
columns = compiled["colnames"]

# wait to check the types until we know which cols are used
breakpoint()
vyasr marked this conversation as resolved.
Show resolved Hide resolved
if any(
df._data[col].dtype not in SUPPORTED_QUERY_TYPES for col in columns
):
raise TypeError(
"query only supports numeric, datetime, timedelta, "
"or bool dtypes."
)

kernel = compiled["kernel"]
# process env args
envargs = []
Expand All @@ -214,7 +237,7 @@ def query_execute(df, expr, callenv):
raise NameError(msg.format(name))
else:
envargs.append(val)
columns = compiled["colnames"]

# prepare col args

colarrays = [
Expand Down