kakao / s2graph

This code base is retained for historical interest only, please visit Apache Incubator Repo for latest one
https://github.com/apache/incubator-s2graph
Other
250 stars 32 forks source link

Add global limit clause #117

Open elric-k opened 9 years ago

elric-k commented 9 years ago

It cannot be handled to get how many edges as final result, especially using multi-step query. So we need the global scope limit to constrain the number of edges as final results.

Please refer to below example, the number of edges should be 10 at most by the limit clause on top.

{
  "limit" : 10,
  "srcVertices": [{"serviceName": "s2graph", "columnName": "user_id", "id": 1}],
  "steps": [
    {
      "step": [ {"label": "user_click_item", "direction":"out", "limit": 10, "scoring": {"score": 1}} ]
    },
    {
      "step": [ {"label": "user_click_item", "direction":"in", "limit": 10, "scoring": {"score": 1}} ]
    },
    {
      "step": [ {"label": "user_click_item", "direction":"out", "limit": 10, "scoring": {"score": 1}} ]
    }
  ]
}
SteamShon commented 9 years ago

@elric-k : are you still working on this issue? if so, can you PR what has been done so far with descriptions?

SteamShon commented 8 years ago

@elric-k : what about when group by clause is given?? should we return 10 groupby key? or each grouped collection should return 10?

elric-k commented 8 years ago

@SteamShon : In that case, I think it would be better to return 10 groupBy key. Please see 'feature/add_global_limit' branch that is working branch for this issue by @hsleep.