2525
2626import pyarrow as pa
2727
28- from ._internal import (
29- AggregateUDF ,
30- Config ,
31- DataFrame ,
28+ from .context import (
3229 SessionContext ,
3330 SessionConfig ,
3431 RuntimeConfig ,
35- ScalarUDF ,
3632 SQLOptions ,
3733)
3834
35+ # The following imports are okay to remain as opaque to the user.
36+ from ._internal import Config
37+
38+ from .udf import ScalarUDF , AggregateUDF
39+
3940from .common import (
4041 DFSchema ,
4142)
4243
44+ from .dataframe import DataFrame
45+
4346from .expr import (
44- Alias ,
45- Analyze ,
47+ # Alias,
48+ # Analyze,
4649 Expr ,
47- Filter ,
48- Limit ,
49- Like ,
50- ILike ,
51- Projection ,
52- SimilarTo ,
53- ScalarVariable ,
54- Sort ,
55- TableScan ,
56- Not ,
57- IsNotNull ,
58- IsTrue ,
59- IsFalse ,
60- IsUnknown ,
61- IsNotTrue ,
62- IsNotFalse ,
63- IsNotUnknown ,
64- Negative ,
65- InList ,
66- Exists ,
67- Subquery ,
68- InSubquery ,
69- ScalarSubquery ,
70- GroupingSet ,
71- Placeholder ,
72- Case ,
73- Cast ,
74- TryCast ,
75- Between ,
76- Explain ,
77- CreateMemoryTable ,
78- SubqueryAlias ,
79- Extension ,
80- CreateView ,
81- Distinct ,
82- DropTable ,
83- Repartition ,
84- Partitioning ,
85- Window ,
50+ # Filter,
51+ # Limit,
52+ # Like,
53+ # ILike,
54+ # Projection,
55+ # SimilarTo,
56+ # ScalarVariable,
57+ # Sort,
58+ # TableScan,
59+ # Not,
60+ # IsNotNull,
61+ # IsTrue,
62+ # IsFalse,
63+ # IsUnknown,
64+ # IsNotTrue,
65+ # IsNotFalse,
66+ # IsNotUnknown,
67+ # Negative,
68+ # InList,
69+ # Exists,
70+ # Subquery,
71+ # InSubquery,
72+ # ScalarSubquery,
73+ # GroupingSet,
74+ # Placeholder,
75+ # Case,
76+ # Cast,
77+ # TryCast,
78+ # Between,
79+ # Explain,
80+ # CreateMemoryTable,
81+ # SubqueryAlias,
82+ # Extension,
83+ # CreateView,
84+ # Distinct,
85+ # DropTable,
86+ # Repartition,
87+ # Partitioning,
88+ # Window,
8689 WindowFrame ,
8790)
8891
9699 "SQLOptions" ,
97100 "RuntimeConfig" ,
98101 "Expr" ,
99- "AggregateUDF" ,
100102 "ScalarUDF" ,
101103 "Window" ,
102104 "WindowFrame" ,
@@ -175,8 +177,6 @@ def column(value):
175177
176178
177179def literal (value ):
178- if not isinstance (value , pa .Scalar ):
179- value = pa .scalar (value )
180180 return Expr .literal (value )
181181
182182
@@ -200,20 +200,20 @@ def udf(func, input_types, return_type, volatility, name=None):
200200 )
201201
202202
203- def udaf (accum , input_type , return_type , state_type , volatility , name = None ):
203+ def udaf (accum , input_types , return_type , state_type , volatility , name = None ):
204204 """
205205 Create a new User Defined Aggregate Function
206206 """
207207 if not issubclass (accum , Accumulator ):
208208 raise TypeError ("`accum` must implement the abstract base class Accumulator" )
209209 if name is None :
210210 name = accum .__qualname__ .lower ()
211- if isinstance (input_type , pa .lib .DataType ):
212- input_type = [input_type ]
211+ if isinstance (input_types , pa .lib .DataType ):
212+ input_types = [input_types ]
213213 return AggregateUDF (
214214 name = name ,
215215 accumulator = accum ,
216- input_type = input_type ,
216+ input_types = input_types ,
217217 return_type = return_type ,
218218 state_type = state_type ,
219219 volatility = volatility ,
0 commit comments