Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support results count for kneighbor/kout/rings #995

Merged
merged 4 commits into from
May 26, 2020
Merged

support results count for kneighbor/kout/rings #995

merged 4 commits into from
May 26, 2020

Conversation

zhoney
Copy link
Contributor

@zhoney zhoney commented May 13, 2020

implement: #994

Change-Id: Ieb7702a1bb8304391585704469cc7c7f6b07f565

@codecov
Copy link

codecov bot commented May 13, 2020

Codecov Report

Merging #995 into master will decrease coverage by 0.01%.
The diff coverage is 1.31%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #995      +/-   ##
============================================
- Coverage     69.54%   69.52%   -0.02%     
- Complexity     5249     5274      +25     
============================================
  Files           324      325       +1     
  Lines         25730    25805      +75     
  Branches       3619     3631      +12     
============================================
+ Hits          17893    17940      +47     
- Misses         6110     6142      +32     
+ Partials       1727     1723       -4     
Impacted Files Coverage Δ Complexity Δ
...a/com/baidu/hugegraph/api/traversers/CountAPI.java 0.00% <0.00%> (ø) 0.00 <0.00> (?)
...du/hugegraph/traversal/optimize/TraversalUtil.java 61.43% <0.00%> (-1.03%) 108.00 <0.00> (+4.00) ⬇️
...n/java/com/baidu/hugegraph/version/ApiVersion.java 75.00% <100.00%> (ø) 0.00 <0.00> (ø)
...a/com/baidu/hugegraph/backend/query/Condition.java 80.08% <0.00%> (-0.41%) 31.00% <0.00%> (ø%)
...om/baidu/hugegraph/task/StandardTaskScheduler.java 86.17% <0.00%> (-0.36%) 68.00% <0.00%> (ø%)
...c/main/java/com/baidu/hugegraph/task/HugeTask.java 69.76% <0.00%> (-0.34%) 69.00% <0.00%> (-1.00%)
...graph/backend/store/cassandra/CassandraTables.java 88.14% <0.00%> (+0.26%) 3.00% <0.00%> (ø%)
...egraph/backend/store/cassandra/CassandraStore.java 69.01% <0.00%> (+0.35%) 53.00% <0.00%> (+1.00%)
.../baidu/hugegraph/backend/query/ConditionQuery.java 85.90% <0.00%> (+0.44%) 98.00% <0.00%> (+1.00%)
... and 9 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 071b3b3...c8635c1. Read the comment docs.

implement: #994

Change-Id: Ieb7702a1bb8304391585704469cc7c7f6b07f565
Change-Id: Id9a2268d8f768d4b66e4b6499b7bb6d78212d1bb
if (countOnly) {
return manager.serializer(g).writeMap(ImmutableMap.of(
"count", paths.size()));
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reset these changes

public static class Step {

private Directions direction;
private Map<Id, String> labels;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add properties for filtering sortkey:
private Map<String, Object> properties;

return this.edgesOfVertex(target, currentStep);
});
} else {
// The last step, just query count
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move out from for-loop

return new FilterIterator<>(flatten, e -> {
if (this.containsTraversed) {
// Count intermediate vertices
this.count[0]++;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change count[0] to MutateLong

Change-Id: I766e324dc3202966a6764979643e9793260e008e
// Wrap steps to Iterator except last step
for (int i = 1; i < stepNum - 1; i++) {
Step currentStep = steps.get(i);
if (i != stepNum - 1) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove it

return graph().queryNumber(query).longValue();
}

private void filterBySortKeys(Query query, Map<Id, String> labels,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move to super class

Change-Id: I9c14736d0fbbea47fe97ad5f6435c1febe74dce2
@zhoney zhoney merged commit 31c1288 into master May 26, 2020
@zhoney zhoney deleted the algo-count branch May 26, 2020 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants