wuchong commented on a change in pull request #11797:
URL: https://github.com/apache/flink/pull/11797#discussion_r411840734
##########
File path: flink-core/src/main/java/org/apache/flink/types/RowKind.java
##########
@@ -47,10 +47,69 @@
* needs to retract the previous row first. OR it describes an
idempotent update, i.e., an update
* of a row that is uniquely identifiable by a key.
*/
- UPDATE_AFTER,
+ UPDATE_AFTER("UA", (byte) 2),
/**
* Deletion operation.
*/
- DELETE
+ DELETE("D", (byte) 3);
+
+ private final String shortString;
+
+ private final byte value;
+
+ /**
+ * Creates a {@link RowKind} enum with the given short string and byte
value representation of
+ * the {@link RowKind}.
+ */
+ RowKind(String shortString, byte value) {
Review comment:
cc @twalthr , could you have a look the changes for RowKind?
Using a byte value representation will be much faster than using enum
ordinal during de/serialization. In my local benchmark, byte value is 24x fater
than ordianl. The disadvantage is that the IDEA code completion show some
verbose information.
Benchmark code:
https://github.com/wuchong/my-benchmark/blob/master/src/main/java/myflink/EnumBenchmark.java
Benchmark Result:
```
# Run complete. Total time: 00:03:35
Benchmark Mode Cnt Score Error Units
EnumBenchmark.testOrdinal thrpt 20 876.048 ± 18.128 ops/ms
EnumBenchmark.testValue thrpt 20 20827.764 ± 2084.072 ops/ms
```

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