You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"""Collect a builder at most once into an in-memory buffer and replay it thereafter.
77
78
@@ -97,6 +98,7 @@ def cache_memory(
97
98
A callable defers resolution until Polars needs it, so ``collect_schema()`` on
98
99
the result never forces the builder to run — useful when the schema is derived
99
100
from the builder's own lazy plan.
101
+
description (str | None, default None): Optional free-form description of this source instance, attached to its OpenTelemetry span (``explain_detail``).
100
102
101
103
Returns:
102
104
pl.LazyFrame: A LazyFrame with ``schema``, backed by a generator over a one-time
@@ -237,4 +239,4 @@ def source_generator(
237
239
# register_io_source_with_is_pure (unlike the plain register_io_source, which raises ComputeError
238
240
# for a callable schema) accepts a zero-arg callable schema and resolves it lazily. We hand it the
239
241
# memoizing ``get_schema`` so Polars and the buffer reconciliation agree on one resolved schema.
n_chunks: Number of contiguous chunks to split ``n_samples`` into. Required when ``chunk_key`` is set. Must satisfy ``1 <= n_chunks <= n_samples``.
188
193
seed: Seed for ``np.random.default_rng``. If None, uses fresh entropy per call (and the source is registered with ``is_pure=False``).
189
194
fetch_size: Default number of rows generated per batch when Polars does not provide a ``batch_size``. Must be >= 1. Defaults to 10_000.
195
+
description: Optional free-form description of this source instance, attached to its OpenTelemetry span (``explain_detail``).
190
196
"""
191
197
_validate_common(
192
198
n_features=n_features,
@@ -254,6 +260,8 @@ def mean_computer(
254
260
mean_computer=mean_computer,
255
261
extras_schema=extras_schema,
256
262
chunk_sizes=chunk_sizes,
263
+
explain_name="scan_synthetic_regression",
264
+
explain_detail=description,
257
265
)
258
266
259
267
@@ -275,6 +283,7 @@ def scan_synthetic_panel(
275
283
epsilon_scale: float=1.0,
276
284
seed: int|None=None,
277
285
fetch_size: int=10_000,
286
+
description: str|None=None,
278
287
) ->pl.LazyFrame:
279
288
"""
280
289
A lazy source of synthetic panel data on a ``(date, symbol)`` grid. This generator draws independent per-row noise, uses ``x_i``/``y_i`` column names, and treats weights as a WLS variance model. Rows are yielded date-by-date so ``.set_sorted("date").group_by("date")`` streams cleanly under ``engine="streaming"``.
@@ -302,6 +311,7 @@ def scan_synthetic_panel(
302
311
epsilon_scale: When ``use_weights=False``, the noise stddev for every row. When ``use_weights=True``, the *reference* stddev at ``w=1``; actual per-row noise is ``N(loc, (epsilon_scale/√w)²)``. Must be >= 0. Defaults to 1.0.
303
312
seed: Seed for ``np.random.default_rng``. If None, uses fresh entropy per call (and the source is registered with ``is_pure=False``).
304
313
fetch_size: Default number of rows generated per batch when Polars does not provide a ``batch_size``. Must be >= 1. Defaults to 10_000.
314
+
description: Optional free-form description of this source instance, attached to its OpenTelemetry span (``explain_detail``).
0 commit comments