开发者社区> 问答> 正文

canal 运行一段时间后,突然报这个错误

2019-03-03 02:24:47.793 [destination = mavericks , address = rds9bqff31333g29hfr9o.mysql.rds.aliyuncs.com/123.56.209.14:3306 , EventParser] WARN c.a.otter.canal.parse.inbound.mysql.tsdb.MemoryTableMeta - parse faield : CREATE DEFINER=mavericks@% FUNCTION remove_duplicate_str(in_str varchar(1000),spliter varchar(10)) RETURNS varchar(1000) CHARSET utf8mb4 BEGIN DECLARE v_result VARCHAR(1000); DECLARE v_strs VARCHAR(1000); DECLARE v_obj VARCHAR(100);

IF (in_str is not null and in_str <> '') THEN SET v_strs = in_str; if instr(v_strs, spliter) = 0 then -- 如果没有分隔符,则直接赋值输出变量为输入变量 set v_result = v_strs; else -- 开始循环输入字符串,按spliter字符分隔 while INSTR(v_strs, spliter) > 0 do SET v_obj = SUBSTR(v_strs, 1, INSTR(v_strs, spliter) - 1); SET v_strs = SUBSTR(v_strs, INSTR(v_strs, spliter) + 1);

		if(v_result is null)  THEN
				SET v_result = v_obj; 
		else 
				if(INSTR(v_result, v_obj) = 0) THEN
					-- 如果在v_result中没找到v_obj,则拼接该字符串
					-- 反之如果找到了,就跳过
					SET v_result = CONCAT(v_result, spliter, v_obj);
				end if;
		end if;
	end while;
	-- 因最后一个字符串中肯定不包含spiliter的字符,
	-- 因此退出循环后需要拼接最后一个字符串
	if(INSTR(v_result, v_strs) = 0) THEN
		SET v_result = CONCAT(v_result, spliter, v_strs);
	end if;
end if;

ELSE SET v_result = in_str; END IF ;

RETURN v_result; END com.alibaba.fastsql.sql.parser.ParserException: syntax error, error in :'if; end if; end while; -- 因最后一', expect WHILE, actual IF, pos 897, line 26, column 10, token IF at com.alibaba.fastsql.sql.parser.SQLParser.printError(SQLParser.java:363) ~[fastsql-2.0.0_preview_644.jar:2.0.0_preview_644] at com.alibaba.fastsql.sql.parser.SQLParser.accept(SQLParser.java:371) ~[fastsql-2.0.0_preview_644.jar:2.0.0_preview_644] at com.alibaba.fastsql.sql.dialect.mysql.parser.MySqlStatementParser.parseWhile(MySqlStatementParser.java:6412) ~[fastsql-2.0.0_preview_644.jar:2.0.0_preview_644] at com.alibaba.fastsql.sql.dialect.mysql.parser.MySqlStatementParser.parseWhile(MySqlStatementParser.java:41) ~[fastsql-2.0.0_preview_644.jar:2.0.0_preview_644] at com.alibaba.fastsql.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:325) ~[fastsql-2.0.0_preview_644.jar:2.0.0_preview_644] at com.alibaba.fastsql.sql.dialect.mysql.parser.MySqlStatementParser.parseIf(MySqlStatementParser.java:6381) ~[fastsql-2.0.0_preview_644.jar:2.0.0_preview_644] at com.alibaba.fastsql.sql.dialect.mysql.parser.MySqlStatementParser.parseIf(MySqlStatementParser.java:41) ~[fastsql-2.0.0_preview_644.jar:2.0.0_preview_644] at com.alibaba.fastsql.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:331) ~[fastsql-2.0.0_preview_644.jar:2.0.0_preview_644] at com.alibaba.fastsql.sql.dialect.mysql.parser.MySqlStatementParser.parseIf(MySqlStatementParser.java:6361) ~[fastsql-2.0.0_preview_644.jar:2.0.0_preview_644] at com.alibaba.fastsql.sql.dialect.mysql.parser.MySqlStatementParser.parseIf(MySqlStatementParser.java:41) ~[fastsql-2.0.0_preview_644.jar:2.0.0_preview_644] at com.alibaba.fastsql.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:331) ~[fastsql-2.0.0_preview_644.jar:2.0.0_preview_644] at com.alibaba.fastsql.sql.dialect.mysql.parser.MySqlStatementParser.parseBlock(MySqlStatementParser.java:1508) ~[fastsql-2.0.0_preview_644.jar:2.0.0_preview_644] at com.alibaba.fastsql.sql.dialect.mysql.parser.MySqlStatementParser.parseCreateFunction(MySqlStatementParser.java:5949) ~[fastsql-2.0.0_preview_644.jar:2.0.0_preview_644] at com.alibaba.fastsql.sql.dialect.mysql.parser.MySqlStatementParser.parseCreate(MySqlStatementParser.java:359) ~[fastsql-2.0.0_preview_644.jar:2.0.0_preview_644] at com.alibaba.fastsql.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:224) ~[fastsql-2.0.0_preview_644.jar:2.0.0_preview_644] at com.alibaba.fastsql.sql.SQLUtils.parseStatements(SQLUtils.java:525) ~[fastsql-2.0.0_preview_644.jar:2.0.0_preview_644] at com.alibaba.fastsql.sql.repository.SchemaRepository.console(SchemaRepository.java:439) ~[fastsql-2.0.0_preview_644.jar:2.0.0_preview_644] at com.alibaba.otter.canal.parse.inbound.mysql.tsdb.MemoryTableMeta.apply(MemoryTableMeta.java:78) ~[canal.parse-1.1.2.jar:na] at com.alibaba.otter.canal.parse.inbound.mysql.tsdb.DatabaseTableMeta.applyHistoryOnMemory(DatabaseTableMeta.java:463) [canal.parse-1.1.2.jar:na] at com.alibaba.otter.canal.parse.inbound.mysql.tsdb.DatabaseTableMeta.rollback(DatabaseTableMeta.java:174) [canal.parse-1.1.2.jar:na] at com.alibaba.otter.canal.parse.inbound.mysql.AbstractMysqlEventParser.processTableMeta(AbstractMysqlEventParser.java:84) [canal.parse-1.1.2.jar:na] at com.alibaba.otter.canal.parse.inbound.AbstractEventParser$3.run(AbstractEventParser.java:192) [canal.parse-1.1.2.jar:na] at java.lang.Thread.run(Thread.java:745) [na:1.8.0_60]

原提问者GitHub用户

展开
收起
数据大拿 2023-05-04 18:24:06 86 0
1 条回答
写回答
取消 提交回答
  • 解析层面不支持自定义函数,只是一个日志输出,可以忽略

    原回答者GitHub用户agapple

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

相关电子书

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