Skip to content

Commit 19258c9

Browse files
committed
Try new type ANY
1 parent 5527ea4 commit 19258c9

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

lib/dl_formula/dl_formula/core/datatype.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
@unique
1919
class DataType(Enum):
20+
ANY = "any"
2021
NULL = "null"
2122
INTEGER = "integer"
2223
CONST_INTEGER = "const_integer"
@@ -85,7 +86,7 @@ def non_const_type(self) -> DataType:
8586
@property
8687
def const_type(self) -> DataType:
8788
"""Return a constant version of the type"""
88-
if self.is_const or self is DataType.NULL or self is DataType.UNSUPPORTED:
89+
if self.is_const or self is DataType.ANY or self is DataType.NULL or self is DataType.UNSUPPORTED:
8990
return self
9091
return DataType["CONST_" + self.name]
9192

@@ -155,5 +156,6 @@ def as_primitive(self) -> tuple[Optional[Hashable]]:
155156
},
156157
),
157158
(DataType.UNSUPPORTED, {DataType.UNSUPPORTED}),
159+
(DataType.ANY, set(DataType)),
158160
)
159161
)

lib/dl_formula/dl_formula/definitions/functions_native.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class DBCall(Function):
3535
arg_cnt = None
3636
arg_names = ["db_function_name"]
3737
argument_types = [
38-
ArgTypeSequenceThenForAll(fixed_arg_types=[DataType.CONST_STRING], for_all_types=DataType.UNSUPPORTED),
38+
ArgTypeSequenceThenForAll(fixed_arg_types=[DataType.CONST_STRING], for_all_types=DataType.ANY),
3939
]
4040
variants = [VW(D.DUMMY, _call_native_impl)]
4141

@@ -79,7 +79,7 @@ class DBCallAgg(AggregationFunctionBase):
7979
arg_cnt = None
8080
arg_names = ["db_agg_function_name"]
8181
argument_types = [
82-
ArgTypeSequenceThenForAll(fixed_arg_types=[DataType.CONST_STRING], for_all_types=DataType.UNSUPPORTED),
82+
ArgTypeSequenceThenForAll(fixed_arg_types=[DataType.CONST_STRING], for_all_types=DataType.ANY),
8383
]
8484
variants = [VW(D.DUMMY, _call_native_impl)]
8585

0 commit comments

Comments
 (0)