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

chore(deps): lock file maintenance #10134

Merged
merged 3 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
19 changes: 12 additions & 7 deletions ibis/backends/polars/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1287,16 +1287,18 @@ def execute_count_distinct_star(op, **kw):
# Convert polars series into a list
# -> map the function element by element
# -> convert back to a polars series
InputType.PYTHON: lambda func, dtype, args: pl.Series(
map(func, *(arg.to_list() for arg in args)),
InputType.PYTHON: lambda func, dtype, fields, args: pl.Series(
map(func, *(arg.to_list() for arg in map(args.struct.field, fields))),
dtype=PolarsType.from_ibis(dtype),
),
# Convert polars series into a pyarrow array
# -> invoke the function on the pyarrow array
# -> cast the result to match the ibis dtype
# -> convert back to a polars series
InputType.PYARROW: lambda func, dtype, args: pl.from_arrow(
func(*(arg.to_arrow() for arg in args)).cast(dtype.to_pyarrow()),
InputType.PYARROW: lambda func, dtype, fields, args: pl.from_arrow(
func(*(arg.to_arrow() for arg in map(args.struct.field, fields))).cast(
dtype.to_pyarrow()
),
),
}

Expand All @@ -1306,9 +1308,12 @@ def execute_scalar_udf(op, **kw):
input_type = op.__input_type__
if input_type in _UDF_INVOKERS:
dtype = op.dtype
return pl.map_batches(
exprs=[translate(arg, **kw) for arg in op.args],
function=partial(_UDF_INVOKERS[input_type], op.__func__, dtype),
argnames = op.argnames
args = pl.struct(
**dict(zip(argnames, (translate(arg, **kw) for arg in op.args)))
)
return args.map_batches(
function=partial(_UDF_INVOKERS[input_type], op.__func__, dtype, argnames),
return_dtype=PolarsType.from_ibis(dtype),
)
elif input_type == InputType.BUILTIN:
Expand Down
Loading