@@ -962,7 +962,7 @@ def isin_op_impl(x: ibis_types.Value, op: ops.IsInOp):
962962 # to actually cast it, as that could be lossy (eg float -> int)
963963 item_inferred_type = ibis_types .literal (item ).type ()
964964 if (
965- x .type () == item_inferred_type
965+ x .type (). name == item_inferred_type . name
966966 or x .type ().is_numeric ()
967967 and item_inferred_type .is_numeric ()
968968 ):
@@ -978,7 +978,7 @@ def isin_op_impl(x: ibis_types.Value, op: ops.IsInOp):
978978
979979@scalar_op_compiler .register_unary_op (ops .ToDatetimeOp , pass_op = True )
980980def to_datetime_op_impl (x : ibis_types .Value , op : ops .ToDatetimeOp ):
981- if x .type () == ibis_dtypes .str :
981+ if x .type () in ( ibis_dtypes .str , ibis_dtypes . Timestamp ( "UTC" )): # type: ignore
982982 return x .try_cast (ibis_dtypes .Timestamp (None )) # type: ignore
983983 else :
984984 # Numerical inputs.
@@ -1001,6 +1001,9 @@ def to_timestamp_op_impl(x: ibis_types.Value, op: ops.ToTimestampOp):
10011001 if op .format
10021002 else timestamp (x )
10031003 )
1004+ elif x .type () == ibis_dtypes .Timestamp (None ): # type: ignore
1005+
1006+ return timestamp (x )
10041007 else :
10051008 # Numerical inputs.
10061009 if op .format :
@@ -2016,8 +2019,8 @@ def _ibis_num(number: float):
20162019
20172020
20182021@ibis_udf .scalar .builtin
2019- def timestamp (a : str ) -> ibis_dtypes .timestamp : # type: ignore
2020- """Convert string to timestamp."""
2022+ def timestamp (a ) -> ibis_dtypes .timestamp : # type: ignore
2023+ """Convert string or a datetime to timestamp."""
20212024
20222025
20232026@ibis_udf .scalar .builtin
0 commit comments