2020年12月31日星期四

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()        }  
https://stackoverflow.com/questions/65526840/how-to-show-the-table-content-for-the-tableenvironment-in-batch-mode January 01, 2021 at 10:06AM

没有评论:

发表评论