beam icon indicating copy to clipboard operation
beam copied to clipboard

[Feature Request][python]: Better typing support for TimestampedValue

Open jonathanasdf opened this issue 3 years ago • 3 comments

What would you like to happen?

Currently transforms that return a TimestampedValue need to be typed as plain "TimestampedValue" rather than generic "TimestampedValue[T]" so all underlying information about what type is being wrapped is lost.

Issue Priority

Priority: 3

Issue Component

Component: sdk-py-core

jonathanasdf avatar Aug 01 '22 20:08 jonathanasdf

Let me re-state to make sure I understand the ask. You're saying that TimestampValue is not a generic type, but it should be?

TheNeuralBit avatar Aug 09 '22 18:08 TheNeuralBit

Sorry - yes that is a good rephrasing.

jonathanasdf avatar Aug 09 '22 18:08 jonathanasdf

Got it, I think this would be a relatively straightforward change - just refactor TimestampedValue to inherit from Generic. In order for it to have an effect on beam typehints, we'd also want to adjust DoFn.default_type_hints to extract the element type from the generic TimestampedValue (and we should do the same for WindowedValue).

TheNeuralBit avatar Aug 09 '22 19:08 TheNeuralBit

.take-issue

liferoad avatar Apr 11 '23 20:04 liferoad