liferoad commented on code in PR #35881:
URL: https://github.com/apache/beam/pull/35881#discussion_r2280446831
##########
sdks/python/apache_beam/transforms/core.py:
##########
@@ -3573,6 +3573,10 @@ class ApplyPartitionFnFn(DoFn):
"""A DoFn that applies a PartitionFn."""
def process(self, element, partitionfn, n, *args, **kwargs):
partition = partitionfn.partition_for(element, n, *args, **kwargs)
+ if isinstance(partition, bool) or not isinstance(partition, int):
+ raise ValueError(
+ f"PartitionFn yielded a '{type(partition).__name__}' "
+ "when it should only yields integers")
Review Comment:
I thought about this. I am wondering whether we could do `partition =
int(partition)` although partition is bool, this could make the changes less
aggressive.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]