Skip to content

Commit

Permalink
depr(api): deprecate StructValue.destructure API (#9824)
Browse files Browse the repository at this point in the history
  • Loading branch information
deepyaman authored Aug 13, 2024
1 parent 3183bef commit 98c5c76
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion ibis/backends/tests/test_vectorized_udf.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ def test_elementwise_udf_overwrite_destruct_and_assign(udf_backend, udf_alltypes


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

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

if method == "destructure":
expr = udf_alltypes.mutate(struct.destructure())
elif method == "lift":
expr = udf_alltypes.mutate(struct=struct).struct.lift()
elif method == "unpack":
expr = udf_alltypes.mutate(struct=struct).unpack("struct")
else:
Expand Down
2 changes: 2 additions & 0 deletions ibis/expr/types/structs.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from public import public

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

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

@util.deprecated(as_of="10.0", instead="use lift or unpack instead")
def destructure(self) -> list[ir.Value]:
"""Destructure a `StructValue` into the corresponding struct fields.
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -338,11 +338,12 @@ filterwarnings = [
# numpy, coming from a pandas call
'ignore:In the future `np\.bool` will be defined as the corresponding NumPy scalar:FutureWarning',
# pandas by way of polars when comparing arrays
'ignore:The truth value of an empty array is ambiguous.:DeprecationWarning',
'ignore:The truth value of an empty array is ambiguous\.:DeprecationWarning',
# druid
'ignore:Dialect druid.rest will not make use of SQL compilation caching:',
# ibis
'ignore:`(Base)?Backend.database` is deprecated:FutureWarning',
'ignore:`StructValue\.destructure` is deprecated as of v10\.0; use lift or unpack instead:FutureWarning',
# spark
"ignore:distutils Version classes are deprecated:DeprecationWarning",
"ignore:The distutils package is deprecated and slated for removal:DeprecationWarning",
Expand Down

0 comments on commit 98c5c76

Please sign in to comment.