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

feat(api): support all dtypes in MapGet and MapContains #8648

Merged
merged 12 commits into from
Mar 21, 2024
6 changes: 5 additions & 1 deletion ibis/backends/flink/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,11 @@
return self.f.count(sge.Distinct(expressions=[arg]))

def visit_MapContains(self, op: ops.MapContains, *, arg, key):
return self.f.array_contains(self.f.map_keys(arg), key)
key_type = op.arg.dtype.key_type
return self.f.array_contains(

Check warning on line 550 in ibis/backends/flink/compiler.py

View check run for this annotation

Codecov / codecov/patch

ibis/backends/flink/compiler.py#L549-L550

Added lines #L549 - L550 were not covered by tests
self.cast(self.f.map_keys(arg), dt.Array(value_type=key_type)),
self.cast(key, key_type),
)

def visit_Map(self, op: ops.Map, *, keys, values):
return self.cast(self.f.map_from_arrays(keys, values), op.dtype)
Expand Down
2 changes: 1 addition & 1 deletion ibis/backends/snowflake/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def visit_RegexSplit(self, op, *, arg, pattern):
def visit_Map(self, op, *, keys, values):
return self.if_(
sg.and_(self.f.is_array(keys), self.f.is_array(values)),
self.f.udf.object_from_arrays(keys, values),
self.f.arrays_to_object(keys, values),
NULL,
)

Expand Down
Loading
Loading