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 query edges of vertex in page #659

Merged
merged 3 commits into from
Aug 27, 2019
Merged

support query edges of vertex in page #659

merged 3 commits into from
Aug 27, 2019

Conversation

zhoney
Copy link
Contributor

@zhoney zhoney commented Aug 23, 2019

implemented: #658

Change-Id: I26e8efb1e8e3547f403dd97e2ddc367df69eae51

implemented: #658

Change-Id: I26e8efb1e8e3547f403dd97e2ddc367df69eae51
@codecov
Copy link

codecov bot commented Aug 23, 2019

Codecov Report

Merging #659 into master will decrease coverage by 7.64%.
The diff coverage is 83.95%.

Impacted file tree graph

@@             Coverage Diff             @@
##             master    #659      +/-   ##
===========================================
- Coverage     72.35%   64.7%   -7.65%     
+ Complexity     3780    3423     -357     
===========================================
  Files           218     218              
  Lines         17420   17475      +55     
  Branches       2462    2491      +29     
===========================================
- Hits          12604   11307    -1297     
- Misses         3521    4938    +1417     
+ Partials       1295    1230      -65
Impacted Files Coverage Δ Complexity Δ
.../hugegraph/backend/store/BackendEntryIterator.java 61.01% <ø> (ø) 17 <0> (ø) ⬇️
...m/baidu/hugegraph/backend/tx/GraphTransaction.java 82.65% <0%> (+0.05%) 211 <0> (+1) ⬆️
...aidu/hugegraph/backend/page/PageEntryIterator.java 82.5% <100%> (ø) 16 <0> (ø) ⬇️
...va/com/baidu/hugegraph/backend/page/QueryList.java 79.61% <100%> (+0.4%) 17 <0> (ø) ⬇️
...egraph/backend/serializer/BinaryEntryIterator.java 81.13% <100%> (-0.35%) 19 <0> (ø)
...java/com/baidu/hugegraph/backend/page/PageIds.java 100% <100%> (ø) 6 <4> (+1) ⬆️
...va/com/baidu/hugegraph/backend/page/PageState.java 100% <100%> (ø) 13 <3> (+2) ⬆️
...ackend/store/cassandra/CassandraEntryIterator.java 84.44% <100%> (ø) 19 <0> (ø) ⬇️
...egraph/backend/store/mysql/MysqlEntryIterator.java 76.11% <100%> (-0.36%) 16 <4> (ø)
...du/hugegraph/backend/tx/GraphIndexTransaction.java 80.44% <100%> (ø) 178 <0> (ø) ⬇️
... and 61 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 1e01920...85baf51. Read the comment docs.

E.checkState(iterator instanceof Metadatable,
"Invalid paging iterator: %s", iterator.getClass());
Object page = ((Metadatable) iterator).metadata(PAGE);
return (String) page;
E.checkState(page instanceof PageState,
"Invalid pageState '%s'", page);
Copy link
Contributor

Choose a reason for hiding this comment

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

PageState

"Invalid paging iterator: %s", iterator.getClass());
Object page = ((Metadatable) iterator).metadata(PAGE);
E.checkState(page == null || page instanceof PageInfo,
"Invalid pageInfo '%s'", page);
Copy link
Contributor

Choose a reason for hiding this comment

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

PageInfo

"Invalid page out of lower bound");
startId = new BinaryId(position, null);
}
boolean includeStart = paging || range.keyMinEq();
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 line 550: boolean includeStart = range.keyMinEq();
and set includeStart = true at line 552

// There is no latest or no next page
if (this.lastest == null ||
this.fetched() <= this.query.limit() && this.next == null) {
return new PageState(PageState.EMPTY_BYTES, 0, (int) this.count());
Copy link
Contributor

Choose a reason for hiding this comment

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

just set position value

public PageIterator(Iterator<BackendEntry> iterator,
PageState pageState) {
this.iterator = iterator;
this.page = pageState.toString();
Copy link
Contributor

Choose a reason for hiding this comment

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

just update page type to PageState

public Iterator<BackendEntry> iterator() {
return this.iterator;
}

public boolean hasNullPage() {
Copy link
Contributor

Choose a reason for hiding this comment

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

update to hasNextPage

@@ -36,6 +37,11 @@ public PageIds(Set<Id> ids, String page) {
this.page = page;
}

public PageIds(Set<Id> ids, PageState pageState) {
this.ids = ids;
this.page = pageState.toString();
Copy link
Contributor

Choose a reason for hiding this comment

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

update page type to PageState

q.resetUserpropConditions();
}
// Query by sort-keys
ConditionQuery q = query;
Copy link
Contributor

Choose a reason for hiding this comment

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

delete var q

if (withEdgeCond) {
return TraversalUtil.filterResult(conditions, edges);
} else {
return edges;
Copy link
Contributor

Choose a reason for hiding this comment

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

remove else-statement and return edges if not withEdgeCond

return page.toString();
} else if (page instanceof PageState) {
// Traversal without condition like: g.V().has("~page", "")
return ((PageState) page).page();
Copy link
Contributor

Choose a reason for hiding this comment

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

also call toString()

Change-Id: I99d9dcd375cb64037b1ea8217656f99461862613
@@ -27,27 +27,26 @@
public final class PageIds {

public static final PageIds EMPTY = new PageIds(ImmutableSet.of(),
(String) null);
(PageState) null);
Copy link
Contributor

Choose a reason for hiding this comment

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

PageState. EMPTY

Change-Id: I4f6716cba0973f6c933e23aa3d25e0edeb6e4d84
E.checkState(iterator instanceof Metadatable,
"Invalid paging iterator: %s", iterator.getClass());
Object page = ((Metadatable) iterator).metadata(PAGE);
E.checkState(page == null || page instanceof PageInfo,
Copy link
Contributor

Choose a reason for hiding this comment

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

PageInfo won't be null

Copy link
Contributor Author

Choose a reason for hiding this comment

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

null is returned if offset > total for PageInfo

@Linary Linary merged commit b230019 into master Aug 27, 2019
@Linary Linary deleted the edgesOfVertexInPage branch August 27, 2019 03:53
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

3 participants