Hi folks. Problem is user must use Json representation for query result since groupBy, orderBy, and merging multiple query result into one reside on PostProcess which is not meant for it.
My suggestion in one line, is make PostProcess simply build json from result type of getEdges and make getEdges build complete query result, so different output format can be easily supported. In more detail, query traversal is processed by Graph#getEdges which accept Query then return Future[Seq[QueryRequestWithResult]]. On completion of this Future, we run PostProcess#toSimpleVertexArrJson to change Seq[QueryRequestWithResult] into Json result. I think most of post process logic, especially with GroupBy, OrderBy needs to be processed in Graph#getEdges inside, then return better result type which can contains grouped, ordered, result of edges. I am suggesting make PostProcess only to deal with building json result from already processed result. This measn a lot of changes(only because return type change of core method), refactor Graph#filterEdges to build right result(grouped, ordered, and each edge should have all information describe how they will be translated into json later). By separate Json from traverse flow, I think we can provide user more choice on their result format such as thrift, protobuf, etc. One exceptional case is MultiQuery. it run multiple traversal per each query in MultiQuery then aggregate each query's traversal result into one. I think this exceptional case also removed by provide better method to merge different query's traversal result into one. There will be few subtasks for this. please feel free to list up more task. 1. Define better return type of getEdges. 2. Refactor getEdges to build complete result(ordered, grouped, json writable).
