Influxdb 1.2.2 subquery for top X

I have a measurement in which I sum a field and group it by tag. Then from that, I want to fetch top 10 tagged fields. Basically, I want to get top 10 sum(field) grouped by tag. In influx DB: 1.4, I do it through a top function on the subquery and tag.

Example: To see top 10 city visits in the last 7 days.

select top(“num_items”,“cityCode”,10) from(SELECT sum(“visits”) as num_items FROM “events” WHERE (“country” = ‘USA’) AND time >= now() - 7d and time <= now() GROUP BY “cityCode”)

However, the same query does not work in Influx 1.2.2. Was there an issue in this version or it was a new feature. Or is there a different query in version 1.2.2

Ok. So found the problem. The issue was fixed in pull request
Refactor the subquery code and fix outer condition queries by jsternberg · Pull Request #8081 · influxdata/influxdb · GitHub which must have come in a version after May 8