contrueCT commented on code in PR #3243:
URL: https://github.com/apache/hugegraph/pull/3243#discussion_r4121464980
##########
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphIndexTransaction.java:
##########
@@ -805,9 +814,49 @@ private Set<MatchedIndex>
collectMatchedIndexes(ConditionQuery query) {
matchedIndexes.add(index);
}
}
+ if (requireCompleteCoverage && !matchedIndexes.isEmpty()) {
+ this.checkIndexCoverage(query, schemaLabels, matchedIndexes);
+ }
return matchedIndexes;
}
+ private void checkIndexCoverage(ConditionQuery query,
+ List<? extends SchemaLabel> labels,
+ Set<MatchedIndex> indexes) {
+ // Check at execution, before creating any lazy index iterator. Cleanup
+ // callers only need matching indexes and must not require full
coverage.
+ Set<Id> requiredProperties = query.userpropKeys();
+ if (this.graph().readMode().showOlap()) {
+ // OLAP properties are shared rather than declared on every label.
+ requiredProperties.removeIf(id ->
this.graph().propertyKey(id).olap());
Review Comment:
Fixed in `f435a1f5`. When `GraphReadMode.ALL` leaves no non-OLAP property
keys, the matched shared OLAP index is still required, but per-label coverage
is not checked. Added `SourceIndexCoverageTest.testOlapOnlyQueryAcrossLabels`:
it failed with `NoIndexException` at `ae90ad2` and passes on RocksDB after the
fix. The HStore variant is skipped for the existing backend limitation: the
unmodified master's `VertexCoreTest.testAddOlapSecondaryProperties` also
returns zero instead of one on HStore (tracked by #3090). Commands and exact
results are in the
[Gist](https://gist.github.com/contrueCT/669821a6ac6fc5a4d3adf6df6f74a342#file-source-index-coverage-md).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]