davidzollo commented on code in PR #10335:
URL: https://github.com/apache/seatunnel/pull/10335#discussion_r2837001508


##########
seatunnel-connectors-v2/connector-kafka/src/main/java/org/apache/seatunnel/connectors/seatunnel/kafka/serialize/DefaultSeaTunnelRowSerializer.java:
##########
@@ -288,6 +378,21 @@ private static Function<SeaTunnelRow, SeaTunnelRow> 
createKeyRowExtractor(
         };
     }
 
+    private static Function<SeaTunnelRow, SeaTunnelRow> 
createValueRowExtractor(
+            SeaTunnelRowType valueType, List<String> headerFieldNames, 
SeaTunnelRowType rowType) {
+        int[] valueIndex = new int[valueType.getTotalFields()];
+        for (int i = 0; i < valueType.getTotalFields(); i++) {
+            valueIndex[i] = rowType.indexOf(valueType.getFieldName(i));
+        }
+        return row -> {
+            Object[] fields = new Object[valueType.getTotalFields()];
+            for (int i = 0; i < valueIndex.length; i++) {
+                fields[i] = row.getField(valueIndex[i]);
+            }
+            return new SeaTunnelRow(fields);

Review Comment:
   You need to set Rowkind and TableId
   ```
   
               SeaTunnelRow newRow = new SeaTunnelRow(fields);
               newRow.setRowKind(row.getRowKind());
               newRow.setTableId(row.getTableId());
               return newRow;
   
   ```



##########
seatunnel-connectors-v2/connector-kafka/src/main/java/org/apache/seatunnel/connectors/seatunnel/kafka/serialize/DefaultSeaTunnelRowSerializer.java:
##########
@@ -288,6 +378,21 @@ private static Function<SeaTunnelRow, SeaTunnelRow> 
createKeyRowExtractor(
         };
     }
 
+    private static Function<SeaTunnelRow, SeaTunnelRow> 
createValueRowExtractor(
+            SeaTunnelRowType valueType, List<String> headerFieldNames, 
SeaTunnelRowType rowType) {
+        int[] valueIndex = new int[valueType.getTotalFields()];
+        for (int i = 0; i < valueType.getTotalFields(); i++) {
+            valueIndex[i] = rowType.indexOf(valueType.getFieldName(i));
+        }
+        return row -> {
+            Object[] fields = new Object[valueType.getTotalFields()];
+            for (int i = 0; i < valueIndex.length; i++) {
+                fields[i] = row.getField(valueIndex[i]);
+            }
+            return new SeaTunnelRow(fields);

Review Comment:
   You need to set Rowkind and TableId
   ```
               SeaTunnelRow newRow = new SeaTunnelRow(fields);
               newRow.setRowKind(row.getRowKind());
               newRow.setTableId(row.getTableId());
               return newRow;
   
   ```



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

Reply via email to