Skip to content

Commit 98c5c76

Browse files
authored
depr(api): deprecate StructValue.destructure API (#9824)
1 parent 3183bef commit 98c5c76

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

ibis/backends/tests/test_vectorized_udf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ def test_elementwise_udf_overwrite_destruct_and_assign(udf_backend, udf_alltypes
539539

540540

541541
@pytest.mark.xfail_version(pyspark=["pyspark<3.1"])
542-
@pytest.mark.parametrize("method", ["destructure", "unpack"])
542+
@pytest.mark.parametrize("method", ["destructure", "lift", "unpack"])
543543
def test_elementwise_udf_destructure_exact_once(udf_alltypes, method, tmp_path):
544544
with pytest.warns(FutureWarning, match="v9.0"):
545545

@@ -558,6 +558,8 @@ def add_one_struct_exact_once(v):
558558

559559
if method == "destructure":
560560
expr = udf_alltypes.mutate(struct.destructure())
561+
elif method == "lift":
562+
expr = udf_alltypes.mutate(struct=struct).struct.lift()
561563
elif method == "unpack":
562564
expr = udf_alltypes.mutate(struct=struct).unpack("struct")
563565
else:

ibis/expr/types/structs.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from public import public
88

99
import ibis.expr.operations as ops
10+
from ibis import util
1011
from ibis.common.deferred import deferrable
1112
from ibis.common.exceptions import IbisError
1213
from ibis.expr.types.generic import Column, Scalar, Value, literal
@@ -340,6 +341,7 @@ def lift(self) -> ir.Table:
340341

341342
return table.to_expr().select([self[name] for name in self.names])
342343

344+
@util.deprecated(as_of="10.0", instead="use lift or unpack instead")
343345
def destructure(self) -> list[ir.Value]:
344346
"""Destructure a `StructValue` into the corresponding struct fields.
345347

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,11 +338,12 @@ filterwarnings = [
338338
# numpy, coming from a pandas call
339339
'ignore:In the future `np\.bool` will be defined as the corresponding NumPy scalar:FutureWarning',
340340
# pandas by way of polars when comparing arrays
341-
'ignore:The truth value of an empty array is ambiguous.:DeprecationWarning',
341+
'ignore:The truth value of an empty array is ambiguous\.:DeprecationWarning',
342342
# druid
343343
'ignore:Dialect druid.rest will not make use of SQL compilation caching:',
344344
# ibis
345345
'ignore:`(Base)?Backend.database` is deprecated:FutureWarning',
346+
'ignore:`StructValue\.destructure` is deprecated as of v10\.0; use lift or unpack instead:FutureWarning',
346347
# spark
347348
"ignore:distutils Version classes are deprecated:DeprecationWarning",
348349
"ignore:The distutils package is deprecated and slated for removal:DeprecationWarning",

0 commit comments

Comments
 (0)