Hi,
This is my query…I want count in descending order and also limit the result like top3
Thank you
Hi,
This is my query…I want count in descending order and also limit the result like top3
Thank you
So for this specific example, you dont actually need a group by accum - but we can look at a few variations
MapAccum<STRING, INT> @@cityCount:
res = SELECT tgt FROM start:s -(reverse_edge_type_1) - Person:tgt
ACCUM @@cityCount += (tgt.City ->1);
print @@cityCount;
TYPEDEF tuple<STRING cityName, INT cnt> cityCnts;
HeapAccum<cityCnts>(lim, cnt DESC) @@mainCityCount;
MapAccum<STRING, INT> @@cityCount:
res = SELECT tgt FROM start:s -(reverse_edge_type_1) - Person:tgt
ACCUM @@cityCount += (tgt.City ->1)
POST-ACCUM
FOREACH (x,y) IN @@cityCount
@@mainCityCount += cityCnts(x,y)
END
print @@mainCityCount;