-
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
fix query adjacent by filtering conditions with limit #1057
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1057 +/- ##
============================================
+ Coverage 59.92% 69.23% +9.31%
- Complexity 4571 5463 +892
============================================
Files 328 328
Lines 26400 26425 +25
Branches 3773 3777 +4
============================================
+ Hits 15820 18296 +2476
+ Misses 8857 6349 -2508
- Partials 1723 1780 +57 Continue to review full report at Codecov.
|
ci error with non rocksdb/hbase backends:
|
Vertex java = graph.addVertex(T.label, "book", "name", "java-" + i); | ||
james.addEdge("authored", java, "score", i % 2); | ||
james.addEdge("write", java, "time", "2020-6-" + i); | ||
if (i % TX_BATCH == 0) { |
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.
first batch only loop 1 time
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.
not affect logic
|
||
int txCap = this.superNodeSize(); | ||
for (int i = 0; i < txCap; i++) { | ||
Vertex james = graph.addVertex(T.label, "author", "id", 1, |
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.
add duplicate vertex in every loop?
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.
yes, to improve performance to avoid reading every time
vertices = graph.traversal().V(jeff) | ||
.both().has("age", 61) | ||
.limit(1).toList(); | ||
Assert.assertEquals(1, vertices.size()); |
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.
what about limit 0?
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.
0 means none, and -1 means no limit
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.
It's better to add a limit(0) boundary test.
rocksdb order:
rocksdb order:
|
pgsql error:
|
* 0x00 is NULL in UTF8(or ASCII) bytes | ||
* 0xFF is not a valid byte in UTF8 bytes | ||
*/ | ||
assert !Bytes.contains(bytes, STRING_ENDING_BYTE_FF) : |
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.
if not use 0xff at all, prefer delete it and no need to assert
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.
to preserve the byte for future usages
@@ -1066,6 +1045,9 @@ private static ConditionQuery constructQuery(ConditionQuery query, | |||
indexType, indexFields); | |||
Object fieldValue = query.userpropValue(indexFields.get(0)); | |||
assert fieldValue instanceof String; | |||
// Escape empty String to INDEX_EMPTY_SYM |
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.
INDEX_EMPTY_SYM -> INDEX_SYM_EMPTY
@@ -1074,11 +1056,9 @@ private static ConditionQuery constructQuery(ConditionQuery query, | |||
case SECONDARY: | |||
List<Id> joinedKeys = indexFields.subList(0, queryKeys.size()); | |||
String joinedValues = query.userpropValuesString(joinedKeys); | |||
// Escape empty String to INDEX_EMPTY_SYM |
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.
ditto
a54a985
to
a9a371b
Compare
@@ -1189,7 +1195,9 @@ public static boolean matchEdgeSortKeys(ConditionQuery query, | |||
for (int i = sortKeys.size(); i > 0; i--) { | |||
List<Id> subFields = sortKeys.subList(0, i); | |||
if (queryKeys.containsAll(subFields)) { | |||
return true; | |||
if (queryKeys.size() == subFields.size() || !matchAll) { |
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.
add a comment later
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.
done
@@ -124,9 +124,15 @@ public HugeVertexStep(final VertexStep<E> originVertexStep) { | |||
// Query by sort-keys | |||
if (withEdgeCond && edgeLabels.length > 0) { | |||
TraversalUtil.fillConditionQuery(conditions, query, graph); | |||
if (!GraphTransaction.matchEdgeSortKeys(query, graph)) { | |||
if (!GraphTransaction.matchEdgeSortKeys(query, false, graph)) { |
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.
suggest rename to partialMatchEdgeSortKeys
fix #1052 Change-Id: I11075c56e89a57cbf8e599a2e5fa6c0122663f6d
Change-Id: I34de752d7ba8a0eede3d98d29a8a841803f1fc80
Change-Id: Iba776e18809f77f592283e664e93689f53ab8719
Change-Id: I36096d6723e8ddf121abb1684b6f5b93e2698c78
Change-Id: I63f8c56463314fa3a14b565f2619154951948b45
Change-Id: If28ca2dca496821eb36a1fc678b1827b4aa08588
Change-Id: Iba78468738f25f1c0bc40817f56c9597e66d165a
Change-Id: I81bcb8efb41597860416f92f53eb8ca2b769cd5d
Change-Id: I57af518e3dc79b2afe4f82174c130e5a3a9ffc7a
memory ci:
|
fix #1052
Change-Id: I11075c56e89a57cbf8e599a2e5fa6c0122663f6d