开发者社区> 问答> 正文

更新表数据后,es adapter报找不到column

版本:1.1.4

原sql:select DISTINCT CONCAT(m.request_id,'-',IFNULL(log.user_id,'')) id,m.request_id requestId,m.request_name requestName,m.workflow_id workflowId,c.workflow_name workflowName,c.subordinatedocuments subordinateDocuments,c.subordinatedocumentsType subordinateDocumentsType,m.region_no zoneNo,m.managing_city_no managingCityNo,m.business_city_no businessCityNo,m.current_operator_name currentOperatorName,p.next_current_operator_name pNextCurrentOperatorName,p.next_node_operator pNextNodeOperator,m.create_user createUser,m.create_time createTime,m.update_time updateTime,m.node_status nodeStatus,m.workflow_status workflowStatus,m.feasible_request_id feasibleRequestId,sa.feasible_apply feasibleApplyId,sa.shop_no shopApplyShopNo,fea.shop_no feaShopNo,cs.contact_shop_no contactShopNo,swa.shop_no shopApplyWithdrawalShopNo,sa.short_name shopApplyShortName,sa.full_name shopApplyFullName,fea.shop_name feaShopFullName,cs.contract_shop_full_name contractShopFullName,swa.full_name shopApplyWithdrawalFullName,pre.pay_money prePayMoney,ex.pay_money expensePayMoney,log.user_id userId,log.status backlogStatus from workflow_record_main m LEFT JOIN workflow_config c ON m.workflow_id = c.workflow_id LEFT JOIN shop_apply sa on m.request_id = sa.bill_no LEFT JOIN feasibility_shop_app_apply fea ON fea.request_id = m.request_id LEFT JOIN shop_withdrawal_apply swa on m.request_id = swa.bill_no LEFT JOIN work_finance_pre_pay pre ON m.request_id = pre.bill_no LEFT JOIN work_finance_expense_pay ex ON m.request_id = ex.bill_no LEFT JOIN (SELECT contract_no,GROUP_CONCAT(distinct shop_no) as contact_shop_no, GROUP_CONCAT(distinct shop_full_name) as contract_shop_full_name from con_contract_shop GROUP BY contract_no) cs ON cs.contract_no = m.request_id LEFT JOIN (select request_id,user_id,GROUP_CONCAT(distinct status) as status from workflow_record_backlog GROUP BY request_id,user_id) log ON log.request_id = m.request_id LEFT JOIN (select request_id,group_concat(next_node_operator ORDER BY id DESC) as next_node_operator,group_concat(next_current_operator_name ORDER BY id DESC) as next_current_operator_name from workflow_record_operation GROUP BY request_id) as p on p.request_id = m.request_id

【提问208】

