File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -467,3 +467,13 @@ def test_case(df):
467467 assert result .column (0 ) == pa .array ([10 , 8 , 8 ])
468468 assert result .column (1 ) == pa .array (["Hola" , "Mundo" , "!!" ])
469469 assert result .column (2 ) == pa .array (["Hola" , "Mundo" , None ])
470+
471+
472+ def test_binary_string_functions (df ):
473+ df = df .select (
474+ f .encode (column ("a" ), literal ("base64" )),
475+ )
476+ result = df .collect ()
477+ assert len (result ) == 1
478+ result = result [0 ]
479+ assert result .column (0 ) == pa .array (["SGVsbG8" , "V29ybGQ" , "IQ" ])
Original file line number Diff line number Diff line change @@ -329,7 +329,11 @@ scalar_function!(uuid, Uuid);
329329scalar_function ! ( r#struct, Struct ) ; // Use raw identifier since struct is a keyword
330330scalar_function ! ( from_unixtime, FromUnixtime ) ;
331331scalar_function ! ( arrow_typeof, ArrowTypeof ) ;
332+
332333scalar_function ! ( random, Random ) ;
334+ //Binary String Functions
335+ scalar_function ! ( encode, Encode ) ;
336+ scalar_function ! ( decode, Decode ) ;
333337
334338aggregate_function ! ( approx_distinct, ApproxDistinct ) ;
335339aggregate_function ! ( approx_median, ApproxMedian ) ;
@@ -482,5 +486,9 @@ pub(crate) fn init_module(m: &PyModule) -> PyResult<()> {
482486 m. add_wrapped ( wrap_pyfunction ! ( var_pop) ) ?;
483487 m. add_wrapped ( wrap_pyfunction ! ( var_samp) ) ?;
484488 m. add_wrapped ( wrap_pyfunction ! ( window) ) ?;
489+
490+ //Binary String Functions
491+ m. add_wrapped ( wrap_pyfunction ! ( encode) ) ?;
492+ m. add_wrapped ( wrap_pyfunction ! ( decode) ) ?;
485493 Ok ( ( ) )
486494}
You can’t perform that action at this time.
0 commit comments