File tree 1 file changed +8
-3
lines changed 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 23
23
24
24
from datafusion import SessionContext , column
25
25
from datafusion import functions as f
26
- from datafusion import literal
26
+ from datafusion import literal , Expr
27
27
28
28
np .seterr (invalid = "ignore" )
29
29
@@ -905,10 +905,15 @@ def test_temporal_functions(df):
905
905
)
906
906
907
907
908
+ def utf8_literal (value : str ) -> Expr :
909
+ """Creates a new expression representing a UTF8 literal value."""
910
+ return literal (pa .scalar (value , type = pa .string ()))
911
+
912
+
908
913
def test_arrow_cast (df ):
909
914
df = df .select (
910
- f .arrow_cast (column ("a" ), literal ("Float64" )).alias ("a_as_float" ),
911
- f .arrow_cast (column ("a" ), literal ("Int32" )).alias ("a_as_int" ),
915
+ f .arrow_cast (column ("a" ), utf8_literal ("Float64" )).alias ("a_as_float" ),
916
+ f .arrow_cast (column ("a" ), utf8_literal ("Int32" )).alias ("a_as_int" ),
912
917
)
913
918
result = df .collect ()
914
919
assert len (result ) == 1
You can’t perform that action at this time.
0 commit comments