[
https://issues.apache.org/jira/browse/BEAM-4091?focusedWorklogId=487385&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-487385
]
ASF GitHub Bot logged work on BEAM-4091:
----------------------------------------
Author: ASF GitHub Bot
Created on: 22/Sep/20 01:18
Start Date: 22/Sep/20 01:18
Worklog Time Spent: 10m
Work Description: codecov[bot] edited a comment on pull request #9907:
URL: https://github.com/apache/beam/pull/9907#issuecomment-682206351
# [Codecov](https://codecov.io/gh/apache/beam/pull/9907?src=pr&el=h1) Report
> Merging
[#9907](https://codecov.io/gh/apache/beam/pull/9907?src=pr&el=desc) into
[master](https://codecov.io/gh/apache/beam/commit/1b266601c39f243f48dfd085b565b984f936d02c?el=desc)
will **decrease** coverage by `42.03%`.
> The diff coverage is `24.13%`.
[](https://codecov.io/gh/apache/beam/pull/9907?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #9907 +/- ##
===========================================
- Coverage 82.32% 40.29% -42.04%
===========================================
Files 452 451 -1
Lines 54016 53197 -819
===========================================
- Hits 44471 21434 -23037
- Misses 9545 31763 +22218
```
| [Impacted
Files](https://codecov.io/gh/apache/beam/pull/9907?src=pr&el=tree) | Coverage Δ
| |
|---|---|---|
|
[sdks/python/apache\_beam/transforms/util.py](https://codecov.io/gh/apache/beam/pull/9907/diff?src=pr&el=tree#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vdHJhbnNmb3Jtcy91dGlsLnB5)
| `39.08% <0.00%> (-56.36%)` | :arrow_down: |
|
[...n/apache\_beam/typehints/typed\_pipeline\_test\_py3.py](https://codecov.io/gh/apache/beam/pull/9907/diff?src=pr&el=tree#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vdHlwZWhpbnRzL3R5cGVkX3BpcGVsaW5lX3Rlc3RfcHkzLnB5)
| `16.87% <9.52%> (-73.43%)` | :arrow_down: |
|
[sdks/python/apache\_beam/typehints/decorators.py](https://codecov.io/gh/apache/beam/pull/9907/diff?src=pr&el=tree#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vdHlwZWhpbnRzL2RlY29yYXRvcnMucHk=)
| `39.45% <50.00%> (-43.84%)` | :arrow_down: |
|
[sdks/python/apache\_beam/transforms/ptransform.py](https://codecov.io/gh/apache/beam/pull/9907/diff?src=pr&el=tree#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vdHJhbnNmb3Jtcy9wdHJhbnNmb3JtLnB5)
| `38.27% <80.00%> (-52.78%)` | :arrow_down: |
|
[...python/apache\_beam/examples/complete/distribopt.py](https://codecov.io/gh/apache/beam/pull/9907/diff?src=pr&el=tree#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vZXhhbXBsZXMvY29tcGxldGUvZGlzdHJpYm9wdC5weQ==)
| `0.00% <0.00%> (-98.59%)` | :arrow_down: |
|
[...dks/python/apache\_beam/transforms/create\_source.py](https://codecov.io/gh/apache/beam/pull/9907/diff?src=pr&el=tree#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vdHJhbnNmb3Jtcy9jcmVhdGVfc291cmNlLnB5)
| `0.00% <0.00%> (-98.19%)` | :arrow_down: |
|
[...on/apache\_beam/runners/direct/helper\_transforms.py](https://codecov.io/gh/apache/beam/pull/9907/diff?src=pr&el=tree#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vcnVubmVycy9kaXJlY3QvaGVscGVyX3RyYW5zZm9ybXMucHk=)
| `0.00% <0.00%> (-98.15%)` | :arrow_down: |
|
[...e\_beam/runners/interactive/testing/mock\_ipython.py](https://codecov.io/gh/apache/beam/pull/9907/diff?src=pr&el=tree#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vcnVubmVycy9pbnRlcmFjdGl2ZS90ZXN0aW5nL21vY2tfaXB5dGhvbi5weQ==)
| `7.14% <0.00%> (-92.86%)` | :arrow_down: |
|
[.../examples/snippets/transforms/elementwise/pardo.py](https://codecov.io/gh/apache/beam/pull/9907/diff?src=pr&el=tree#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vZXhhbXBsZXMvc25pcHBldHMvdHJhbnNmb3Jtcy9lbGVtZW50d2lzZS9wYXJkby5weQ==)
| `11.36% <0.00%> (-88.64%)` | :arrow_down: |
|
[sdks/python/apache\_beam/typehints/opcodes.py](https://codecov.io/gh/apache/beam/pull/9907/diff?src=pr&el=tree#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vdHlwZWhpbnRzL29wY29kZXMucHk=)
| `0.00% <0.00%> (-87.92%)` | :arrow_down: |
| ... and [291
more](https://codecov.io/gh/apache/beam/pull/9907/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at
Codecov](https://codecov.io/gh/apache/beam/pull/9907?src=pr&el=continue).
> **Legend** - [Click here to learn
more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by
[Codecov](https://codecov.io/gh/apache/beam/pull/9907?src=pr&el=footer). Last
update
[1b26660...138efc5](https://codecov.io/gh/apache/beam/pull/9907?src=pr&el=lastupdated).
Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 487385)
Time Spent: 3h 40m (was: 3.5h)
> Typehint annotations don't work with @ptransform_fn annotation
> --------------------------------------------------------------
>
> Key: BEAM-4091
> URL: https://issues.apache.org/jira/browse/BEAM-4091
> Project: Beam
> Issue Type: Bug
> Components: sdk-py-core
> Affects Versions: 2.4.0
> Reporter: Chuan Yu Foo
> Priority: P2
> Time Spent: 3h 40m
> Remaining Estimate: 0h
>
> Typehint annotations don't work with functions annotated with
> {{@ptransform_fn}}, but they do work with the equivalent classes.
> The following is a minimal example illustrating this:
> {code:python}
> @beam.typehints.with_input_types(float)
> @beam.typehints.with_output_types(bytes)
> @beam.ptransform_fn
> def _DoStuffFn(pcoll):
> return pcoll | 'TimesTwo' >> beam.Map(lambda x: x * 2)
> @beam.typehints.with_input_types(float)
> @beam.typehints.with_output_types(bytes)
> class _DoStuffClass(beam.PTransform):
> def expand(self, pcoll):
> return pcoll | 'TimesTwo' >> beam.Map(lambda x: x * 2)
> {code}
> With definitions as above, the class correctly fails the typecheck:
> {code:python}
> def class_correctly_fails():
> p = beam.Pipeline(options=PipelineOptions(runtime_type_check=True))
> _ = (p
> | 'Create' >> beam.Create([1, 2, 3, 4, 5])
> | 'DoStuff1' >> _DoStuffClass()
> | 'DoStuff2' >> _DoStuffClass()
> | 'Write' >> beam.io.WriteToText('/tmp/output'))
> p.run().wait_until_finish()
> # apache_beam.typehints.decorators.TypeCheckError: Input type hint violation
> at DoStuff1: expected <type 'float'>, got <type 'int'>
> {code}
> But the {{ptransform_fn}} incorrectly passes the typecheck:
> {code:python}
> def ptransform_incorrectly_passes():
> p = beam.Pipeline(options=PipelineOptions(runtime_type_check=True))
> _ = (p
> | 'Create' >> beam.Create([1, 2, 3, 4, 5])
> | 'DoStuff1' >> _DoStuffFn()
> | 'DoStuff2' >> _DoStuffFn()
> | 'Write' >> beam.io.WriteToText('/tmp/output'))
> p.run().wait_until_finish()
> # No error
> {code}
> Note that changing the order of the {{@ptransform_fn}} and type hint
> annotations doesn't change the result, i.e. changing {{_DoStuffFn}} to the
> following still results in it incorrectly passing the typecheck:
> {code:python}
> @beam.ptransform_fn
> @beam.typehints.with_input_types(float)
> @beam.typehints.with_output_types(bytes)
> def _DoStuffFn(pcoll):
> return pcoll | 'TimesTwo' >> beam.Map(lambda x: x * 2)
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)