yuqi1129 commented on code in PR #12234:
URL: https://github.com/apache/gravitino/pull/12234#discussion_r3683012861
##########
core/src/main/java/org/apache/gravitino/SupportsRelationOperations.java:
##########
@@ -92,6 +94,55 @@ <E extends Entity & HasIdentifier> List<E>
listEntitiesByRelation(
Type relType, NameIdentifier nameIdentifier, Entity.EntityType
identType, boolean allFields)
throws IOException;
+ /**
+ * List the entities according to a given entity in a specific relation,
optionally filtering by
+ * an exact value carried by the relation row.
+ *
+ * @param <E> the type of entities returned.
+ * @param relType The type of relation.
+ * @param nameIdentifier The given entity identifier.
Review Comment:
Is this parameter the name of the from point or the end point? I think you
need to clarify it.
##########
core/src/main/java/org/apache/gravitino/SupportsRelationOperations.java:
##########
@@ -92,6 +94,55 @@ <E extends Entity & HasIdentifier> List<E>
listEntitiesByRelation(
Type relType, NameIdentifier nameIdentifier, Entity.EntityType
identType, boolean allFields)
throws IOException;
+ /**
+ * List the entities according to a given entity in a specific relation,
optionally filtering by
+ * an exact value carried by the relation row.
+ *
+ * @param <E> the type of entities returned.
+ * @param relType The type of relation.
+ * @param nameIdentifier The given entity identifier.
+ * @param identType The entity type of parameter nameIdentifier represents.
+ * @param relationValue The exact relation value to match, or null to return
all relations.
Review Comment:
What's the meaning of the relation value here? More context is needed here.
##########
core/src/main/java/org/apache/gravitino/RelationTarget.java:
##########
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.gravitino;
+
+import com.google.common.base.Preconditions;
+import java.util.Optional;
+import javax.annotation.Nullable;
+
+/**
+ * Represents a target entity in a relation update, with optional metadata
carried by the relation
+ * row.
+ */
+public final class RelationTarget {
Review Comment:
Does this represent the point of edges?
##########
core/src/main/java/org/apache/gravitino/RelationTarget.java:
##########
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.gravitino;
+
+import com.google.common.base.Preconditions;
+import java.util.Optional;
+import javax.annotation.Nullable;
+
+/**
+ * Represents a target entity in a relation update, with optional metadata
carried by the relation
+ * row.
+ */
+public final class RelationTarget {
Review Comment:
I would suggest making `RelationTarget` a subclass of `NameIdentifier` or
extracting an interface to get `NameIdentifier`. Adding a new method in
`SupportsRelationOperations` is not elegant...
--
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]