Class UpdatingTopCityExample

java.lang.Object
org.apache.flink.table.examples.java.basics.UpdatingTopCityExample

public final class UpdatingTopCityExample extends Object
Example for aggregating and ranking data using Flink SQL on updating tables.

The example shows how to declare a table using SQL DDL for reading bounded, insert-only data and how to handle updating results in streaming mode. It should give a first impression about Flink SQL as a changelog processor. The example uses some streaming operations that produce a stream of updates. See the other examples for pure CDC processing and more complex operations.

In particular, the example shows how to

  • setup a TableEnvironment,
  • use the environment for creating a CSV file with bounded example data,
  • aggregate the incoming INSERT changes in an updating table,
  • compute an updating top-N result,
  • collect and materialize the table locally.

The example executes two Flink jobs. The results are written to stdout.

Note: Make sure to include the SQL CSV format when submitting this example to Flink (e.g. via command line). This step is not necessary when executing the example in an IDE.

  • Constructor Details

    • UpdatingTopCityExample

      public UpdatingTopCityExample()
  • Method Details