任务运行时异常: field doesn't exist in the parameters of SQL statement

问题描述/异常栈

2022-02-21 15:17:21,626 INFO  org.apache.flink.runtime.executiongraph.ExecutionGraph       [] - Source: Custom Source -> Calc(select=[funcName, flink, mykey, isSuccess, mytimestamp, mytype, mydata]) -> LookupJoin(table=[sloth_catalog_sloth.magina_database.mysql_dim], joinType=[LeftOuterJoin], async=[false], lookup=[c11bff2c-e337-cafb-f3ee-298184307df3=funcName], select=[funcName, flink, mykey, isSuccess, mytimestamp, mytype, mydata, c11bff2c-e337-cafb-f3ee-298184307df3, matchfield]) -> Calc(select=[UPPER(funcName) AS EXPR$0, flink, mykey, isSuccess, mytimestamp, ((mytype = 1) CASE _UTF-16LE'ONE' CASE (mytype = 2) CASE _UTF-16LE'TWO' CASE null:CHAR(3) CHARACTER SET "UTF-16LE") AS mytype, (mydata.snapshots ITEM 1).content_type AS scontent_type, (mydata.audio ITEM 1).myurl AS amyurl, matchfield AS metavalue]) -> Sink: Sink(table=[sloth_catalog_sloth.magina_database.print_table], fields=[EXPR$0, flink, mykey, isSuccess, mytimestamp, mytype, scontent_type, amyurl, metavalue]) (1/1) (104193a3587e5e7e0893cf384df1b1dd) switched from RUNNING to FAILED on container_e09_1586413220781_19057_01_000002 @ sloth55.jd.163.org (dataPort=42169).
java.lang.IllegalArgumentException: c11bff2c-e337-cafb-f3ee-298184307df3 doesn't exist in the parameters of SQL statement: SELECT `c11bff2c-e337-cafb-f3ee-298184307df3`, `matchfield` FROM `youdao_categoryname_detail` WHERE `c11bff2c-e337-cafb-f3ee-298184307df3` = :c11bff2c-e337-cafb-f3ee-298184307df3
    at org.apache.flink.util.Preconditions.checkArgument(Preconditions.java:138) ~[plugin_ne-flink-1.12.4-1.1.4_scala2.12_hive2.1.1-release-3.8.3-1.3.1.jar:?]
    at org.apache.flink.connector.jdbc.statement.FieldNamedPreparedStatementImpl.prepareStatement(FieldNamedPreparedStatementImpl.java:197) ~[plugin_ne-flink-1.12.4-1.1.4_scala2.12_hive2.1.1-release-3.8.3-1.3.1.jar:?]
    at org.apache.flink.connector.jdbc.statement.FieldNamedPreparedStatement.prepareStatement(FieldNamedPreparedStatement.java:69) ~[plugin_ne-flink-1.12.4-1.1.4_scala2.12_hive2.1.1-release-3.8.3-1.3.1.jar:?]
    at com.netease.sloth.flink.connector.jdbc.table.SlothJdbcRowDataLookupFunction.establishConnectionAndStatement(SlothJdbcRowDataLookupFunction.java:237) ~[plugin_ne-flink-1.12.4-1.1.4_scala2.12_hive2.1.1-release-3.8.3-1.3.1.jar:?]
    at com.netease.sloth.flink.connector.jdbc.table.SlothJdbcRowDataLookupFunction.open(SlothJdbcRowDataLookupFunction.java:125) ~[plugin_ne-flink-1.12.4-1.1.4_scala2.12_hive2.1.1-release-3.8.3-1.3.1.jar:?]
    at LookupFunction$14.open(Unknown Source) ~[?:?]
    at org.apache.flink.api.common.functions.util.FunctionUtils.openFunction(FunctionUtils.java:34) ~[plugin_ne-flink-1.12.4-1.1.4_scala2.12_hive2.1.1-release-3.8.3-1.3.1.jar:?]
    at org.apache.flink.table.runtime.operators.join.lookup.LookupJoinRunner.open(LookupJoinRunner.java:67) ~[flink-table-blink_2.12-ne-flink-1.12.4-1.1.4.jar:ne-flink-1.12.4-1.1.4]
    at org.apache.flink.api.common.functions.util.FunctionUtils.openFunction(FunctionUtils.java:34) ~[plugin_ne-flink-1.12.4-1.1.4_scala2.12_hive2.1.1-release-3.8.3-1.3.1.jar:?]
    at org.apache.flink.streaming.api.operators.AbstractUdfStreamOperator.open(AbstractUdfStreamOperator.java:102) ~[plugin_ne-flink-1.12.4-1.1.4_scala2.12_hive2.1.1-release-3.8.3-1.3.1.jar:?]
    at org.apache.flink.streaming.api.operators.ProcessOperator.open(ProcessOperator.java:56) ~[plugin_ne-flink-1.12.4-1.1.4_scala2.12_hive2.1.1-release-3.8.3-1.3.1.jar:?]
    at org.apache.flink.streaming.runtime.tasks.OperatorChain.initializeStateAndOpenOperators(OperatorChain.java:428) ~[plugin_ne-flink-1.12.4-1.1.4_scala2.12_hive2.1.1-release-3.8.3-1.3.1.jar:?]
    at org.apache.flink.streaming.runtime.tasks.StreamTask.lambda$beforeInvoke$2(StreamTask.java:545) ~[plugin_ne-flink-1.12.4-1.1.4_scala2.12_hive2.1.1-release-3.8.3-1.3.1.jar:?]
    at org.apache.flink.streaming.runtime.tasks.StreamTaskActionExecutor$SynchronizedStreamTaskActionExecutor.runThrowing(StreamTaskActionExecutor.java:93) ~[plugin_ne-flink-1.12.4-1.1.4_scala2.12_hive2.1.1-release-3.8.3-1.3.1.jar:?]
    at org.apache.flink.streaming.runtime.tasks.StreamTask.beforeInvoke(StreamTask.java:535) ~[plugin_ne-flink-1.12.4-1.1.4_scala2.12_hive2.1.1-release-3.8.3-1.3.1.jar:?]
    at org.apache.flink.streaming.runtime.tasks.StreamTask.invoke(StreamTask.java:575) ~[plugin_ne-flink-1.12.4-1.1.4_scala2.12_hive2.1.1-release-3.8.3-1.3.1.jar:?]
    at org.apache.flink.runtime.taskmanager.Task.doRun(Task.java:758) ~[plugin_ne-flink-1.12.4-1.1.4_scala2.12_hive2.1.1-release-3.8.3-1.3.1.jar:?]
    at org.apache.flink.runtime.taskmanager.Task.run(Task.java:573) ~[plugin_ne-flink-1.12.4-1.1.4_scala2.12_hive2.1.1-release-3.8.3-1.3.1.jar:?]
    at java.lang.Thread.run(Thread.java:748) ~[?:1.8.0_152]

解决方案

目前没有什么好的解决办法,建议维表的时候进行规避。

问题原因

维表字段中带"-"会导致这个问题。

作者:邓崃翔