Skip to content

Commit 62b2c44

Browse files
author
Claude
committed
Encode paneinfo with PaneInfoCoder.
1 parent 9fd7d09 commit 62b2c44

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

sdks/python/apache_beam/coders/coders.py

+14-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@
113113
'WindowedValueCoder',
114114
'ParamWindowedValueCoder',
115115
'BigIntegerCoder',
116-
'DecimalCoder'
116+
'DecimalCoder',
117+
'PaneInfoCoder'
117118
]
118119

119120
T = TypeVar('T')
@@ -1753,6 +1754,18 @@ def __hash__(self):
17531754
return hash(type(self))
17541755

17551756

1757+
class PaneInfoCoder(FastCoder):
1758+
def _create_impl(self):
1759+
return coder_impl.PaneInfoCoderImpl()
1760+
1761+
def is_deterministic(self):
1762+
# type: () -> bool
1763+
return True
1764+
1765+
def to_type_hint(self):
1766+
return windowed_value.PaneInfo
1767+
1768+
17561769
class DecimalCoder(FastCoder):
17571770
def _create_impl(self):
17581771
return coder_impl.DecimalCoderImpl()

sdks/python/apache_beam/coders/typecoders.py

+2
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ def MakeXyzs(v):
7373

7474
from apache_beam.coders import coders
7575
from apache_beam.typehints import typehints
76+
from apache_beam.utils import windowed_value
7677

7778
__all__ = ['registry']
7879

@@ -92,6 +93,7 @@ def register_standard_coders(self, fallback_coder):
9293
self._register_coder_internal(bytes, coders.BytesCoder)
9394
self._register_coder_internal(bool, coders.BooleanCoder)
9495
self._register_coder_internal(str, coders.StrUtf8Coder)
96+
self._register_coder_internal(windowed_value.PaneInfo, coders.PaneInfoCoder)
9597
self._register_coder_internal(typehints.TupleConstraint, coders.TupleCoder)
9698
self._register_coder_internal(typehints.DictConstraint, coders.MapCoder)
9799
self._register_coder_internal(

0 commit comments

Comments
 (0)