mybatis执行删除,出现预编译SQL中占位符为替换情况

Viewed 66

doris版本2.1.3
项目使用mybatis连接doris,操作数据增删改,在日志文件中出现部分SQL,占位符的?未被替换为实际的值,直接提交到doris,但有SQL是正常的,未替换的SQL占比较少,日志中报错detailMessage = Only support prepare SelectStmt or NativeInsertStmt
日志如下:
2024-0*-02 335 [query] |Client=10...:43073|User=im_rw|Ctl=internal|Db=|State=ERR|ErrorCode=1105|ErrorMessage=errCode = 2, detailMessage = Only support prepare SelectStmt or NativeInsertStmt|Time(ms)=1|ScanBytes=0|ScanRows=0|ReturnRows=0|StmtId=128630192|QueryId=e9f55c02d25c4dc7-81a62cbb1345a501|IsQuery=false|isNereids=false|feIp=10...|Stmt=UPDATE td__bk SET send_auth_sync=?,auth_sync_recv_date = CURRENT_TIMESTAMP WHERE province_name = ? AND sms_port = ? AND sub_sms_port=?|CpuTimeMS=0|ShuffleSendBytes=-1|ShuffleSendRows=-1|SqlHash=97037ffc0e872fb7679e6ff7c39e80f9|peakMemoryBytes=0|SqlDigest=|TraceId=|WorkloadGroup=normal|FuzzyVariables=

2 Answers

新优化器在2.1.5已经支持preapred,升级到2.1.5可以解决

目前已经升级到2.1.6版本了,仍有这个情况出现,目前发现有三种报错:
1、更新和删除的SQL中占位符不替换,报错:State=ERR|ErrorCode=1105|ErrorMessage=errCode = 2, detailMessage = Only support prepare SelectStmt or NativeInsertStmt
2、select语句中占位符不替换报空指针异常:State=ERR|ErrorCode=1105|ErrorMessage=NullPointerException, msg: java.lang.NullPointerException: null
对于这个错误,warn日志有纤细信息:
java.lang.NullPointerException: null
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:903) ~[guava-32.1.2-jre.jar:?]
at org.apache.doris.catalog.ScalarType.getAssignmentCompatibleType(ScalarType.java:1148) ~[fe-common-1.2-SNAPSHOT.jar:1.2-SNAPSHOT]
at org.apache.doris.catalog.ScalarType.isImplicitlyCastable(ScalarType.java:1176) ~[fe-common-1.2-SNAPSHOT.jar:1.2-SNAPSHOT]
at org.apache.doris.catalog.Type.isImplicitlyCastable(Type.java:825) ~[fe-common-1.2-SNAPSHOT.jar:1.2-SNAPSHOT]
at org.apache.doris.catalog.Function.isSubtype(Function.java:366) ~[doris-fe.jar:1.2-SNAPSHOT]
at org.apache.doris.catalog.Function.compare(Function.java:341) ~[doris-fe.jar:1.2-SNAPSHOT]
at org.apache.doris.catalog.FunctionSet.getFunction(FunctionSet.java:331) ~[doris-fe.jar:1.2-SNAPSHOT]
at org.apache.doris.catalog.FunctionSet.getFunction(FunctionSet.java:259) ~[doris-fe.jar:1.2-SNAPSHOT]
at org.apache.doris.catalog.FunctionSet.getFunction(FunctionSet.java:224) ~[doris-fe.jar:1.2-SNAPSHOT]
3、select语句中不替换,第二个报错:State=NOOP|ErrorCode=0|ErrorMessage=|Time(ms)=1|ScanBytes=0|ScanRows=0|ReturnRows=0