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
Hugegraph如何构造query #2415
Comments
🤖 你好 @SkrDrag, 我是Dosu,一个可以帮助你解决问题、回答疑问并成为贡献者的机器人。虽然我是机器人,但我在等待人类维护者的同时,会尽力帮助你。很高兴为你服务! HugeGraph在 @Override
public QueryResults<BackendEntry> query(Query query) {
if (!(query instanceof ConditionQuery)) {
// It's a sysprop-query, don't need to optimize
LOG.debug("Query{final:{}}", query);
return super.query(query);
}
QueryList<BackendEntry> queries = this.optimizeQueries(query, super::query);
LOG.debug("{}", queries);
return queries.empty() ? QueryResults.empty() :
queries.fetch(this.pageSize);
} 在这个方法中,如果查询不是 实际查询后端数据库是在 protected Iterator<HugeVertex> queryVerticesFromBackend(Query query) {
assert query.resultType().isVertex();
QueryResults<BackendEntry> results = this.query(query);
Iterator<BackendEntry> entries = results.iterator();
Iterator<HugeVertex> vertices = new MapperIterator<>(entries, this::parseEntry);
vertices = this.filterExpiredResultFromBackend(query, vertices);
if (!this.store().features().supportsQuerySortByInputIds()) {
// There is no id in BackendEntry, so sort after deserialization
vertices = results.keepInputOrderIfNeeded(vertices);
}
return vertices;
} 在这个方法中,它调用 请注意,与后端数据库交互的 关于 在提供的上下文中,
例如, 关于 具体的步骤如下:
这是相关的代码: private <R> QueryList<R> optimizeQueries(Query query,
QueryResults.Fetcher<R> fetcher) {
QueryList<R> queries = new QueryList<>(query, fetcher);
if (!(query instanceof ConditionQuery)) {
// It's a sysprop-query, add itself as subquery, don't need to flatten
queries.add(query);
return queries;
}
boolean supportIn = this.storeFeatures().supportsQueryWithInCondition();
for (ConditionQuery cq : ConditionQueryFlatten.flatten(
(ConditionQuery) query, supportIn)) {
// Optimize by sysprop
Query q = this.optimizeQuery(cq);
/*
* NOTE: There are two possibilities for the returned q:
* 1.sysprop-query, which would not be empty.
* 2.index-query result(ids after optimization), which may be empty.
*/
if (q == null) {
queries.add(this.indexQuery(cq), this.batchSize);
} else if (!q.empty()) {
queries.add(q);
}
}
return queries;
} 以上信息来自于: SourcesThis response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. |
Hugegraph有考虑数据动态更新的场景吗。还是说Hugegraph处理的基本是静态图 |
🤖
Sources
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. |
Feature Description (功能描述)
以后端数据库为Mysql为例。Hugegraph是如何构造query对象去查询后端数据库的?
The text was updated successfully, but these errors were encountered: