I am trying to connect to Cassandra and write a query in Grails to total the amount but I am getting a missing method exception:
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)
Below is the query what I have written to sum the amount.
Select selectQuery = QueryBuilder.select().fcall("sum", column("amount")).from(tableName).allowFiltering()
Session session = cassandraTemplate.getSession();
Where selectWhere = selectQuery.where();
To use a column name inside of fcall()
you need to use the static method QueryBuilder.column()
. So when you use it in fcall()
you need to call it like:
Select selectQuery = QueryBuilder.select().fcall("sum", QueryBuilder.column("amount")).from(tableName).allowFiltering()