Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit adc40f9

Browse files
authored
Remove breaking PDone change (#35224)
* Remove breaking PDone change * Update pipeline.py * Update pipeline.py * Update pipeline_test.py * Move none check * yapf * fmt
1 parent de76cfa commit adc40f9

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

sdks/python/apache_beam/pipeline.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,12 @@ def apply(
766766
'streaming jobs.' % full_label)
767767
self.applied_labels.add(full_label)
768768

769+
if pvalueish is None:
770+
full_label = self._current_transform().full_label
771+
raise TypeCheckError(
772+
f'Transform "{full_label}" was applied to the output of '
773+
f'an object of type None.')
774+
769775
pvalueish, inputs = transform._extract_input_pvalues(pvalueish)
770776
try:
771777
if not isinstance(inputs, dict):
@@ -805,9 +811,6 @@ def apply(
805811
self._assert_not_applying_PDone(pvalueish, transform)
806812

807813
pvalueish_result = self.runner.apply(transform, pvalueish, self._options)
808-
if pvalueish_result is None:
809-
pvalueish_result = pvalue.PDone(self)
810-
pvalueish_result.producer = current
811814

812815
if type_options is not None and type_options.pipeline_type_check:
813816
transform.type_check_outputs(pvalueish_result)

sdks/python/apache_beam/pipeline_test.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,7 @@ class ParentTransform(PTransform):
172172
def expand(self, pcoll):
173173
return pcoll | DoNothingTransform()
174174

175-
with pytest.raises(
176-
TypeCheckError,
177-
match=r".*applied to the output.*ParentTransform/DoNothingTransform"):
175+
with pytest.raises(TypeCheckError, match=r".*applied to the output"):
178176
with TestPipeline() as pipeline:
179177
_ = pipeline | ParentTransform() | beam.Map(lambda x: x + 1)
180178

0 commit comments

Comments
 (0)