liferoad commented on code in PR #35874:
URL: https://github.com/apache/beam/pull/35874#discussion_r2279564351


##########
sdks/python/apache_beam/transforms/core.py:
##########
@@ -3849,6 +3849,15 @@ def _extract_input_pvalues(self, pvalueish):
       raise ValueError(
           'Input to Flatten must be an iterable. '
           'Got a value of type %s instead.' % type(pvalueish))
+
+    # Spot check to see if any of the items are iterables of PCollections
+    # and raise an error if so. This is always a user-error
+    for idx, item in enumerate(pvalueish):
+      if (isinstance(item, typing.Sequence) and len(item) and
+          isinstance(item[0], pvalue.PCollection)):
+        raise TypeError(
+            'Inputs to Flatten cannot include an iterable of PCollections. '
+            f'(input at index {idx}: "{item}")')

Review Comment:
   I think we should check the entire sequence. I doubt we have millions of 
them.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@beam.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to