I have a graph which has vertex E1 with property "price" and "name" which are storing String values. I need to calculate sum of the column "price" grouped by "name". I am writing the below query using Java:
g.withSideEffect("Neptune#repeatMode","BFS")
.V().hasLabel("E1").group()
.by("name").by(values("price").unfold().sum())
.unfold()
.project("rowName","data")
.by(select(keys).properties(MandatoryCustomerAttributes.firstName.name()).value())
I am getting this error:
{
"requestId": "38b781ce-fc02-4f7d-a71e-476dfd1925ce",
"code": "UnsupportedOperationException",
"detailedMessage": "java.lang.String cannot be cast to java.lang.Number"
}
Please help me in converting the String to any number format so that I can do some mathematical operations.