Hi, 看起来你的DDL应该没有太大问题,你可以把代码贴的再完整一点么,可能跟下面的代码有关系。
macia kk <pre...@gmail.com> 于2020年6月7日周日 下午3:33写道: > 各位大佬, > > 我的数据源 json 里有 database, table 字段,想解析出来,是保留关键字,我加了反引号,但是还是报错,这是为什么呢 > > val bsSettings = > > EnvironmentSettings.newInstance().useBlinkPlanner().inStreamingMode().build() > val bsTableEnv = StreamTableEnvironment.create(env, bsSettings) > val sourceTable = """CREATE TABLE my_kafak_source ( > | `table` varchar, > | `database` varchar, > | `data` row < transaction_id varchar, > | user_id int, > | amount int, > | >, > | maxwell_ts bigint, > | ts_watermark as > TO_TIMESTAMP(FROM_UNIXTIME(maxwell_ts/1000)) > |) WITH ( > |)""".stripMargin > > error > > The program finished with the following exception: > > org.apache.flink.client.program.ProgramInvocationException: The main > method caused an error: SQL parse failed. Encountered "table" at line > 1, column 8. > Was expecting one of: > "ABS" ... > "ALL" ... > "ARRAY" ... > "AVG" ... > "CARDINALITY" ... > "CASE" ... > "CAST" ... > "CEIL" ... > -- Best, Benchao Li