Github user uce commented on a diff in the pull request:

    https://github.com/apache/flink/pull/896#discussion_r34503752
  
    --- Diff: flink-java/src/main/java/org/apache/flink/api/java/DataSet.java 
---
    @@ -408,14 +408,16 @@ public long count() throws Exception {
                JobExecutionResult res = getExecutionEnvironment().execute();
     
                ArrayList<byte[]> accResult = res.getAccumulatorResult(id);
    -           try {
    -                   return 
SerializedListAccumulator.deserializeList(accResult, serializer);
    -           }
    -           catch (ClassNotFoundException e) {
    -                   throw new RuntimeException("Cannot find type class of 
collected data type.", e);
    -           }
    -           catch (IOException e) {
    -                   throw new RuntimeException("Serialization error while 
deserializing collected data", e);
    +           if (accResult != null) {
    +                   try {
    +                           return 
SerializedListAccumulator.deserializeList(accResult, serializer);
    +                   } catch (ClassNotFoundException e) {
    +                           throw new RuntimeException("Cannot find type 
class of collected data type.", e);
    +                   } catch (IOException e) {
    +                           throw new RuntimeException("Serialization error 
while deserializing collected data", e);
    +                   }
    +           } else {
    +                   throw new RuntimeException("The job result did not 
contain any accumulator data.");
    --- End diff --
    
    The error message might be confusing to the user, because a user should not 
care that the count is implemented with accumulators. Maybe let's make it 
explicit in the message that this case is a bug and should not happen.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to