title: ValidationException when using Table AggregateFunction and ResultTypeQueryable
body: <p>I'm using a local Flink 1.6 cluster configured to use the <code>flink-table</code> jar
  (meaning my program's jar does not include <code>flink-table</code>).
  With the following code</p>
  
  <pre><code>import org.apache.flink.api.common.typeinfo.TypeHint;
  import org.apache.flink.api.common.typeinfo.TypeInformation;
  import org.apache.flink.api.java.ExecutionEnvironment;
  import org.apache.flink.api.java.operators.DataSource;
  import org.apache.flink.api.java.tuple.Tuple2;
  import org.apache.flink.api.java.typeutils.ResultTypeQueryable;
  import org.apache.flink.table.api.Table;
  import org.apache.flink.table.api.TableEnvironment;
  import org.apache.flink.table.api.java.BatchTableEnvironment;
  import org.apache.flink.table.functions.AggregateFunction;
  import org.apache.flink.types.Row;
  
  import java.util.ArrayList;
  import java.util.List;
  
  public class JMain {
      public static void main(String[] args) throws Exception {
          ExecutionEnvironment execEnv = ExecutionEnvironment.getExecutionEnvironment();
          BatchTableEnvironment tableEnv = TableEnvironment.getTableEnvironment(execEnv);
  
          tableEnv.registerFunction("enlist", new Enlister());
  
          DataSource&lt;Tuple2&lt;String, String&gt;&gt; source = execEnv.fromElements(
                  new Tuple2&lt;&gt;("a", "1"),
                  new Tuple2&lt;&gt;("a", "2"),
                  new Tuple2&lt;&gt;("b", "3")
          );
  
          Table table = tableEnv.fromDataSet(source, "a, b")
                  .groupBy("a")
                  .select("enlist(a, b)");
  
          tableEnv.toDataSet(table, Row.class)
                  .print();
      }
  
      public static class Enlister
              extends AggregateFunction&lt;List&lt;String&gt;, ArrayList&lt;String&gt;&gt;
              implements ResultTypeQueryable&lt;List&lt;String&gt;&gt;
      {
          @Override
          public ArrayList&lt;String&gt; createAccumulator() {
              return new ArrayList&lt;&gt;();
          }
  
          @Override
          public List&lt;String&gt; getValue(ArrayList&lt;String&gt; acc) {
              return acc;
          }
  
          @SuppressWarnings("unused")
          public void accumulate(ArrayList&lt;String&gt; acc, String a, String b) {
              acc.add(a + ":" + b);
          }
  
          @SuppressWarnings("unused")
          public void merge(ArrayList&lt;String&gt; acc, Iterable&lt;ArrayList&lt;String&gt;&gt; it) {
              for (ArrayList&lt;String&gt; otherAcc : it) {
                  acc.addAll(otherAcc);
              }
          }
  
          @SuppressWarnings("unused")
          public void resetAccumulator(ArrayList&lt;String&gt; acc) {
              acc.clear();
          }
  
          @Override
          public TypeInformation&lt;List&lt;String&gt;&gt; getProducedType() {
              return TypeInformation.of(new TypeHint&lt;List&lt;String&gt;&gt;(){});
          }
      }
  }
  </code></pre>
  
  <p>I get this weird exception:</p>
  
  <pre><code>org.apache.flink.table.api.ValidationException: Expression Enlister(List('a, 'b)) failed on input check: Given parameters do not match any signature. 
  Actual: (java.lang.String, java.lang.String) 
  Expected: (java.lang.String, java.lang.String)
  </code></pre>
  
  <p>However, if I do <em>not</em> implement <code>ResultTypeQueryable</code>,
  I get the expected output:</p>
  
  <pre><code>Starting execution of program
  [b:3]
  [a:1, a:2]
  Program execution finished
  Job with JobID 20497bd3efe44fab0092a05a8eb7d9de has finished.
  Job Runtime: 270 ms
  Accumulator Results: 
  - 56e0e5a9466b84ae44431c9c4b7aad71 (java.util.ArrayList) [2 elements]
  </code></pre>
  
  <p>My actual use case seems to require <code>ResultTypeQueryable</code>,
  because otherwise I get this exception:</p>
  
  <pre><code>The return type of function ... could not be determined automatically,
  due to type erasure. You can give type information hints by using the
  returns(...) method on the result of the transformation call,
  or by letting your function implement the 'ResultTypeQueryable' interface
  </code></pre>
  
  <p>Any way I can fix this?</p>