예제 #1
0
 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)
예제 #2
0
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)
예제 #3
0
def test_map_literal_non_castable(value):
    typestr = "map<string, string>"
    with pytest.raises(TypeError):
        ibis.map(value, type=typestr)
예제 #4
0
def test_map_literal_non_castable(value):
    typestr = "map<string, string>"
    with pytest.raises(ibis.common.exceptions.IbisTypeError):
        ibis.map(value, type=typestr)