zyxxoo commented on code in PR #2055:
URL: 
https://github.com/apache/incubator-hugegraph/pull/2055#discussion_r1052082428


##########
hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/TraversalUtil.java:
##########
@@ -105,12 +107,71 @@ public static HugeGraph getGraph(Step<?, ?> step) {
     }
 
     public static HugeGraph tryGetGraph(Step<?, ?> step) {
-        Graph graph = step.getTraversal().getGraph().get();
-        if (graph instanceof HugeGraph) {
-            return (HugeGraph) graph;
+        Optional<Graph> graph = step.getTraversal()
+                                    .getGraph()
+                                    .filter(g -> {
+                                        return !(g instanceof EmptyGraph);
+                                    });
+        if (!graph.isPresent()) {
+            TraversalParent parent = step.getTraversal().getParent();
+            if (parent instanceof Traversal) {
+                Optional<Graph> parentGraph = ((Traversal<?, ?>) parent)
+                                              .asAdmin()
+                                              .getGraph()
+                                              .filter(g -> {
+                                                 return !(g instanceof 
EmptyGraph);
+                                              });
+                if (parentGraph.isPresent()) {
+                    step.getTraversal().setGraph(parentGraph.get());
+                    return (HugeGraph) parentGraph.get();
+                }
+            }
+
+            return null;
         }
-        assert graph == null || graph instanceof EmptyGraph;
-        return null;
+
+        assert graph.get() instanceof HugeGraph;
+        return (HugeGraph) graph.get();
+    }
+
+    public static void trySetGraph(Step<?, ?> step, HugeGraph graph) {

Review Comment:
   ok, I have add TODO
           // TODO: remove these EmptyGraph judgments when upgrading tinkerpop 
to a fixed version
   



##########
hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/ConditionQueryFlatten.java:
##########
@@ -51,6 +51,22 @@ public static List<ConditionQuery> flatten(ConditionQuery 
query) {
     public static List<ConditionQuery> flatten(ConditionQuery query,
                                                boolean supportIn) {
         if (query.isFlattened() && !query.mayHasDupKeys(SPECIAL_KEYS)) {
+            Relations relations = new Relations();
+            List<Condition> noRelations = new ArrayList<>();

Review Comment:
   there are two type, the one is relation, and other, so maybe relation  name 
is more suitable.
   



##########
hugegraph-core/src/main/java/org/apache/hugegraph/StandardHugeGraph.java:
##########
@@ -193,7 +193,8 @@ public StandardHugeGraph(HugeConfig config) {
 
         this.taskManager = TaskManager.instance();
 
-        this.features = new HugeFeatures(this, true);
+        boolean supportsPersistence = 
!"memory".equals(config.get(CoreOptions.BACKEND));

Review Comment:
   InMemoryDBStore.BackendFeatures don't init, so we can't use it



-- 
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: dev-unsubscr...@hugegraph.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to