开发者社区> 问答> 正文

使用Sharding-JDBC读写分离,SQL中有 count()函数报错?报错

使用Sharding-JDBC读写分离,SQL中有 count()函数报错

严重: Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Handler dispatch failed; nested exception is java.lang.NoSuchMethodError: com.alibaba.druid.sql.ast.expr.SQLAggregateExpr.getOption()Lcom/alibaba/druid/sql/ast/expr/SQLAggregateExpr$Option;] with root cause
java.lang.NoSuchMethodError: com.alibaba.druid.sql.ast.expr.SQLAggregateExpr.getOption()Lcom/alibaba/druid/sql/ast/expr/SQLAggregateExpr$Option;
	at com.dangdang.ddframe.rdb.sharding.parser.visitor.basic.mysql.MySQLSelectVisitor.visit(MySQLSelectVisitor.java:110)
	at com.alibaba.druid.sql.ast.expr.SQLAggregateExpr.accept0(SQLAggregateExpr.java:98)
	at com.alibaba.druid.sql.ast.SQLObjectImpl.accept(SQLObjectImpl.java:40)
	at com.alibaba.druid.sql.visitor.SQLASTOutputVisitor.visit(SQLASTOutputVisitor.java:723)
	at com.dangdang.ddframe.rdb.sharding.parser.visitor.basic.mysql.MySQLSelectVisitor.visit(MySQLSelectVisitor.java:92)
	at com.alibaba.druid.sql.ast.statement.SQLSelectItem.accept0(SQLSelectItem.java:86)
	at com.alibaba.druid.sql.ast.SQLObjectImpl.accept(SQLObjectImpl.java:40)
	at com.alibaba.druid.sql.visitor.SQLASTOutputVisitor.printSelectList(SQLASTOutputVisitor.java:270)
	at com.dangdang.ddframe.rdb.sharding.parser.visitor.basic.mysql.MySQLSelectVisitor.printSelectList(MySQLSelectVisitor.java:56)
	at com.alibaba.druid.sql.dialect.mysql.visitor.MySqlOutputVisitor.visit(MySqlOutputVisitor.java:223)
	at com.dangdang.ddframe.rdb.sharding.parser.visitor.basic.mysql.MySQLSelectVisitor.visit(MySQLSelectVisitor.java:68)
	at com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlSelectQueryBlock.accept0(MySqlSelectQueryBlock.java:255)
	at com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlSelectQueryBlock.accept0(MySqlSelectQueryBlock.java:246)
	at com.alibaba.druid.sql.ast.SQLObjectImpl.accept(SQLObjectImpl.java:40)
	at com.alibaba.druid.sql.visitor.SQLASTOutputVisitor.visit(SQLASTOutputVisitor.java:671)
	at com.alibaba.druid.sql.ast.statement.SQLSelect.accept0(SQLSelect.java:84)
	at com.alibaba.druid.sql.ast.SQLObjectImpl.accept(SQLObjectImpl.java:40)
	at com.alibaba.druid.sql.visitor.SQLASTOutputVisitor.visit(SQLASTOutputVisitor.java:770)
	at com.alibaba.druid.sql.ast.statement.SQLSelectStatement.accept0(SQLSelectStatement.java:58)
	at com.alibaba.druid.sql.ast.SQLObjectImpl.accept(SQLObjectImpl.java:40)
	at com.dangdang.ddframe.rdb.sharding.parser.SQLParseEngine.parse(SQLParseEngine.java:66)
	at com.dangdang.ddframe.rdb.sharding.router.SQLRouteEngine.parseSQL(SQLRouteEngine.java:93)
	at com.dangdang.ddframe.rdb.sharding.router.PreparedSQLRouter.route(PreparedSQLRouter.java:55)
	at com.dangdang.ddframe.rdb.sharding.jdbc.ShardingPreparedStatement.rout

 

展开
收起
爱吃鱼的程序员 2020-06-08 14:17:47 2438 0
2 条回答
写回答
取消 提交回答
  • 发表文章、提出问题、分享经验、结交志同道合的朋友

    有分库分表,不能直接使用聚合语句

    2021-09-30 16:16:01
    赞同 展开评论 打赏
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    请参考faq:http://dangdangdotcom.github.io/sharding-jdbc/01-start/faq/

    第二个问题

    2020-06-08 14:17:57
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
SQL Server在电子商务中的应用与实践 立即下载
GeoMesa on Spark SQL 立即下载
原生SQL on Hadoop引擎- Apache HAWQ 2.x最新技术解密malili 立即下载