xintongsong commented on code in PR #26118:
URL: https://github.com/apache/flink/pull/26118#discussion_r1955711278


##########
flink-examples/flink-examples-streaming/src/main/resources/datas/dsv2/windowing/CountProductSalesWindowingResult.csv:
##########
@@ -0,0 +1,115 @@
+5,1738825200000,2

Review Comment:
   Result is only needed in `test/`



##########
flink-datastream/src/main/java/org/apache/flink/datastream/impl/context/DefaultStateManager.java:
##########
@@ -90,7 +90,19 @@ public <T> Optional<ValueState<T>> 
getState(ValueStateDeclaration<T> stateDeclar
     }
 
     @Override
-    public <T> Optional<ListState<T>> getState(ListStateDeclaration<T> 
stateDeclaration)
+    public <T> ValueState<T> getState(ValueStateDeclaration<T> 
stateDeclaration) throws Exception {
+        Optional<ValueState<T>> stateOptional = 
getStateOptional(stateDeclaration);
+        if (stateOptional.isEmpty()) {
+            throw new RuntimeException(
+                    "Failed to access the State. You may need to declare it 
first and ensure that "
+                            + "the context can access the state. For example, 
retrieving a "
+                            + "keyed state is not allowed in a non-keyed 
context.");
+        }

Review Comment:
   1. Should not use unchecked exceptions.
   2. Error message can be deduplicated.
   3. Better points to documentation
   
https://nightlies.apache.org/flink/flink-docs-master/docs/dev/datastream-v2/context_and_state_processing/#the-legitimacy-of-state-declaration-and-access



##########
flink-examples/flink-examples-streaming/src/main/resources/datas/dsv2/join/JoinResult.csv:
##########
@@ -0,0 +1,179 @@
+Roland,7,83653

Review Comment:
   Result is only needed in `test/`



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