imbajin commented on code in PR #2864: URL: https://github.com/apache/incubator-hugegraph/pull/2864#discussion_r2313298669
########## 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: Unreachable code after 'if (true)' block should be removed to avoid confusion and maintain code cleanliness. -- 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: issues-unsubscr...@hugegraph.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@hugegraph.apache.org For additional commands, e-mail: issues-h...@hugegraph.apache.org