hailin0 commented on code in PR #4411:
URL: 
https://github.com/apache/incubator-seatunnel/pull/4411#discussion_r1148382428


##########
seatunnel-transforms-v2/src/main/java/org/apache/seatunnel/transform/common/SingleFieldOutputTransform.java:
##########
@@ -131,4 +146,72 @@ protected SeaTunnelRow transformRow(SeaTunnelRow inputRow) 
{
      * @return
      */
     protected abstract Object getOutputFieldValue(SeaTunnelRowAccessor 
inputRow);
+
+    @Override
+    protected TableSchema transformTableSchema() {
+        Column outputColumn = getOutputColumn();
+        TableSchema.Builder builder =
+                TableSchema.builder()
+                        
.primaryKey(inputCatalogTable.getTableSchema().getPrimaryKey())
+                        
.constraintKey(inputCatalogTable.getTableSchema().getConstraintKeys());
+        List<Column> copyInputColumns =
+                inputCatalogTable.getTableSchema().getColumns().stream()
+                        .map(Column::copy)
+                        .collect(Collectors.toList());
+
+        int addFieldCount = 0;
+        for (int j = 0; j < copyInputColumns.size(); j++) {
+            if 
(copyInputColumns.get(j).getName().equals(outputColumn.getName())) {
+                copyInputColumns.set(j, outputColumn);
+                this.fieldIndex = j;
+            } else {
+                addFieldCount++;
+                copyInputColumns.add(outputColumn);
+            }
+        }

Review Comment:
   reference this pr file:MultipleFieldOutputTransform
   
   https://github.com/apache/incubator-seatunnel/pull/4404



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