def sa_mysql_double(_, satype, nullable=True): # TODO: handle asdecimal=True return dt.Double(nullable=nullable)
def mysql_double(satype, nullable=True): return dt.Double(nullable=nullable)
def sa_double(_, satype, nullable=True): return dt.Double(nullable=nullable)
from pytest import param import ibis import ibis.expr.datatypes as dt import ibis.expr.types as ir from ibis import literal as L @pytest.mark.parametrize( ('to_type', 'expected'), [ ('int8', 'CAST(`double_col` AS Int8)'), ('int16', 'CAST(`double_col` AS Int16)'), ('float', 'CAST(`double_col` AS Float32)'), # alltypes.double_col is non-nullable (dt.Double(nullable=False), '`double_col`'), ], ) def test_cast_double_col(alltypes, translate, to_type, expected): expr = alltypes.double_col.cast(to_type) assert translate(expr) == expected @pytest.mark.parametrize( ('to_type', 'expected'), [ ('int8', 'CAST(`string_col` AS Int8)'), ('int16', 'CAST(`string_col` AS Int16)'), (dt.String(nullable=False), '`string_col`'), ('timestamp', 'CAST(`string_col` AS DateTime)'), ('date', 'CAST(`string_col` AS Date)'),