Copilot commented on code in PR #2864:
URL: 
https://github.com/apache/incubator-hugegraph/pull/2864#discussion_r2313285798


##########
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java:
##########
@@ -1291,62 +1292,24 @@ public <V> void removeEdgeProperty(HugeEdgeProperty<V> 
prop) {
     @Watched
     public static ConditionQuery constructEdgesQuery(Id sourceVertex,
                                                      Directions direction,
-                                                     Id... edgeLabels) {
-        return constructEdgesQuery(sourceVertex, direction, 
List.of(edgeLabels));
+                                                     List<Id> edgeLabels) {
+        return constructEdgesQuery(sourceVertex, direction,
+                                   edgeLabels.toArray(new Id[0]));
     }
 
     @Watched
     public static ConditionQuery constructEdgesQuery(Id sourceVertex,
                                                      Directions direction,
-                                                     EdgeLabel... edgeLabels) {
+                                                     Id... edgeLabels) {
         E.checkState(sourceVertex != null,
                      "The edge query must contain source vertex");
         E.checkState(direction != null,
                      "The edge query must contain direction");
 
-        ConditionQuery query = new ConditionQuery(HugeType.EDGE);
-
-        // Edge source vertex
-        query.eq(HugeKeys.OWNER_VERTEX, sourceVertex);
-
-        // Edge direction
-        if (direction == Directions.BOTH) {
-            query.query(Condition.or(
-                    Condition.eq(HugeKeys.DIRECTION, Directions.OUT),
-                    Condition.eq(HugeKeys.DIRECTION, Directions.IN)));
-        } else {
-            assert direction == Directions.OUT || direction == Directions.IN;
-            query.eq(HugeKeys.DIRECTION, direction);
-        }
-
-        // Edge labels
-        if (edgeLabels.length == 1) {
-            EdgeLabel edgeLabel = edgeLabels[0];
-            if (edgeLabel.hasFather()) {
-                query.eq(HugeKeys.LABEL, edgeLabel.fatherId());
-                query.eq(HugeKeys.SUB_LABEL, edgeLabel.id());
-            } else {
-                query.eq(HugeKeys.LABEL, edgeLabel.id());
-            }
-        } else if (edgeLabels.length >= 1) {
-            query.query(
-                    Condition.in(HugeKeys.LABEL,
-                                 Arrays.stream(edgeLabels)
-                                       .map(SchemaElement::id)
-                                       .collect(Collectors.toList())));
+        if (true) {
+            return new AdjacentEdgesQuery(sourceVertex, direction, edgeLabels);
         }

Review Comment:
   The hardcoded `if (true)` condition is unclear and should be replaced with a 
meaningful condition or removed entirely if the new AdjacentEdgesQuery should 
always be used.



##########
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/ConditionQuery.java:
##########
@@ -456,12 +461,16 @@ public List<Relation> userpropRelations() {
     }
 
     public void resetUserpropConditions() {
+        if (this.conditions.isEmpty()) {
+            // UnsupprotedOperationException when ImmutableList.removeIf()

Review Comment:
   There's a typo in the comment: 'UnsupprotedOperationException' should be 
'UnsupportedOperationException'.
   ```suggestion
               // UnsupportedOperationException when ImmutableList.removeIf()
   ```



-- 
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]

Reply via email to