Interface WindowGroupedTable


  • @PublicEvolving
    public interface WindowGroupedTable
    A table that has been windowed and grouped for GroupWindows.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      AggregatedTable aggregate​(org.apache.flink.table.expressions.Expression aggregateFunction)
      Performs an aggregate operation on a window grouped table.
      FlatAggregateTable flatAggregate​(org.apache.flink.table.expressions.Expression tableAggregateFunction)
      Performs a flatAggregate operation on a window grouped table.
      Table select​(org.apache.flink.table.expressions.Expression... fields)
      Performs a selection operation on a window grouped table.
    • Method Detail

      • select

        Table select​(org.apache.flink.table.expressions.Expression... fields)
        Performs a selection operation on a window grouped table. Similar to an SQL SELECT statement. The field expressions can contain complex expressions and aggregations.

        Example:

        
         windowGroupedTable.select($("key"), $("window").start(), $("value").avg().as("valavg"));
         

        Scala Example:

        
         windowGroupedTable.select('key, 'window.start, 'value.avg as 'valavg)
         
      • aggregate

        AggregatedTable aggregate​(org.apache.flink.table.expressions.Expression aggregateFunction)
        Performs an aggregate operation on a window grouped table. You have to close the aggregate(Expression) with a select statement. The output will be flattened if the output type is a composite type.

        Example:

        
         windowGroupedTable.aggregate(call(MyAggregateFunction.class, $("a"), $("b")).as("x", "y", "z"))
           .select($("key"), $("window").start(), $("x"), $("y"), $("z"));
         

        Scala Example:

        
         val aggFunc = new MyAggregateFunction
         windowGroupedTable
           .aggregate(aggFunc('a, 'b) as ('x, 'y, 'z))
           .select('key, 'window.start, 'x, 'y, 'z)
         
      • flatAggregate

        FlatAggregateTable flatAggregate​(org.apache.flink.table.expressions.Expression tableAggregateFunction)
        Performs a flatAggregate operation on a window grouped table. FlatAggregate takes a TableAggregateFunction which returns multiple rows. Use a selection after flatAggregate.

        Example:

        
         windowGroupedTable.flatAggregate(call(MyTableAggregateFunction.class, $("a"), $("b")).as("x", "y", "z"))
           .select($("key"), $("window").start(), $("x"), $("y"), $("z"));
         

        Scala Example:

        
         val tableAggFunc = new MyTableAggregateFunction
         windowGroupedTable
           .flatAggregate(tableAggFunc('a, 'b) as ('x, 'y, 'z))
           .select('key, 'window.start, 'x, 'y, 'z)