[
https://issues.apache.org/jira/browse/BEAM-12357?focusedWorklogId=617336&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-617336
]
ASF GitHub Bot logged work on BEAM-12357:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 30/Jun/21 23:11
Start Date: 30/Jun/21 23:11
Worklog Time Spent: 10m
Work Description: pabloem commented on pull request #14869:
URL: https://github.com/apache/beam/pull/14869#issuecomment-871784677
I see what the confusion was... In this case, our args/kwargs are not side
input PCollections. They're just values.
If we wanted to support side inputs, then it would be something like this:
```py
def test_sideinputs(self):
with TestPipeline() as p:
pc = p | beam.Create([0, 2, 3])
si = AsList(p | beam.Create([1, 2, 3]))
with_keys = pc | util.WithKeys(lambda x, the_list: x + sum(the_list),
si)
assert_that(with_keys, equal_to([(6), (8), (9)]))
```
This example would not work, right?
Since we're just supporting values, then it's simpler - but I wonder if we
should also try to support side inputs? I suppose you'd rather move this change
forward, and consider side inputs later?
--
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]
Issue Time Tracking
-------------------
Worklog Id: (was: 617336)
Time Spent: 5h 50m (was: 5h 40m)
> WithKeys transform to take args, kwargs
> ---------------------------------------
>
> Key: BEAM-12357
> URL: https://issues.apache.org/jira/browse/BEAM-12357
> Project: Beam
> Issue Type: Improvement
> Components: sdk-py-core
> Reporter: Heidi Hurst
> Assignee: Heidi Hurst
> Priority: P3
> Labels: newbie
> Original Estimate: 1h
> Time Spent: 5h 50m
> Remaining Estimate: 0h
>
> The current WithKeys implementation for Python precludes the use of functions
> which require additional inputs. An updated version would exhibit the same
> behavior as `beam.Map`, which can receive inputs passed in as
> `beam.Map(some_fn, foo=foo, bar=bar)`.
> (Builds off of https://issues.apache.org/jira/browse/BEAM-7023).
--
This message was sent by Atlassian Jira
(v8.3.4#803005)