The following is part of the code :
String createKafkaSql = "create table if not exists xxxxx" +
"(xxxxx\n" +
",update_time timestamp(3) comment '11'\n" +
",watermark for update_time as update_time - interval '20'
second)\n" +
"with ('connector' = 'kafka'\n" +
",'topic' = '" + topic + "'\n" +
",'properties.bootstrap.servers' = '" + bootstrapServers +
"'\n" +
",'properties.group.id' = 'flink_sql_tyc_company_info'\n" +
",'scan.startup.mode' = 'earliest-offset'\n" +
",'format' = 'json','json.fail-on-missing-field' =
'false','json.ignore-parse-errors' = 'true')";
tEnv.executeSql(createKafkaSql);
tEnv.getConfig().setSqlDialect(SqlDialect.HIVE);
String CreateHiveSql = "create table if not exists xxxx" +
"(xxxx)\n" +
"partitioned by (op_day string comment '111')\n" +
"stored as orc\n" +
"tblproperties('partition.time-extractor.timestamp-pattern'='$op_day'\n" +
",'sink.partition-commit.trigger'='partition-time'\n" +
",'sink.partition-commit.delay'='1h'\n" +
",'sink.partition-commit.policy.kind'='metastore,success-file')";
tEnv.executeSql(CreateHiveSql);
tEnv.getConfig().setSqlDialect(SqlDialect.DEFAULT);
String insert = "insert into xxxxx\n" +
"select `xxxxx" +
",date_format(update_time,'yyyy-MM-dd')\n" +
"from xxxxx";
tEnv.executeSql(insert);
On 6/8/2022 15:14,顾斌杰<binjie...@paat.com> wrote:
Flink version: 1.13
When executed in the local environment (windows), there is no exception.
When starting the project with flink web ui, I get the following error:
Server Response:
org.apache.flink.runtime.rest.handler.RestHandlerException: Could not execute
application.
at
org.apache.flink.runtime.webmonitor.handlers.JarRunHandler.lambda$handleRequest$1(JarRunHandler.java:108)
at java.util.concurrent.CompletableFuture.uniHandle(CompletableFuture.java:822)
at
java.util.concurrent.CompletableFuture$UniHandle.tryFire(CompletableFuture.java:797)
at
java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:474)
at
java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1595)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.util.concurrent.CompletionException:
org.apache.flink.util.FlinkRuntimeException: Could not execute application.
at
java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:273)
at
java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:280)
at
java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1592)
... 7 more
Caused by: org.apache.flink.util.FlinkRuntimeException: Could not execute
application.
at
org.apache.flink.client.deployment.application.DetachedApplicationRunner.tryExecuteJobs(DetachedApplicationRunner.java:88)
at
org.apache.flink.client.deployment.application.DetachedApplicationRunner.run(DetachedApplicationRunner.java:70)
at
org.apache.flink.runtime.webmonitor.handlers.JarRunHandler.lambda$handleRequest$0(JarRunHandler.java:102)
at
java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590)
... 7 more
Caused by: org.apache.flink.client.program.ProgramInvocationException: The main
method caused an error: Could not find a suitable table factory for
'org.apache.flink.table.planner.delegation.ParserFactory' in the classpath.
Reason: Required context properties mismatch. The following properties are
requested: table.sql-dialect=hive The following factories have been considered:
org.apache.flink.table.planner.delegation.DefaultParserFactory
at
org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:372)
at
org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:222)
at org.apache.flink.client.ClientUtils.executeProgram(ClientUtils.java:114)
at
org.apache.flink.client.deployment.application.DetachedApplicationRunner.tryExecuteJobs(DetachedApplicationRunner.java:84)
... 10 more
Caused by: org.apache.flink.table.api.NoMatchingTableFactoryException: Could
not find a suitable table factory for
'org.apache.flink.table.planner.delegation.ParserFactory' in the classpath.
Reason: Required context properties mismatch. The following properties are
requested: table.sql-dialect=hive The following factories have been considered:
org.apache.flink.table.planner.delegation.DefaultParserFactory
at
org.apache.flink.table.factories.TableFactoryService.filterByContext(TableFactoryService.java:300)
at
org.apache.flink.table.factories.TableFactoryService.filter(TableFactoryService.java:178)
at
org.apache.flink.table.factories.TableFactoryService.findAllInternal(TableFactoryService.java:164)
at
org.apache.flink.table.factories.TableFactoryService.findAll(TableFactoryService.java:121)
at
org.apache.flink.table.factories.ComponentFactoryService.find(ComponentFactoryService.java:50)
at
org.apache.flink.table.planner.delegation.PlannerBase.createNewParser(PlannerBase.scala:143)
at
org.apache.flink.table.planner.delegation.PlannerBase.getParser(PlannerBase.scala:149)
at
org.apache.flink.table.api.internal.TableEnvironmentImpl.getParser(TableEnvironmentImpl.java:1466)
at
org.apache.flink.table.api.internal.TableEnvironmentImpl.executeSql(TableEnvironmentImpl.java:724)
at
com.paat.realtime.task.core.TableCrawlerTycTask.transform(TableCrawlerTycTask.java:60)
at
com.paat.realtime.core.TableStreamApplicationContext.execute(TableStreamApplicationContext.java:72)
at
com.paat.realtime.application.TableCrawlerTycApplication.main(TableCrawlerTycApplication.java:17)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:355)
... 13 more
Please what is the reason for this.