Skip to content

Commit 0ca6811

Browse files
committed
remove redundant switch statement
1 parent 9298177 commit 0ca6811

File tree

2 files changed

+2
-20
lines changed

2 files changed

+2
-20
lines changed

fluss-flink/fluss-flink-common/src/main/java/com/alibaba/fluss/flink/sink/serializer/RowSerializationSchema.java

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@
2020
import com.alibaba.fluss.flink.row.RowWithOp;
2121
import com.alibaba.fluss.row.InternalRow;
2222

23-
import org.apache.flink.table.api.TableException;
2423
import org.apache.flink.table.data.RowData;
25-
import org.apache.flink.types.RowKind;
2624

2725
/** Default implementation of RowDataConverter for RowData. */
2826
public class RowSerializationSchema implements FlussSerializationSchema<RowData> {
@@ -40,22 +38,6 @@ public RowWithOp<RowData> serialize(RowData value) throws Exception {
4038
}
4139

4240
InternalRow row = converter.replace(value);
43-
RowWithOp<RowData> rowWithOp = new RowWithOp<>(row);
44-
switch (value.getRowKind()) {
45-
case INSERT:
46-
rowWithOp.setRowKind(RowKind.INSERT);
47-
return rowWithOp;
48-
case UPDATE_BEFORE:
49-
rowWithOp.setRowKind(RowKind.UPDATE_BEFORE);
50-
return rowWithOp;
51-
case UPDATE_AFTER:
52-
rowWithOp.setRowKind(RowKind.UPDATE_AFTER);
53-
return rowWithOp;
54-
case DELETE:
55-
rowWithOp.setRowKind(RowKind.DELETE);
56-
return rowWithOp;
57-
default:
58-
throw new TableException("Unsupported message kind: " + value.getRowKind());
59-
}
41+
return new RowWithOp<>(row, value.getRowKind());
6042
}
6143
}

fluss-flink/fluss-flink-common/src/main/java/com/alibaba/fluss/flink/sink/writer/FlinkSinkWriter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public void write(InputT inputValue, Context context) throws IOException, Interr
164164
checkAsyncException();
165165

166166
try {
167-
RowWithOp rowWithOp = serializationSchema.serialize(inputValue);
167+
RowWithOp<InputT> rowWithOp = serializationSchema.serialize(inputValue);
168168

169169
InternalRow internalRow = rowWithOp.getInternalRow();
170170
RowKind rowKind = rowWithOp.getRowKind();

0 commit comments

Comments
 (0)