adutra commented on code in PR #2465:
URL: https://github.com/apache/polaris/pull/2465#discussion_r2315911100


##########
persistence/relational-jdbc/src/main/resources/h2/schema-v2.sql:
##########
@@ -63,6 +63,8 @@ CREATE INDEX IF NOT EXISTS idx_locations ON 
entities(realm_id, catalog_id, locat
 
 -- TODO: create indexes based on all query pattern.
 CREATE INDEX IF NOT EXISTS idx_entities ON entities (realm_id, catalog_id, id);
+CREATE INDEX IF NOT EXISTS idx_entities_lookup
+    ON entities (realm_id, catalog_id, parent_id, type_code, sub_type_code, 
id, name);

Review Comment:
   Why there is no `INCLUDE (id, name)` clause here?



##########
persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/models/EntityNameLookupRecordConverter.java:
##########
@@ -0,0 +1,46 @@
+/*
+ * 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.polaris.persistence.relational.jdbc.models;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.Map;
+import org.apache.polaris.core.entity.EntityNameLookupRecord;
+import org.apache.polaris.persistence.relational.jdbc.DatabaseType;
+
+public class EntityNameLookupRecordConverter implements 
Converter<EntityNameLookupRecord> {
+
+  @Override
+  public EntityNameLookupRecord fromResultSet(ResultSet rs) throws 
SQLException {
+    return new EntityNameLookupRecord(
+        rs.getLong("catalog_id"),
+        rs.getLong("id"),
+        rs.getLong("parent_id"),
+        rs.getString("name"),
+        rs.getInt("type_code"),
+        rs.getInt("sub_type_code"));
+  }
+
+  @Override
+  public Map<String, Object> toMap(DatabaseType databaseType) {

Review Comment:
   The `Converter` interface is a bit strange indeed. The method above is a 
pure converter utility, but this one looks like it's meant to convert the 
object's _internal state_ to some external representation.
   
   This hints at the idea that this interface should be split in two. In 
`ResultSetIterator` for instance, we only need the `fromResultSet` method.



##########
polaris-core/src/main/java/org/apache/polaris/core/entity/HasEntityId.java:
##########
@@ -0,0 +1,37 @@
+/*
+ * 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.polaris.core.entity;
+
+/**
+ * An interface for entity types that have an id. These entities provide a * 
method `getId` and
+ * `getCatalogId` to identify the entity.
+ */
+public interface HasEntityId {

Review Comment:
   nit: how about `Identifiable`?



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

Reply via email to