yuqi1129 commented on code in PR #4055:
URL: https://github.com/apache/gravitino/pull/4055#discussion_r1771215174


##########
core/src/main/java/org/apache/gravitino/EntityStore.java:
##########
@@ -55,15 +57,40 @@ public interface EntityStore extends Closeable {
    * <p>Note. Depends on the isolation levels provided by the underlying 
storage, the returned list
    * may not be consistent.
    *
-   * @param namespace the namespace of the entities
    * @param <E> class of the entity
+   * @param namespace the namespace of the entities
    * @param type the detailed type of the entity
    * @param entityType the general type of the entity
+   * @return the list of entities
    * @throws IOException if the list operation fails
+   */
+  default <E extends Entity & HasIdentifier> List<E> list(
+      Namespace namespace, Class<E> type, EntityType entityType) throws 
IOException {
+    return list(namespace, type, entityType, Collections.emptySet());
+  }
+
+  /**
+   * List all the entities with the specified {@link 
org.apache.gravitino.Namespace}, and
+   * deserialize them into the specified {@link Entity} object.
+   *
+   * <p>Note. Depends on the isolation levels provided by the underlying 
storage, the returned list
+   * may not be consistent.
+   *
+   * @param <E> class of the entity
+   * @param namespace the namespace of the entities
+   * @param type the detailed type of the entity
+   * @param entityType the general type of the entity
+   * @param skippingFields Some fields may have a relatively high acquisition 
cost, EntityStore
+   *     provide an optional setting to avoid fetching these high-cost fields 
to improve the

Review Comment:
   provides



##########
core/src/main/java/org/apache/gravitino/storage/relational/service/SupportsSkippingFieldsHandlers.java:
##########
@@ -0,0 +1,49 @@
+/*
+ * 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.storage.relational.service;
+
+import com.google.common.collect.Lists;
+import java.util.List;
+import java.util.Set;
+import org.apache.gravitino.Field;
+
+/**
+ * This class is the collection wrapper of SupportsSkippingFields handler. The 
class will contains

Review Comment:
   contains-> contain



##########
core/src/main/java/org/apache/gravitino/storage/relational/service/SupportsSkippingFieldsHandlers.java:
##########
@@ -0,0 +1,49 @@
+/*
+ * 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.storage.relational.service;
+
+import com.google.common.collect.Lists;
+import java.util.List;
+import java.util.Set;
+import org.apache.gravitino.Field;
+
+/**
+ * This class is the collection wrapper of SupportsSkippingFields handler. The 
class will contains
+ * all the handlers can proceed the data. We can choose different handlers 
according to the skipping
+ * fields to acquire better performance.
+ *
+ * @param <T> The value type which the handler will return.
+ */
+class SupportsSkippingFieldsHandlers<T> {
+  private final List<SupportsSkippingFields<T>> methods = Lists.newArrayList();
+
+  // We should put the low-cost handler into the front of the list.
+  void addHandler(SupportsSkippingFields<T> supportsSkippingFields) {
+    methods.add(supportsSkippingFields);
+  }
+
+  T execute(Set<Field> skippingFields) {
+    for (SupportsSkippingFields<T> method : methods) {
+      if (skippingFields.containsAll(method.supportsSkippingFields())) {
+        return method.execute();
+      }
+    }
+    throw new IllegalArgumentException("Don't support skip fields");

Review Comment:
   I believe we should not throw exceptions even if there are no candidates for 
skipping the field,  fetching all fields is also logical.



##########
core/src/main/java/org/apache/gravitino/storage/relational/service/SupportsSkippingFields.java:
##########
@@ -0,0 +1,40 @@
+/*
+ * 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.storage.relational.service;
+
+import java.util.List;
+import org.apache.gravitino.Field;
+
+/** The handler supports to skip fields. */
+interface SupportsSkippingFields<R> {
+
+  /**
+   * The fields which could be skipped.
+   *
+   * @return The fields which could be skipped.
+   */
+  List<Field> supportsSkippingFields();

Review Comment:
   supportsSkippingFields -> allSkppingFields or totalSkipFields.



-- 
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: commits-unsubscr...@gravitino.apache.org

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

Reply via email to