Skip to content

Commit

Permalink
feat(api): support deferred arguments to ibis.map
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrist authored and cpcloud committed Sep 29, 2023
1 parent b1b83f9 commit 86c8669
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions ibis/expr/types/maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import ibis.expr.operations as ops
from ibis.expr.types.arrays import ArrayColumn
from ibis.expr.types.generic import Column, Scalar, Value
from ibis.expr.deferred import deferrable

if TYPE_CHECKING:
import ibis.expr.types as ir
Expand Down Expand Up @@ -425,6 +426,7 @@ def __getitem__(self, key: ir.Value) -> ir.Column:


@public
@deferrable
def map(
keys: Iterable[Any] | Mapping[Any, Any] | ArrayColumn,
values: Iterable[Any] | ArrayColumn | None = None,
Expand Down
8 changes: 7 additions & 1 deletion ibis/tests/expr/test_value_exprs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1584,7 +1584,13 @@ def test_deferred_function_call(func, expected_type):


@pytest.mark.parametrize(
"case", [param(lambda: (ibis.array([1, _]), ibis.array([1, 2])), id="array")]
"case",
[
param(lambda: (ibis.array([1, _]), ibis.array([1, 2])), id="array"),
param(
lambda: (ibis.map({"x": 1, "y": _}), ibis.map({"x": 1, "y": 2})), id="map"
),
],
)
def test_deferred_nested_types(case):
expr, sol = case()
Expand Down

0 comments on commit 86c8669

Please sign in to comment.