[ https://issues.apache.org/jira/browse/BEAM-7886?focusedWorklogId=330831&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-330831 ]
ASF GitHub Bot logged work on BEAM-7886: ---------------------------------------- Author: ASF GitHub Bot Created on: 19/Oct/19 00:13 Start Date: 19/Oct/19 00:13 Worklog Time Spent: 10m Work Description: TheNeuralBit commented on pull request #9188: [BEAM-7886] Make row coder a standard coder and implement in Python URL: https://github.com/apache/beam/pull/9188#discussion_r336712062 ########## File path: runners/core-construction-java/src/test/java/org/apache/beam/runners/core/construction/CommonCoderTest.java ########## @@ -278,41 +290,90 @@ private static Object convertValue(Object value, CommonCoder coderSpec, Coder co return WindowedValue.of(windowValue, timestamp, windows, paneInfo); } else if (s.equals(getUrn(StandardCoders.Enum.DOUBLE))) { return Double.parseDouble((String) value); + } else if (s.equals(getUrn(StandardCoders.Enum.ROW))) { + Schema schema; + try { + schema = SchemaTranslation.fromProto(SchemaApi.Schema.parseFrom(coderSpec.getPayload())); + } catch (InvalidProtocolBufferException e) { + throw new RuntimeException("Failed to parse schema payload for row coder", e); + } + + return parseField(value, Schema.FieldType.row(schema)); } else { throw new IllegalStateException("Unknown coder URN: " + coderSpec.getUrn()); } } + private static Object parseField(Object value, Schema.FieldType fieldType) { + switch (fieldType.getTypeName()) { + case BYTE: + return ((Number) value).byteValue(); + case INT16: + return ((Number) value).shortValue(); + case INT32: + return ((Number) value).intValue(); + case INT64: + return ((Number) value).longValue(); + case FLOAT: + return Float.parseFloat((String) value); + case DOUBLE: + return Double.parseDouble((String) value); Review comment: Ok, I created [BEAM-8437](https://issues.apache.org/jira/browse/BEAM-8437) lets take this conversation over there. ---------------------------------------------------------------- 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: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 330831) Time Spent: 13h 40m (was: 13.5h) > Make row coder a standard coder and implement in python > ------------------------------------------------------- > > Key: BEAM-7886 > URL: https://issues.apache.org/jira/browse/BEAM-7886 > Project: Beam > Issue Type: Improvement > Components: beam-model, sdk-java-core, sdk-py-core > Reporter: Brian Hulette > Assignee: Brian Hulette > Priority: Major > Time Spent: 13h 40m > Remaining Estimate: 0h > -- This message was sent by Atlassian Jira (v8.3.4#803005)