-
Notifications
You must be signed in to change notification settings - Fork 521
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
feat: improve index hits #2314
feat: improve index hits #2314
Conversation
EdgeCoreTest.java与VertexCoreTest.java是部分索引的例子!
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.
Thank you very much for your PR.
Could you briefly describe the feature intent and design framework?
|
||
public MatchedIndex(SchemaLabel schemaLabel, | ||
Set<IndexLabel> indexLabels) { | ||
this.schemaLabel = schemaLabel; | ||
//this.schemaLabels = new HashSet<>(); |
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 it?
for (ConditionQuery cq : ConditionQueryFlatten.flatten( | ||
(ConditionQuery) query, supportIn)) { | ||
for (ConditionQuery cq: ConditionQueryFlatten.flatten( | ||
(ConditionQuery) query, supportIn)) { |
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.
prefer to keep the old style
@@ -1405,13 +1407,127 @@ private <R> QueryList<R> optimizeQueries(Query query, | |||
* 2.index-query result(ids after optimization), which may be empty. | |||
*/ | |||
if (q == null) { | |||
queries.add(this.indexQuery(cq), this.batchSize); | |||
boolean sys = cq.syspropConditions().size() != 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.
sysprop?
@@ -133,7 +133,7 @@ public Number queryNumber(Query query) { | |||
} | |||
|
|||
@Watched(prefix = "tx") | |||
public QueryResults<BackendEntry> query(Query query) { | |||
protected QueryResults<BackendEntry> query(Query 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.
not sure why need to mark protected
} | ||
// Method to reorder conditions | ||
private void excludeOnlyLabelQuery(ConditionQuery cq, QueryList queries) { | ||
// 判断是否命中索引 |
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.
can we translate all Chinese comments?
.collect(Collectors.toSet()); | ||
|
||
Id label = rawQuery.condition(HugeKeys.LABEL); | ||
if (label == 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.
prefer return if (label != null)
前辈好 我是#2314
目前好像很多测试都没有通过,我毕竟就修改170+行,为啥这么多测试都通过不了啊!
然后实现的思路大概是:首先需要判断是否命中索引,如果部分命中索引就创建 更加宽泛的条件查询语句,后面再用过滤操作来筛选出来最后结果!
…------------------ 原始邮件 ------------------
发件人: "apache/incubator-hugegraph" ***@***.***>;
发送时间: 2023年10月1日(星期天) 凌晨3:57
***@***.***>;
***@***.******@***.***>;
主题: Re: [apache/incubator-hugegraph] 修改了上面的几个文件,来实现部分索引命中! (PR #2314)
@javeme commented on this pull request.
Thank you very much for your PR.
Could you briefly describe the feature intent and design framework?
In hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphIndexTransaction.java:
> public MatchedIndex(SchemaLabel schemaLabel, Set<IndexLabel> indexLabels) { - this.schemaLabel = schemaLabel; + //this.schemaLabels = new HashSet<>();
remove it?
In hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java:
> @@ -1395,8 +1397,8 @@ private <R> QueryList<R> optimizeQueries(Query query, } boolean supportIn = this.storeFeatures().supportsQueryWithInCondition(); - for (ConditionQuery cq : ConditionQueryFlatten.flatten( - (ConditionQuery) query, supportIn)) { + for (ConditionQuery cq: ConditionQueryFlatten.flatten( + (ConditionQuery) query, supportIn)) {
prefer to keep the old style
In hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java:
> @@ -1405,13 +1407,127 @@ private <R> QueryList<R> optimizeQueries(Query query, * 2.index-query result(ids after optimization), which may be empty. */ if (q == null) { - queries.add(this.indexQuery(cq), this.batchSize); + boolean sys = cq.syspropConditions().size() != 0;
sysprop?
In hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/AbstractTransaction.java:
> @@ -133,7 +133,7 @@ public Number queryNumber(Query query) { } @watched(prefix = "tx") - public QueryResults<BackendEntry> query(Query query) { + protected QueryResults<BackendEntry> query(Query query) {
not sure why need to mark protected
In hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java:
> } else if (!q.empty()) { queries.add(q); } } return queries; } + private boolean hasOlapCondition(ConditionQuery query) { + for (Id pk : query.userpropKeys()) { + if(this.graph().propertyKey(pk).olap()) { + return true; + } + } + + return false; + } + // Method to reorder conditions + private void excludeOnlyLabelQuery(ConditionQuery cq, QueryList queries) { + // 判断是否命中索引
can we translate all Chinese comments?
In hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java:
> + + // 如果条件查询中包含olap相关属性查询,暂不做补充查询 + if(this.hasOlapCondition(rawQuery)) { + return queries; + } + + Collection<VertexLabel> vertexLabels = this.graph().vertexLabels(); + Collection<EdgeLabel> edgeLabels = this.graph().edgeLabels(); + + Set<SchemaLabel> matchedLabels = + matchedIndices.stream() + .flatMap(matchedIndex -> matchedIndex.schemaLabels().stream()) + .collect(Collectors.toSet()); + + Id label = rawQuery.condition(HugeKeys.LABEL); + if (label == null) {
prefer return if (label != null)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
hi @zpw-123 , is it still in progress? |
是的
…---Original---
From: "Simon ***@***.***>
Date: Fri, Oct 27, 2023 09:51 AM
To: ***@***.***>;
Cc: ***@***.******@***.***>;
Subject: Re: [apache/incubator-hugegraph] feat: improve index hits (PR #2314)
hi @zpw-123 , is it still in progress?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Due to the lack of activity, the current pr is marked as stale and will be closed after 180 days, any update will remove the stale label |
Due to the lack of activity, the current pr is marked as stale and will be closed after 180 days, any update will remove the stale label |
EdgeCoreTest.java与VertexCoreTest.java是部分索引的例子!
Purpose of the PR
Main Changes
Verifying these changes
Does this PR potentially affect the following parts?
Documentation Status
Doc - TODO
Doc - Done
Doc - No Need