-
Notifications
You must be signed in to change notification settings - Fork 504
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
Conversation
implemented: #658 Change-Id: I26e8efb1e8e3547f403dd97e2ddc367df69eae51
2ed9ddb
to
d18ab47
Compare
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
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); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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()); |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also call toString()
@@ -27,27 +27,26 @@ | |||
public final class PageIds { | |||
|
|||
public static final PageIds EMPTY = new PageIds(ImmutableSet.of(), | |||
(String) null); | |||
(PageState) null); |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
implemented: #658
Change-Id: I26e8efb1e8e3547f403dd97e2ddc367df69eae51