Skip to content

Commit

Permalink
depr(api): deprecate StructValue.destructure API
Browse files Browse the repository at this point in the history
  • Loading branch information
deepyaman committed Aug 13, 2024
1 parent 1920c8d commit 374ed3c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
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.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

0 comments on commit 374ed3c

Please sign in to comment.