robertwb commented on code in PR #29160:
URL: https://github.com/apache/beam/pull/29160#discussion_r1377856271
##########
sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/KafkaWriteSchemaTransformProvider.java:
##########
@@ -131,10 +132,18 @@ public void finish() {
@Override
public PCollectionRowTuple expand(PCollectionRowTuple input) {
Schema inputSchema = input.get("input").getSchema();
- final SerializableFunction<Row, byte[]> toBytesFn =
- configuration.getFormat().equals("JSON")
- ? JsonUtils.getRowToJsonBytesFunction(inputSchema)
- : AvroUtils.getRowToAvroBytesFunction(inputSchema);
+ final SerializableFunction<Row, byte[]> toBytesFn;
+ if (configuration.getFormat().equals("RAW")) {
+ int numFields = inputSchema.getFields().size();
+ if (numFields != 1) {
Review Comment:
Perhaps check its type as well?
##########
sdks/java/io/kafka/src/test/java/org/apache/beam/sdk/io/kafka/KafkaWriteSchemaTransformProviderTest.java:
##########
@@ -47,6 +50,9 @@ public class KafkaWriteSchemaTransformProviderTest {
private static final Schema BEAMSCHEMA =
Schema.of(Schema.Field.of("name", Schema.FieldType.STRING));
+
+ private static final Schema BEAMRAWSCHEMA =
Review Comment:
Nit: Why aren't these CAP_UNDERSCORE_CASE?
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]