Skip to content

Commit

Permalink
docs: add map ops
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed May 27, 2024
1 parent 28a1cfb commit 99dd7e7
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions ibis/expr/operations/maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

@public
class Map(Value):
"""Construct a map."""

keys: Value[dt.Array]
values: Value[dt.Array]

Expand All @@ -25,12 +27,16 @@ def dtype(self):

@public
class MapLength(Unary):
"""Compute the number of unique keys in a map."""

arg: Value[dt.Map]
dtype = dt.int64


@public
class MapGet(Value):
"""Get a value from a map by key."""

arg: Value[dt.Map]
key: Value
default: Value = None
Expand All @@ -44,6 +50,8 @@ def dtype(self):

@public
class MapContains(Value):
"""Check if a map contains a key."""

arg: Value[dt.Map]
key: Value

Expand All @@ -53,6 +61,8 @@ class MapContains(Value):

@public
class MapKeys(Unary):
"""Get the keys of a map as an array."""

arg: Value[dt.Map]

@attribute
Expand All @@ -62,6 +72,8 @@ def dtype(self):

@public
class MapValues(Unary):
"""Get the values of a map as an array."""

arg: Value[dt.Map]

@attribute
Expand All @@ -71,6 +83,11 @@ def dtype(self):

@public
class MapMerge(Value):
"""Combine two maps into one.
If a key is present in both maps, the value from the first is kept.
"""

left: Value[dt.Map]
right: Value[dt.Map]

Expand Down

0 comments on commit 99dd7e7

Please sign in to comment.