报错信息: 2019-09-15 18:52:41.975 [pool-3-thread-1] ERROR com.alibaba.otter.canal.client.adapter.support.Util - sqlRs has error, sql: select DISTINCT CONCAT(m.request_id,'-',IFNULL(log.user_id,'')) id,m.request_id requestId,m.request_name requestName,m.workflow_id workflowId,c.workflow_name workflowName,c.subordinatedocuments subordinateDocuments,c.subordinatedocumentsType subordinateDocumentsType,m.region_no zoneNo,m.managing_city_no managingCityNo,m.business_city_no businessCityNo,m.current_operator_name currentOperatorName,p.next_current_operator_name pNextCurrentOperatorName,p.next_node_operator pNextNodeOperator,m.create_user createUser,m.create_time createTime,m.update_time updateTime,m.node_status nodeStatus,m.workflow_status workflowStatus,m.feasible_request_id feasibleRequestId,sa.feasible_apply feasibleApplyId,sa.shop_no shopApplyShopNo,fea.shop_no feaShopNo,cs.contact_shop_no contactShopNo,swa.shop_no shopApplyWithdrawalShopNo,sa.short_name shopApplyShortName,sa.full_name shopApplyFullName,fea.shop_name feaShopFullName,cs.contract_shop_full_name contractShopFullName,swa.full_name shopApplyWithdrawalFullName,pre.pay_money prePayMoney,ex.pay_money expensePayMoney,log.user_id userId,log.status backlogStatus from workflow_record_main m LEFT JOIN workflow_config c ON m.workflow_id = c.workflow_id LEFT JOIN shop_apply sa on m.request_id = sa.bill_no LEFT JOIN feasibility_shop_app_apply fea ON fea.request_id = m.request_id LEFT JOIN shop_withdrawal_apply swa on m.request_id = swa.bill_no LEFT JOIN work_finance_pre_pay pre ON m.request_id = pre.bill_no LEFT JOIN work_finance_expense_pay ex ON m.request_id = ex.bill_no LEFT JOIN (SELECT contract_no,GROUP_CONCAT(distinct shop_no) as contact_shop_no, GROUP_CONCAT(distinct shop_full_name) as contract_shop_full_name from con_contract_shop GROUP BY contract_no) cs ON cs.contract_no = m.request_id LEFT JOIN (select request_id,user_id,GROUP_CONCAT(distinct status) as status from workflow_record_backlog GROUP BY request_id,user_id) log ON log.request_id = m.request_id LEFT JOIN (select request_id,group_concat(next_node_operator ORDER BY id DESC) as next_node_operator,group_concat(next_current_operator_name ORDER BY id DESC) as next_current_operator_name from workflow_record_operation WHERE log.request_id='MA131807160043' GROUP BY request_id) as p on p.request_id = m.request_id 2019-09-15 18:52:41.975 [pool-3-thread-1] ERROR c.a.otter.canal.client.adapter.es.service.ESSyncService - sync error, es index: shop-ms, DML : Dml{destination='example', database='shop_ms', table='workflow_record_backlog', type='UPDATE', es=1568544760000, ts=1568544761571, sql='', data=[{id=83, request_id=MA131807160043, node_id=1, user_id=121434, user_no=null, never_click=1, status=4, region_no=M, organ_type_no=U010102, create_user=刘磊, create_time=2018-07-16 11:16:19.0, update_user=刘磊, update_time=2018-07-16 11:16:19.0}], old=[{status=3}]} 2019-09-15 18:52:41.977 [pool-3-thread-1] ERROR c.a.o.canal.adapter.launcher.loader.CanalAdapterWorker - java.lang.RuntimeException: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'log.request_id' in 'where clause' java.lang.RuntimeException: java.lang.RuntimeException: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'log.request_id' in 'where clause' at com.alibaba.otter.canal.client.adapter.es.service.ESSyncService.sync(ESSyncService.java:110) at com.alibaba.otter.canal.client.adapter.es.service.ESSyncService.sync(ESSyncService.java:58) at com.alibaba.otter.canal.client.adapter.es.ESAdapter.sync(ESAdapter.java:169) at com.alibaba.otter.canal.client.adapter.es.ESAdapter.sync(ESAdapter.java:148) at com.alibaba.otter.canal.adapter.launcher.loader.AbstractCanalAdapterWorker.batchSync(AbstractCanalAdapterWorker.java:201) at com.alibaba.otter.canal.adapter.launcher.loader.AbstractCanalAdapterWorker.lambda$null$1(AbstractCanalAdapterWorker.java:63) at java.util.ArrayList.forEach(ArrayList.java:1257) at com.alibaba.otter.canal.adapter.launcher.loader.AbstractCanalAdapterWorker.lambda$null$2(AbstractCanalAdapterWorker.java:59) at java.util.concurrent.FutureTask.run(FutureTask.java:266) 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.lang.RuntimeException: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'log.request_id' in 'where clause' at com.alibaba.otter.canal.client.adapter.support.Util.sqlRS(Util.java:45) at com.alibaba.otter.canal.client.adapter.es.service.ESSyncService.wholeSqlOperation(ESSyncService.java:706) at com.alibaba.otter.canal.client.adapter.es.service.ESSyncService.update(ESSyncService.java:306) at com.alibaba.otter.canal.client.adapter.es.service.ESSyncService.sync(ESSyncService.java:95) ... 11 common frames omitted Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'log.request_id' in 'where clause' at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) at com.mysql.jdbc.Util.getInstance(Util.java:408) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:943) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3970) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3906) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2524) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2677) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2545) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2503) at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1369) at com.alibaba.druid.pool.DruidPooledStatement.executeQuery(DruidPooledStatement.java:230) at com.alibaba.otter.canal.client.adapter.support.Util.sqlRS(Util.java:40) ... 14 common frames omitted 2019-09-15 18:52:41.978 [Thread-4] ERROR c.a.o.canal.adapter.launcher.loader.CanalAdapterWorker - Outer adapter sync failed! Error sync but ACK!

提问209.png

说sql有问题,其中的 WHERE log.request_id='MA131807160043' 子句并没有写在原sql中,不知道为何会出现这句,而且会插入到一个奇怪的位置,我是将workflow_record_backlog表中的某条记录的status字段更新了,就出现这个问题。

原提问者GitHub用户a932846905

展开
收起
数据大拿 2023-05-04 10:53:03 139 0
1 条回答
写回答
取消 提交回答
  • es适配的sql暂时不支持主表的distinct和group by等聚合操作

    原回答者GitHub用户rewerma

    2023-05-05 10:05:47
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载