Copilot commented on code in PR #10719: URL: https://github.com/apache/gravitino/pull/10719#discussion_r3050662641
########## catalogs/catalog-glue/src/main/java/org/apache/gravitino/catalog/glue/GlueCatalogOperations.java: ########## @@ -0,0 +1,64 @@ +/* + * 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.catalog.glue; + +import java.io.IOException; +import java.util.Map; +import org.apache.gravitino.Catalog; +import org.apache.gravitino.NameIdentifier; +import org.apache.gravitino.connector.CatalogInfo; +import org.apache.gravitino.connector.CatalogOperations; +import org.apache.gravitino.connector.HasPropertyMetadata; + +/** + * Operations implementation for the AWS Glue Data Catalog connector. + * + * <p>This is a scaffold stub. Full implementation will be added in PR-02 through PR-06. + * + * <p>TODO PR-04: implement SupportsSchemas (Schema CRUD + exception mapping) + * + * <p>TODO PR-05: implement TableCatalog (Table CRUD + type detection) + */ +public class GlueCatalogOperations implements CatalogOperations { + + // TODO PR-04: add GlueClient field and catalogId + + @Override + public void initialize( + Map<String, String> config, CatalogInfo info, HasPropertyMetadata propertiesMetadata) + throws RuntimeException { + // TODO PR-04: build GlueClient via GlueClientProvider and store catalogId + } + + @Override + public void testConnection( + NameIdentifier catalogIdent, + Catalog.Type type, + String provider, + String comment, + Map<String, String> properties) + throws Exception { + // TODO PR-04: call GlueClient.getDatabases() to verify connectivity + } Review Comment: With the SPI registration in place, this connector can be discoverable/usable at runtime. A no-op `testConnection` will incorrectly report success and can allow misconfigured or non-functional Glue catalogs to pass validation. Prefer failing fast until implemented (e.g., throw `UnsupportedOperationException` from `initialize`/`testConnection`) to avoid false positives and confusing operational behavior. ########## catalogs/catalog-glue/build.gradle.kts: ########## @@ -0,0 +1,100 @@ +/* + * 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. + */ +description = "catalog-glue" + +plugins { + `maven-publish` + id("java") + id("idea") +} + +dependencies { + compileOnly(project(":api")) + compileOnly(project(":common")) + compileOnly(project(":core")) + + compileOnly(libs.lombok) + + implementation(project(":catalogs:catalog-common")) { + exclude("*") + } Review Comment: Using a blanket `exclude(\"*\")` is very broad and makes the runtime classpath fragile: any transitive dependency added to `:catalogs:catalog-common` in the future will be silently dropped for this module, potentially causing runtime `ClassNotFoundException`s that are hard to diagnose. Prefer excluding only the specific transitive modules you know you must avoid (or omit the exclude entirely if not strictly needed). ```suggestion implementation(project(":catalogs:catalog-common")) ``` ########## catalogs/catalog-glue/src/main/java/org/apache/gravitino/catalog/glue/GlueCatalogOperations.java: ########## @@ -0,0 +1,64 @@ +/* + * 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.catalog.glue; + +import java.io.IOException; +import java.util.Map; +import org.apache.gravitino.Catalog; +import org.apache.gravitino.NameIdentifier; +import org.apache.gravitino.connector.CatalogInfo; +import org.apache.gravitino.connector.CatalogOperations; +import org.apache.gravitino.connector.HasPropertyMetadata; + +/** + * Operations implementation for the AWS Glue Data Catalog connector. + * + * <p>This is a scaffold stub. Full implementation will be added in PR-02 through PR-06. + * + * <p>TODO PR-04: implement SupportsSchemas (Schema CRUD + exception mapping) + * + * <p>TODO PR-05: implement TableCatalog (Table CRUD + type detection) + */ +public class GlueCatalogOperations implements CatalogOperations { + + // TODO PR-04: add GlueClient field and catalogId + + @Override + public void initialize( + Map<String, String> config, CatalogInfo info, HasPropertyMetadata propertiesMetadata) + throws RuntimeException { Review Comment: Declaring `throws RuntimeException` on an override is redundant (unchecked exceptions do not need to be declared) and can be misleading about the method's contract. Remove the `throws RuntimeException` clause for clarity. ```suggestion Map<String, String> config, CatalogInfo info, HasPropertyMetadata propertiesMetadata) { ``` ########## catalogs/catalog-glue/src/main/java/org/apache/gravitino/catalog/glue/GlueCatalogOperations.java: ########## @@ -0,0 +1,64 @@ +/* + * 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.catalog.glue; + +import java.io.IOException; +import java.util.Map; +import org.apache.gravitino.Catalog; +import org.apache.gravitino.NameIdentifier; +import org.apache.gravitino.connector.CatalogInfo; +import org.apache.gravitino.connector.CatalogOperations; +import org.apache.gravitino.connector.HasPropertyMetadata; + +/** + * Operations implementation for the AWS Glue Data Catalog connector. + * + * <p>This is a scaffold stub. Full implementation will be added in PR-02 through PR-06. + * + * <p>TODO PR-04: implement SupportsSchemas (Schema CRUD + exception mapping) + * + * <p>TODO PR-05: implement TableCatalog (Table CRUD + type detection) Review Comment: Referencing future PR numbers in source comments tends to become stale quickly and isn’t actionable once PRs are merged/squashed/renumbered. Consider replacing `PR-0x` references with an issue link (e.g., `#10718` or dedicated follow-up issues) or a concise TODO that describes the missing capability without tying it to a PR sequence. ########## catalogs/catalog-glue/src/main/resources/META-INF/services/org.apache.gravitino.CatalogProvider: ########## @@ -0,0 +1 @@ +org.apache.gravitino.catalog.glue.GlueCatalog Review Comment: Java SPI entries must name a concrete implementation of the service interface (`org.apache.gravitino.CatalogProvider`). `GlueCatalog` extends `BaseCatalog` but does not visibly implement `CatalogProvider` in this diff, which can cause a `ServiceConfigurationError` at runtime. Fix by either (a) making `GlueCatalog` implement `CatalogProvider` as required by the SPI contract, or (b) adding a dedicated `GlueCatalogProvider` that implements `CatalogProvider` and listing that class here instead. -- 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]
