Copilot commented on code in PR #11264:
URL: https://github.com/apache/gravitino/pull/11264#discussion_r3311113108


##########
core/src/main/java/org/apache/gravitino/credential/JdbcCredentialProvider.java:
##########
@@ -53,7 +53,7 @@ public String credentialType() {
   @Nullable
   @Override
   public Credential getCredential(CredentialContext context) {
-    if (StringUtils.isBlank(jdbcUser) || StringUtils.isBlank(jdbcPassword)) {
+    if (StringUtils.isBlank(jdbcUser) || jdbcPassword == null) {

Review Comment:
   Allowing empty-string passwords here is inconsistent with `JdbcCredential` 
itself. `JdbcCredential.validate()` 
(api/src/main/java/org/apache/gravitino/credential/JdbcCredential.java:108-114) 
still requires `StringUtils.isNotBlank(jdbcPassword)`, so when this provider 
proceeds with an empty `jdbcPassword`, the next line `new 
JdbcCredential(jdbcUser, jdbcPassword)` will throw 
`IllegalArgumentException("JDBC password should not be empty")`. This makes the 
new StarRocks empty-password code path fail at runtime (and 
`CatalogStarRocksCredentialIT.testGetJdbcCredentialFromCatalog` would fail). 
The same `validate()` is also invoked from `initialize()`, so credentials 
reconstructed on the client side would also throw. To actually support empty 
passwords (StarRocks default), `JdbcCredential.validate()` needs to be relaxed 
to accept non-null empty passwords (and the corresponding existing tests 
`testEmptyPasswordReturnsEmptyOptional` / 
`testJdbcCredentialConstructorBlankPasswordThrows` updat
 ed).
   



##########
trino-connector/trino-connector/src/test/java/org/apache/gravitino/trino/connector/catalog/jdbc/postgresql/TestPostgreSQLConnectorAdapter.java:
##########
@@ -0,0 +1,67 @@
+/*
+ * 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.trino.connector.catalog.jdbc.postgresql;
+
+import java.util.Collections;
+import java.util.Map;
+import org.apache.gravitino.credential.Credential;
+import org.apache.gravitino.credential.JdbcCredential;
+import 
org.apache.gravitino.trino.connector.catalog.jdbc.JDBCCatalogPropertyConverter;
+import org.apache.gravitino.trino.connector.metadata.GravitinoCatalog;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+/** Unit tests for {@link 
PostgreSQLConnectorAdapter#buildInternalConnectorConfig}. */
+public class TestPostgreSQLConnectorAdapter {

Review Comment:
   The PR description mentions extending credential vending to PostgreSQL, 
Doris, and StarRocks JDBC catalogs, but the Trino connector changes only cover 
PostgreSQL. There is no Trino adapter registration or `applyJdbcCredential` 
integration for `jdbc-doris` or `jdbc-starrocks` in 
`DefaultCatalogConnectorFactory`, so Trino users of Doris/StarRocks catalogs 
will not see vended JDBC credentials and will continue to need credentials 
embedded in catalog properties. Either add Trino adapters for Doris/StarRocks 
(matching the new PostgreSQL adapter pattern) or explicitly note this 
limitation in the PR description / docs.



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