yanghua commented on a change in pull request #6430: [FLINK-8058][Queryable
State]Queryable state should check types
URL: https://github.com/apache/flink/pull/6430#discussion_r205753009
##########
File path:
flink-queryable-state/flink-queryable-state-runtime/src/main/java/org/apache/flink/queryablestate/server/KvStateServerHandler.java
##########
@@ -81,6 +83,14 @@ public KvStateServerHandler(
} else {
byte[] serializedKeyAndNamespace =
request.getSerializedKeyAndNamespace();
+ StateDescriptor<?, ?> requestStateDescriptor =
KvStateSerializer.deserializeStateDescriptor(request.getSerializedStateDescriptor());
+ StateDescriptor<?, ?> registStateDescriptor =
kvState.getStateDescriptor();
+
+
Preconditions.checkArgument(requestStateDescriptor.getType().equals(registStateDescriptor.getType()),
+ "State type mismatch, need[" +
registStateDescriptor.getType() + "] gotten[" +
requestStateDescriptor.getType() + "]");
+
Preconditions.checkArgument(requestStateDescriptor.getSerializer().equals(registStateDescriptor.getSerializer()),
+ "State value serializer mismatch, need
[" + registStateDescriptor.getSerializer() + "] gotten[" +
requestStateDescriptor.getSerializer() + "]");
Review comment:
use string format looks better~
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services