You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hugegraph.apache.org by je...@apache.org on 2023/01/02 16:30:40 UTC
[incubator-hugegraph] 01/01: fix: check uncommit due gremlin partition test silently fails
This is an automated email from the ASF dual-hosted git repository.
jermy pushed a commit to branch partition-test-check
in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph.git
commit abf7c6e579da3eed5aae9a0817d77a8c019edfc8
Author: Jermy Li <je...@apache.org>
AuthorDate: Tue Jan 3 00:28:02 2023 +0800
fix: check uncommit due gremlin partition test silently fails
Change-Id: Icdecb9a2c4c3c9f3ee678f63a192e22093f3f9ff
---
.../java/org/apache/hugegraph/backend/tx/GraphTransaction.java | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java b/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java
index 3300d3777..4cf3ea108 100644
--- a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java
+++ b/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java
@@ -542,12 +542,19 @@ public class GraphTransaction extends IndexableTransaction {
@Override
public Number queryNumber(Query query) {
+ boolean isConditionQuery = query instanceof ConditionQuery;
boolean hasUpdate = this.hasUpdate();
Aggregate aggregate = query.aggregateNotNull();
+ // TODO: we can concat index-query results and tx uncommitted records.
+ if (hasUpdate) {
+ E.checkArgument(!isConditionQuery,
+ "It's not allowed to query by index when " +
+ "there are uncommitted records.");
+ }
+
QueryList<Number> queries = this.optimizeQueries(query, q -> {
boolean isIndexQuery = q instanceof IdQuery;
- boolean isConditionQuery = query instanceof ConditionQuery;
assert isIndexQuery || isConditionQuery || q == query;
// Need to fallback if there are uncommitted records
boolean fallback = hasUpdate;