File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -254,6 +254,10 @@ def _make_global_functions():
254254 for cpp_name in reg .list_functions ():
255255 name = rewrites .get (cpp_name , cpp_name )
256256 func = reg .get_function (cpp_name )
257+ if func .kind == "hash_aggregate" :
258+ # Hash aggregate functions are not callable,
259+ # so let's not expose them at module level.
260+ continue
257261 assert name not in g , name
258262 g [cpp_name ] = g [name ] = _wrap_function (name , func )
259263
Original file line number Diff line number Diff line change @@ -96,6 +96,14 @@ def test_exported_functions():
9696 func (* args )
9797
9898
99+ def test_hash_aggregate_not_exported ():
100+ # Ensure we are not leaking hash aggregate functions
101+ # which are not callable by themselves.
102+ for func in exported_functions :
103+ arrow_f = pc .get_function (func .__arrow_compute_function__ ["name" ])
104+ assert arrow_f .kind != "hash_aggregate"
105+
106+
99107def test_exported_option_classes ():
100108 classes = exported_option_classes
101109 assert len (classes ) >= 10
@@ -241,7 +249,11 @@ def test_pickle_functions():
241249def test_pickle_global_functions ():
242250 # Pickle global wrappers (manual or automatic) of registered functions
243251 for name in pc .list_functions ():
244- func = getattr (pc , name )
252+ try :
253+ func = getattr (pc , name )
254+ except AttributeError :
255+ # hash_aggregate functions are not exported as callables.
256+ continue
245257 reconstructed = pickle .loads (pickle .dumps (func ))
246258 assert reconstructed is func
247259
You can’t perform that action at this time.
0 commit comments