grails - 如何修复groovy.lang.MissingMethodException:计算总数时方法没有签名

标签 grails cassandra

我正在尝试连接到Cassandra并在Grails中写一个查询以总计,但是我遇到了一个缺少的方法异常:

groovy.lang.MissingMethodException: No signature of method: project .sampleTest.column() is applicable for argument types: (java.lang.String) values: [amount] Possible solutions: collect(), dump(), collect(groovy.lang.Closure)



以下是我写的求和金额查询。
Select selectQuery = QueryBuilder.select().fcall("sum", column("amount")).from(tableName).allowFiltering()

Session session = cassandraTemplate.getSession();

Where selectWhere = selectQuery.where();

最佳答案

要在 fcall() 内使用列名,您需要使用静态方法 QueryBuilder.column() 。因此,当您在fcall()中使用它时,您需要像这样来调用它:

Select selectQuery = QueryBuilder.select().fcall("sum", QueryBuilder.column("amount")).from(tableName).allowFiltering()

关于grails - 如何修复groovy.lang.MissingMethodException:计算总数时方法没有签名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54097466/

相关文章:

grails - Grails 中的用户通知

couchdb - Cassandra 和 CouchDB 有什么区别?

linux - 在 debian 上安装 cassandra 时获取类型 echo 未知

grails - grails 中的自定义验证消息

Grails:有我可以检查的调试标志吗?

nosql - INCR 的 Cassandra CQL 等价物是什么(增加 CounterColumn)?

Cassandra 节点工具 : Connection refused to host: 172. 24.0.10

java - Spark Cassandra 连接器基本简单程序出现 Spark 日志记录错误

grails - 在 Grails 中以 DRY 方式动态构建 createCriteria?

Grails 预测分组和计数