From e1b189d63a3a7330a0212bd9d6577d87344db7cd Mon Sep 17 00:00:00 2001 From: fjetter Date: Tue, 16 Jan 2024 13:16:54 +0100 Subject: [PATCH] add make_meta_dispatch --- dask_expr/_expr.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dask_expr/_expr.py b/dask_expr/_expr.py index 9ca3dae9..8bf17357 100644 --- a/dask_expr/_expr.py +++ b/dask_expr/_expr.py @@ -28,7 +28,7 @@ safe_head, total_mem_usage, ) -from dask.dataframe.dispatch import meta_nonempty +from dask.dataframe.dispatch import make_meta_dispatch, meta_nonempty from dask.dataframe.rolling import CombinedOutput, _head_timedelta, overlap_chunk from dask.dataframe.shuffle import drop_overlap, get_overlap from dask.dataframe.utils import ( @@ -3086,3 +3086,10 @@ def __len__(self): def __iter__(self): return iter(self.operands) + + +@make_meta_dispatch.register(Expr) +def make_meta_expr(expr, index=None): + # make_meta only access the _meta attribute for collections but Expr is not + # a collection. Still, we're sometimes calling make_meta on Expr instances + return expr._meta