Skip to content

Commit cf753dc

Browse files
fix structfieldop
1 parent 5e12be9 commit cf753dc

File tree

1 file changed

+1
-18
lines changed

1 file changed

+1
-18
lines changed

bigframes/operations/structs.py

+1-18
Original file line numberDiff line numberDiff line change
@@ -14,37 +14,20 @@
1414

1515
from __future__ import annotations
1616

17-
import typing
18-
19-
import ibis.expr.types as ibis_types
20-
2117
import bigframes.dataframe
2218
import bigframes.operations
2319
import bigframes.operations.base
2420
import bigframes.series
2521
import third_party.bigframes_vendored.pandas.core.arrays.arrow.accessors as vendoracessors
2622

2723

28-
class StructField(bigframes.operations.UnaryOp):
29-
def __init__(self, name_or_index: str | int):
30-
self._name_or_index = name_or_index
31-
32-
def _as_ibis(self, x: ibis_types.Value):
33-
struct_value = typing.cast(ibis_types.StructValue, x)
34-
if isinstance(self._name_or_index, str):
35-
name = self._name_or_index
36-
else:
37-
name = struct_value.names[self._name_or_index]
38-
return struct_value[name].name(name)
39-
40-
4124
class StructAccessor(
4225
bigframes.operations.base.SeriesMethods, vendoracessors.StructAccessor
4326
):
4427
__doc__ = vendoracessors.StructAccessor.__doc__
4528

4629
def field(self, name_or_index: str | int) -> bigframes.series.Series:
47-
series = self._apply_unary_op(StructField(name_or_index))
30+
series = self._apply_unary_op(bigframes.operations.StructFieldOp(name_or_index))
4831
if isinstance(name_or_index, str):
4932
name = name_or_index
5033
else:

0 commit comments

Comments
 (0)