File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 1010from collections .abc import Mapping , Sequence
1111from functools import partial
1212from operator import attrgetter
13- from typing import Any
13+ from typing import Any , NoReturn
1414
1515import toolz
1616from public import public
1717
1818import ibis .expr .datatypes as dt
1919from ibis .common .collections import frozendict
20+ from ibis .common .deferred import Deferred
2021from ibis .common .dispatch import lazy_singledispatch
2122from ibis .common .exceptions import IbisTypeError , InputTypeError
2223from ibis .common .numeric import normalize_decimal
@@ -37,6 +38,16 @@ def infer(value: Any) -> dt.DataType:
3738 )
3839
3940
41+ @infer .register (Deferred )
42+ def infer_deferred (value : Deferred ) -> NoReturn :
43+ raise TypeError (
44+ "Cannot infer the type of a Deferred value. "
45+ "You will need to use a bound value instead. "
46+ "For example, if you have `ibis._.my_col + 5`, "
47+ "you will need to replace this with `my_table.my_col + 5`."
48+ )
49+
50+
4051# TODO(kszucs): support NamedTuples and dataclasses instead of OrderedDict
4152# which should trigger infer_map instead
4253@infer .register (collections .OrderedDict )
You can’t perform that action at this time.
0 commit comments