What you are trying to do is not possible with Spring Data Neo4j repositories. Their purpose is to interact on the entity abstraction and not with arbitrary data like String and Long combined into a map.
But there is a solution to this also in Spring Data Neo4j: The Neo4jClient (Neo4jClient Documentation)
For your example this would be something like:
Collection<Map<String, Object>> all = neo4jClient
.query("match (n:People) return n.group as `group`,count(n) as `num`")
.fetch().all();