File tree 3 files changed +8
-4
lines changed
3 files changed +8
-4
lines changed Original file line number Diff line number Diff line change 3
3
from __future__ import annotations
4
4
5
5
import operator
6
+ import sys
6
7
from collections .abc import Mapping
7
8
from functools import reduce
8
9
from typing import TYPE_CHECKING , Any
@@ -230,6 +231,9 @@ def complexity(node):
230
231
def accum (node , * args ):
231
232
if isinstance (node , ops .Field ):
232
233
return 1
234
+ elif isinstance (node , ops .Impure ):
235
+ # consider (potentially) impure functions maximally complex
236
+ return sys .maxsize
233
237
else :
234
238
return 1 + sum (args )
235
239
Original file line number Diff line number Diff line change @@ -189,15 +189,15 @@ class Impure(Value):
189
189
190
190
191
191
@public
192
- class TimestampNow (Constant ):
192
+ class TimestampNow (Impure ):
193
193
"""Return the current timestamp."""
194
194
195
195
dtype = dt .timestamp
196
196
shape = ds .scalar
197
197
198
198
199
199
@public
200
- class DateNow (Constant ):
200
+ class DateNow (Impure ):
201
201
"""Return the current date."""
202
202
203
203
dtype = dt .date
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ class InputType(enum.Enum):
51
51
52
52
53
53
@public
54
- class ScalarUDF (ops .Value ):
54
+ class ScalarUDF (ops .Impure ):
55
55
@attribute
56
56
def shape (self ):
57
57
if not (args := getattr (self , "args" )): # noqa: B009
@@ -65,7 +65,7 @@ def shape(self):
65
65
66
66
67
67
@public
68
- class AggUDF (ops .Reduction ):
68
+ class AggUDF (ops .Reduction , ops . Impure ):
69
69
where : Optional [ops .Value [dt .Boolean ]] = None
70
70
71
71
You can’t perform that action at this time.
0 commit comments