Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
510 views
in Technique[技术] by (71.8m points)

apache flink - How to show the table content for the TableEnvironment in batch mode

I am using Flink 1.12.0, and use the following code to work with batch data.

I would like to show the content of the table. When I call print, it complains that table can't be converted to Dataset,but I don't want to use BatchTableEnviroment, which is kind of old planner API.

test("batch test") {
    val settings  = EnvironmentSettings.newInstance().inBatchMode().useBlinkPlanner().build()
    val tenv = TableEnvironment.create(settings)
    val ddl =
      """
      create table sourceTable(
      key STRING,
      `date` STRING,
      price DOUBLE
      ) with (
        'connector' = 'filesystem',
        'path' = 'D:/projects/openprojects3/learn.flink.ioc/data/stock.csv',
        'format' = 'csv'
      )
      """.stripMargin(' ')
    tenv.executeSql(ddl)

    val table = tenv.sqlQuery(
      """
      select * from sourceTable
      """.stripMargin(' '))

    table.print()


  }

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

To my knowledge a processing time temporal table join requires that the the lookup table is backed by a LookupTableSource. So far, in the Flink code base itself only the Hive, HBase and JDBC connector implement this interface. If you want to quickly try this out, you can also use [1], which also implements said interface.

[1] https://github.com/knaufk/flink-faker


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...