Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-2115

TableAPI throws ExpressionException for "Dangling GroupBy operation"

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.9
    • 1.0.0
    • Table SQL / API
    • None

    Description

      The following program below throws an ExpressionException due to a "Dangling GroupBy operation".
      However, I think the program is semantically correct and should execute.

      public static void main(String[] args) throws Exception {
      
        ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
      
        DataSet<Integer> data = env.fromElements(1,2,2,3,3,3,4,4,4,4);
        DataSet<Tuple2<Integer, Integer>> tuples = data
            .map(new MapFunction<Integer, Tuple2<Integer, Integer>>() {
              @Override
              public Tuple2<Integer, Integer> map(Integer i) throws Exception {
                return new Tuple2<Integer, Integer>(i, i*2);
              }
            });
      
        TableEnvironment tEnv = new TableEnvironment();
        Table t = tEnv.toTable(tuples).as("i, i2")
            .groupBy("i, i2").select("i, i2")
            .groupBy("i").select("i, i.count as cnt");
      
        tEnv.toSet(t, Row.class).print();
      }
      

      Attachments

        Activity

          People

            chengxiang li Chengxiang Li
            fhueske Fabian Hueske
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: