Skip to content

Commit 0a00a05

Browse files
authored
refactor(api): remove the remnants of now unsupported timecontext feature (ibis-project#8721)
The timecontext feature was only supported by the pandas, dask and pyspark backends. Since the epic split refactor none of the ported backends support this feature. BREAKING CHANGE: timecontext feature is removed
1 parent 32b7514 commit 0a00a05

6 files changed

Lines changed: 5 additions & 201 deletions

File tree

docs/_quarto.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ website:
174174

175175
- section: Configuration
176176
contents:
177-
- reference/ContextAdjustment.qmd
178177
- reference/Interactive.qmd
179178
- reference/Options.qmd
180179
- reference/Repr.qmd
@@ -623,7 +622,6 @@ quartodoc:
623622
desc: "Ibis configuration"
624623
package: ibis.config
625624
contents:
626-
- ContextAdjustment
627625
- Interactive
628626
- Options
629627
- Repr

ibis/backends/bigquery/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -719,8 +719,6 @@ def execute(self, expr, params=None, limit="default", **kwargs):
719719
"""
720720
self._run_pre_execute_hooks(expr)
721721

722-
# TODO: upstream needs to pass params to raw_sql, I think.
723-
kwargs.pop("timecontext", None)
724722
sql = self.compile(expr, limit=limit, params=params, **kwargs)
725723
self._log(sql)
726724
cursor = self.raw_sql(sql, params=params, **kwargs)

ibis/backends/dask/__init__.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,7 @@ def disconnect(self) -> None:
6868
def version(self):
6969
return dask.__version__
7070

71-
def _validate_args(self, expr, limit, timecontext):
72-
if timecontext is not None:
73-
raise com.UnsupportedArgumentError(
74-
"The Dask backend does not support timecontext"
75-
)
71+
def _validate_args(self, expr, limit):
7672
if limit != "default" and limit is not None:
7773
raise com.UnsupportedArgumentError(
7874
"limit parameter to execute is not yet implemented in the "
@@ -88,12 +84,11 @@ def compile(
8884
expr: ir.Expr,
8985
params: dict | None = None,
9086
limit: int | None = None,
91-
timecontext=None,
9287
**kwargs,
9388
):
9489
from ibis.backends.dask.executor import DaskExecutor
9590

96-
self._validate_args(expr, limit, timecontext)
91+
self._validate_args(expr, limit)
9792
params = params or {}
9893
params = {k.op() if isinstance(k, ir.Expr) else k: v for k, v in params.items()}
9994

@@ -104,12 +99,11 @@ def execute(
10499
expr: ir.Expr,
105100
params: Mapping[ir.Expr, object] | None = None,
106101
limit: str = "default",
107-
timecontext=None,
108102
**kwargs,
109103
):
110104
from ibis.backends.dask.executor import DaskExecutor
111105

112-
self._validate_args(expr, limit, timecontext)
106+
self._validate_args(expr, limit)
113107
params = params or {}
114108
params = {k.op() if isinstance(k, ir.Expr) else k: v for k, v in params.items()}
115109

ibis/backends/tests/test_timecontext.py

Lines changed: 0 additions & 149 deletions
This file was deleted.

ibis/config.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,6 @@ def __call__(self, options):
4242
return self._with_temporary(options)
4343

4444

45-
class ContextAdjustment(Config):
46-
"""Options related to time context adjustment.
47-
48-
Attributes
49-
----------
50-
time_col : str
51-
Name of the timestamp column for execution with a `timecontext`. See
52-
`ibis/expr/timecontext.py` for details.
53-
54-
"""
55-
56-
time_col: str = "time"
57-
58-
5945
class SQL(Config):
6046
"""SQL-related options.
6147
@@ -153,8 +139,6 @@ class Options(Config):
153139
default_backend : Optional[ibis.backends.BaseBackend]
154140
The default backend to use for execution, defaults to DuckDB if not
155141
set.
156-
context_adjustment : ContextAdjustment
157-
Options related to time context adjustment.
158142
sql: SQL
159143
SQL-related options.
160144
clickhouse : Config | None
@@ -176,7 +160,6 @@ class Options(Config):
176160
verbose_log: Optional[Callable] = None
177161
graphviz_repr: bool = False
178162
default_backend: Optional[Any] = None
179-
context_adjustment: ContextAdjustment = ContextAdjustment()
180163
sql: SQL = SQL()
181164
clickhouse: Optional[Config] = None
182165
dask: Optional[Config] = None

ibis/expr/types/core.py

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
from ibis.backends import BaseBackend
3131
from ibis.expr.visualize import EdgeAttributeGetter, NodeAttributeGetter
3232

33-
TimeContext = tuple[pd.Timestamp, pd.Timestamp]
34-
3533

3634
class _FixedTextJupyterMixin(JupyterMixin):
3735
"""JupyterMixin adds a spurious newline to text, this fixes the issue."""
@@ -343,7 +341,6 @@ def _find_backend(self, *, use_default: bool = False) -> BaseBackend:
343341
def execute(
344342
self,
345343
limit: int | str | None = "default",
346-
timecontext: TimeContext | None = None,
347344
params: Mapping[ir.Value, Any] | None = None,
348345
**kwargs: Any,
349346
):
@@ -354,27 +351,18 @@ def execute(
354351
limit
355352
An integer to effect a specific row limit. A value of `None` means
356353
"no limit". The default is in `ibis/config.py`.
357-
timecontext
358-
Defines a time range of `(begin, end)`. When defined, the execution
359-
will only compute result for data inside the time range. The time
360-
range is inclusive of both endpoints. This is conceptually same as
361-
a time filter.
362-
The time column must be named `'time'` and should preserve
363-
across the expression. For example, if that column is dropped then
364-
execute will result in an error.
365354
params
366355
Mapping of scalar parameter expressions to value
367356
kwargs
368357
Keyword arguments
369358
"""
370359
return self._find_backend(use_default=True).execute(
371-
self, limit=limit, timecontext=timecontext, params=params, **kwargs
360+
self, limit=limit, params=params, **kwargs
372361
)
373362

374363
def compile(
375364
self,
376365
limit: int | None = None,
377-
timecontext: TimeContext | None = None,
378366
params: Mapping[ir.Value, Any] | None = None,
379367
pretty: bool = False,
380368
):
@@ -385,21 +373,13 @@ def compile(
385373
limit
386374
An integer to effect a specific row limit. A value of `None` means
387375
"no limit". The default is in `ibis/config.py`.
388-
timecontext
389-
Defines a time range of `(begin, end)`. When defined, the execution
390-
will only compute result for data inside the time range. The time
391-
range is inclusive of both endpoints. This is conceptually same as
392-
a time filter.
393-
The time column must be named `'time'` and should preserve
394-
across the expression. For example, if that column is dropped then
395-
execute will result in an error.
396376
params
397377
Mapping of scalar parameter expressions to value
398378
pretty
399379
In case of SQL backends, return a pretty formatted SQL query.
400380
"""
401381
return self._find_backend().compile(
402-
self, limit=limit, timecontext=timecontext, params=params, pretty=pretty
382+
self, limit=limit, params=params, pretty=pretty
403383
)
404384

405385
@experimental

0 commit comments

Comments
 (0)