TheNeuralBit commented on a change in pull request #12481:
URL: https://github.com/apache/beam/pull/12481#discussion_r466592633



##########
File path: 
runners/core-construction-java/src/test/java/org/apache/beam/runners/core/construction/ValidateRunnerXlangTest.java
##########
@@ -222,14 +228,21 @@ public void partitionTest() {
   }
 
   private byte[] toStringPayloadBytes(String data) throws IOException {
+    Row configRow =
+        Row.withSchema(Schema.of(Field.of("data", FieldType.STRING)))
+            .withFieldValue("data", data)
+            .build();
+
+    ByteString.Output outputStream = ByteString.newOutput();
+    try {
+      RowCoder.of(configRow.getSchema()).encode(configRow, outputStream);
+    } catch (IOException e) {
+      throw new RuntimeException(e);
+    }
     ExternalTransforms.ExternalConfigurationPayload payload =
         ExternalTransforms.ExternalConfigurationPayload.newBuilder()
-            .putConfiguration(
-                "data",
-                ExternalTransforms.ConfigValue.newBuilder()
-                    .addCoderUrn("beam:coder:string_utf8:v1")
-                    .setPayload(ByteString.copyFrom(encodeString(data)))
-                    .build())
+            .setSchema(SchemaTranslation.schemaToProto(configRow.getSchema(), 
false))
+            .setPayload(outputStream.toByteString())

Review comment:
       This is just mirroring what was there before, which used the old 
ExternalConfigurationPayload to encode a single field "data" with the 
string_utf8 coder. The equivalent with the new version  of 
ExternalConfigurationPayload is to encode a single field "data" with type 
STRING.




----------------------------------------------------------------
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]


Reply via email to