title: Flink sql for state checkpoint
body: <p>When I use flink sql api process data.</p>
  
  <p>Restart app， <code>sum</code> result not save in checkpoint.It's still start with 1.</p>
  
  <pre class="lang-java prettyprint-override"><code>final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
  StateBackend stateBackend = new FsStateBackend("file:///D:/d_backup/github/flink-best-practice/checkpoint");
  env.enableCheckpointing(1000 * 60);
  env.setStateBackend(stateBackend);
  
  Table table = tableEnv.sqlQuery(
          "select sum(area_id) " +
          "from rtc_warning_gmys " +
          "where area_id = 1 " +
          "group by character_id,area_id,group_id,platform");
  
  //   convert the Table into a retract DataStream of Row.
  //   A retract stream of type X is a DataStream&lt;Tuple2&lt;Boolean, X&gt;&gt;.
  //   The boolean field indicates the type of the change.
  //   True is INSERT, false is DELETE.
  DataStream&lt;Tuple2&lt;Boolean, Row&gt;&gt; dsRow = tableEnv.toRetractStream(table, Row.class);
  dsRow.map(new MapFunction&lt;Tuple2&lt;Boolean,Row&gt;, Object&gt;() {
      @Override
      public Object map(Tuple2&lt;Boolean, Row&gt; booleanRowTuple2) throws Exception {
          if(booleanRowTuple2.f0) {
              System.out.println(booleanRowTuple2.f1.toString());
              return booleanRowTuple2.f1;
          }
          return null;
      }
  });
  
  env.execute("Kafka table select");
  </code></pre>
  
  <p>Log as:</p>
  
  <p>1
  2
  3
  ...
  ...
  100</p>
  
  <p>Restart app it still start:
  1
  2
  3
  ...</p>
  
  <p>I think sum value will be stored in checkpint file and restart app can read last result from checkpint like: </p>
  
  <p>101
  102
  103
  ...
  120</p>