Skip to content

Commit f73f584

Browse files
committed
Add upgrade compatibility check for potential coder change
1 parent 49fa4dc commit f73f584

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

sdks/python/apache_beam/typehints/native_type_compatibility.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,19 @@ def match_dataclass_for_row(user_type):
193193
if not dataclasses.is_dataclass(user_type):
194194
return False
195195

196+
# pylint: disable=wrong-import-position
197+
try:
198+
from apache_beam.options.pipeline_options_context import get_pipeline_options # pylint: disable=line-too-long
199+
except AttributeError:
200+
return False
201+
202+
opts = get_pipeline_options()
203+
if opts and not opts.is_compat_version_prior_to("2.73.0"):
204+
return False
205+
196206
is_frozen = user_type.__dataclass_params__.frozen
197207
# avoid circular import
198208
try:
199-
# pylint: disable=wrong-import-position
200209
from apache_beam.coders.typecoders import registry as coders_registry
201210
from apache_beam.coders import RowCoder
202211
except AttributeError:

0 commit comments

Comments
 (0)