开发者社区> 问答> 正文

canal sql配置 报 ParserException

已解决

36533739865.png

2020-07-02 09:05:28.721 [main] ERROR c.a.o.canal.adapter.launcher.loader.CanalAdapterLoader - Load canal adapter: es failed java.lang.RuntimeException: com.alibaba.fastsql.sql.parser.ParserException at com.alibaba.otter.canal.client.adapter.es.ESAdapter.init(ESAdapter.java:144) at com.alibaba.otter.canal.adapter.launcher.loader.CanalAdapterLoader.loadAdapter(CanalAdapterLoader.java:168) at com.alibaba.otter.canal.adapter.launcher.loader.CanalAdapterLoader.init(CanalAdapterLoader.java:71) at com.alibaba.otter.canal.adapter.launcher.loader.CanalAdapterService.init(CanalAdapterService.java:58) 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:483) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:365) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:308) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:135) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:422) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1694) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:579) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$1(AbstractBeanFactory.java:353) at org.springframework.beans.factory.support.AbstractBeanFactory$$Lambda$334/2084863094.getObject(Unknown Source) at org.springframework.cloud.context.scope.GenericScope$BeanLifecycleWrapper.getBean(GenericScope.java:390) at org.springframework.cloud.context.scope.GenericScope.get(GenericScope.java:184) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:350) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1089) at org.springframework.cloud.context.scope.refresh.RefreshScope.eagerlyInitialize(RefreshScope.java:126) at org.springframework.cloud.context.scope.refresh.RefreshScope.start(RefreshScope.java:117) 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:483) at org.springframework.context.event.ApplicationListenerMethodAdapter.doInvoke(ApplicationListenerMethodAdapter.java:264) at org.springframework.context.event.ApplicationListenerMethodAdapter.processEvent(ApplicationListenerMethodAdapter.java:182) at org.springframework.context.event.ApplicationListenerMethodAdapter.onApplicationEvent(ApplicationListenerMethodAdapter.java:144) at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:400) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:354) at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:888) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:161) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:553) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395) at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) at com.alibaba.otter.canal.adapter.launcher.CanalAdapterApplication.main(CanalAdapterApplication.java:19) Caused by: com.alibaba.fastsql.sql.parser.ParserException: null at com.alibaba.otter.canal.client.adapter.es.config.SqlParser.parse(SqlParser.java:68) at com.alibaba.otter.canal.client.adapter.es.ESAdapter.init(ESAdapter.java:93) ... 43 common frames omitted 2020-07-02 09:05:28.728 [main] INFO c.a.o.canal.adapter.launcher.loader.CanalAdapterLoader - Start adapter for canal instance: example succeed

以上是所有报错信息

dataSourceKey: defaultDS destination: example groupId: esMapping: _index: asset _type: depreciation_report _id: _id upsert: true sql: "select a.asset_depreciation_id as _id, a.current_depreciation, b.first_date from asset_depreciation a left join asset_depreciation_set b on b.external_id = a.depreciation_id" commitBatch: 3000

这是配置的sql yml ,实在看不出来有什么错误,和其他sql对比了,就是这个不行,把这个yml文件删了就可以运行,加上就不行,有大佬能解答么?

展开
收起
幻风小笨猫 2020-07-02 09:34:08 2695 0
2 条回答
写回答
取消 提交回答
  • 多看多练
    采纳回答

    没有文档真是太难了,本人扒到源码并解决,分享给在看的各位,阿里的SqlParser这个类,我的这个sql它给报了个错,Relation condition column must in select columns. 翻译过来就是这个sql的left join on的条件,他的select 的column没有,所以select 中加个b.external_id就可以了,编译通过。 其实这个exception是抛出的,而源码中把他catch住了重新抛出了一个没有任何提示的ParserException 真是够恶心的,至此问题解决

    2020-07-17 17:45:04
    赞同 2 展开评论 打赏
  • 大佬牛逼牛逼,看完解决我的问题了,因为我主表的id转成_id了,我看他的文档上也没说这种不算,就没把关联表的b.external_id加上

    2022-07-20 15:46:28
    赞同 展开评论 打赏
问答分类:
问答标签:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
SQL Server 2017 立即下载
GeoMesa on Spark SQL 立即下载
原生SQL on Hadoop引擎- Apache HAWQ 2.x最新技术解密malili 立即下载