File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 2323
2424from datafusion import SessionContext , column
2525from datafusion import functions as f
26- from datafusion import literal
26+ from datafusion import literal , Expr
2727
2828np .seterr (invalid = "ignore" )
2929
@@ -905,10 +905,15 @@ def test_temporal_functions(df):
905905 )
906906
907907
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+
908913def test_arrow_cast (df ):
909914 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" ),
912917 )
913918 result = df .collect ()
914919 assert len (result ) == 1
You can’t perform that action at this time.
0 commit comments