Skip to content

Commit

Permalink
fix(flink): cast inputs in map contains impl
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Mar 21, 2024
1 parent b8f7296 commit 3e9b9df
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
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 @@ def visit_CountDistinct(self, op, *, arg, where):
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: 0 additions & 2 deletions ibis/backends/tests/test_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ def test_literal_map_getitem_broadcast(backend, alltypes, df):
pytest.mark.notyet(
"clickhouse", reason="only supports str,int,bool,timestamp keys"
),
pytest.mark.notyet("flink", reason="doesn't support float keys"),
mark_notyet_postgres,
],
id="float",
Expand Down Expand Up @@ -227,7 +226,6 @@ def test_literal_map_getitem_broadcast(backend, alltypes, df):
),
pytest.mark.notyet(["pandas", "dask"]),
mark_notyet_postgres,
pytest.mark.notimpl("flink"),
],
id="array",
),
Expand Down

0 comments on commit 3e9b9df

Please sign in to comment.