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()
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…