def _trans_param(self, expr): raw_value = self.context.params[expr.op()] dtype = expr.type() if isinstance(dtype, dt.Struct): literal = ibis.struct(raw_value, type=dtype) elif isinstance(dtype, dt.Map): literal = ibis.map(raw_value, type=dtype) else: literal = ibis.literal(raw_value, type=dtype) return self.translate(literal)
def test_map_literal(value): typestr = "map<string, string>" a = ibis.map(value, type=typestr) assert a.op().value == value assert a.type() == datatypes.dtype(typestr)
def test_map_literal_non_castable(value): typestr = "map<string, string>" with pytest.raises(TypeError): ibis.map(value, type=typestr)
def test_map_literal_non_castable(value): typestr = "map<string, string>" with pytest.raises(ibis.common.exceptions.IbisTypeError): ibis.map(value, type=typestr)