@@ -35,6 +35,8 @@ def compile_aggregate(
35
35
aggregate : ex .Aggregation ,
36
36
bindings : typing .Dict [str , ibis_types .Value ],
37
37
) -> ibis_types .Value :
38
+ if isinstance (aggregate , ex .NullaryAggregation ):
39
+ return compile_nullary_agg (aggregate .op )
38
40
if isinstance (aggregate , ex .UnaryAggregation ):
39
41
input = scalar_compiler .compile_expression (aggregate .arg , bindings = bindings )
40
42
return compile_unary_agg (
@@ -54,7 +56,9 @@ def compile_analytic(
54
56
window : window_spec .WindowSpec ,
55
57
bindings : typing .Dict [str , ibis_types .Value ],
56
58
) -> ibis_types .Value :
57
- if isinstance (aggregate , ex .UnaryAggregation ):
59
+ if isinstance (aggregate , ex .NullaryAggregation ):
60
+ return compile_nullary_agg (aggregate .op , window )
61
+ elif isinstance (aggregate , ex .UnaryAggregation ):
58
62
input = scalar_compiler .compile_expression (aggregate .arg , bindings = bindings )
59
63
return compile_unary_agg (aggregate .op , input , window )
60
64
elif isinstance (aggregate , ex .BinaryAggregation ):
@@ -81,6 +85,14 @@ def compile_unary_agg(
81
85
raise ValueError (f"Can't compile unrecognized operation: { op } " )
82
86
83
87
88
+ @functools .singledispatch
89
+ def compile_nullary_agg (
90
+ op : agg_ops .WindowOp ,
91
+ window : Optional [window_spec .WindowSpec ] = None ,
92
+ ) -> ibis_types .Value :
93
+ raise ValueError (f"Can't compile unrecognized operation: { op } " )
94
+
95
+
84
96
def numeric_op (operation ):
85
97
@functools .wraps (operation )
86
98
def constrained_op (op , column : ibis_types .Column , window = None ):
@@ -101,6 +113,12 @@ def constrained_op(op, column: ibis_types.Column, window=None):
101
113
### Specific Op implementations Below
102
114
103
115
116
+ @compile_nullary_agg .register
117
+ @numeric_op
118
+ def _ (op : agg_ops .SizeOp , window = None ) -> ibis_types .NumericValue :
119
+ return _apply_window_if_present (vendored_ibis_ops .count (1 ), window )
120
+
121
+
104
122
@compile_unary_agg .register
105
123
@numeric_op
106
124
def _ (
0 commit comments