TheNeuralBit commented on a change in pull request #11701:
URL: https://github.com/apache/beam/pull/11701#discussion_r427655332
##########
File path: sdks/python/apache_beam/coders/row_coder.py
##########
@@ -134,19 +134,18 @@ def __init__(self, schema, components):
def encode_to_stream(self, value, out, nested):
nvals = len(self.schema.fields)
self.SIZE_CODER.encode_to_stream(nvals, out, True)
- attrs = [getattr(value, f.name) for f in self.schema.fields]
Review comment:
Yeah that's right. Right now it should only be possible to get here with
a NamedTuple instance, so it should be safe.
Looking forward to the day where more types might go through this code.. I
kind of like the idea of using `tuple` as the "base" schema type in Python
(i.e. the type we must be able to convert to/from for use in row coder).
Relying on attributes isn't great since it limits us to field names that are
valid python identifiers.
All that being said I'd be fine dropping this part of the change for now.
Renaming the special `id` field also fixes the bug.
----------------------------------------------------------------
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]