Copilot commented on code in PR #9962:
URL: https://github.com/apache/gravitino/pull/9962#discussion_r2792467212
##########
integration-test-common/docker-script/init/trino/config/jvm.config:
##########
@@ -31,5 +31,7 @@
# Reduce starvation of threads by GClocker, recommend to set about the number
of cpu cores (JDK-8192647)
-XX:+UnlockDiagnosticVMOptions
-XX:GCLockerRetryAllocationCount=32
+# Required for Trino 452+ due to JDK-8329528
+-XX:G1NumCollectionsKeepPinned=10000000
Review Comment:
This JVM flag is marked as required for Trino 452+, but the same jvm.config
is copied for every Trino version (init.sh always copies it). If users/CI run
older Trino images via TRINO_VERSION, an unrecognized -XX option can prevent
the container from starting. Consider making this conditional on TRINO_VERSION
(e.g., generate jvm.config in init.sh) or documenting/enforcing a minimum
Trino/JDK version for these docker scripts.
##########
integration-test-common/src/test/java/org/apache/gravitino/integration/test/container/TrinoITContainers.java:
##########
@@ -73,9 +71,11 @@ public void launch(
env.put("TRINO_VERSION", String.valueOf(trinoVersion));
}
if (trinoConnectorDir != null) {
- Path path = Paths.get(trinoConnectorDir);
- if (!Files.exists(path)) {
- throw new Exception("Provided GRAVITINO_TRINO_CONNECTOR_DIR '" + path
+ "' does not exist");
+ File dir = new File(trinoConnectorDir);
+ if (!dir.exists() || dir.list().length == 0) {
+ throw new Exception(
+ "Gravitino trino connector directory %s is not exist or empty"
Review Comment:
Grammar in the exception message: replace "is not exist" with "does not
exist" (and consider "does not exist or is empty").
```suggestion
"Gravitino trino connector directory %s does not exist or is
empty"
```
##########
trino-connector/trino-connector-452-468/src/test/java/TestGravitinoConnector452.java:
##########
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ */
+
+import static io.trino.testing.TestingSession.testSessionBuilder;
+
+import io.trino.Session;
+import io.trino.testing.DistributedQueryRunner;
+import org.apache.gravitino.client.GravitinoAdminClient;
+import org.apache.gravitino.trino.connector.GravitinoPlugin;
+import org.apache.gravitino.trino.connector.GravitinoPlugin452;
+import org.apache.gravitino.trino.connector.TestGravitinoConnector;
+import
org.apache.gravitino.trino.connector.TestGravitinoConnectorWithMetalakeCatalogName;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Nested;
+
+public class TestGravitinoConnector452 {
+ @Nested
+ class SingleMetalake extends TestGravitinoConnector {
+ @Override
+ protected GravitinoPlugin createGravitinoPlugin(GravitinoAdminClient
client) {
+ return new GravitinoPlugin452(client);
+ }
+
+ @Override
+ protected DistributedQueryRunner createTrinoQueryRunner() throws Exception
{
+ Session session = testSessionBuilder().setCatalog("gravitino").build();
+ return DistributedQueryRunner.builder(session).setWorkerCount(1).build();
+ }
+ }
+
+ @Nested
+ @Disabled
+ class MultiMetalake extends TestGravitinoConnectorWithMetalakeCatalogName {
+ @Override
+ protected GravitinoPlugin createGravitinoPlugin(GravitinoAdminClient
client) {
+ return new GravitinoPlugin452(client);
+ }
Review Comment:
This nested test class is disabled, so multi-metalake behavior isn’t
exercised for the 452-468 segment. If multi-metalake is expected to work for
this Trino range, please remove @Disabled (or at least add a reason and a
tracked issue) so regressions are caught in CI.
##########
.github/workflows/python-integration-test.yml:
##########
@@ -77,7 +77,7 @@ jobs:
run: |
./gradlew compileDistribution -x test
- for pythonVersion in "3.9" "3.10" "3.11" "3.12"
+ for pythonVersion in "3.10" "3.11" "3.12"
Review Comment:
The Python client still declares python_requires ">=3.9" and includes a 3.9
classifier, but this workflow no longer tests Python 3.9. Either keep 3.9 in
the CI matrix or update the client’s declared supported versions/docs to match
the new minimum.
##########
trino-connector/integration-test/src/test/java/org/apache/gravitino/trino/connector/integration/test/TrinoQueryIT.java:
##########
@@ -338,6 +338,7 @@ public void testSql() throws Exception {
String[] testSetNames =
Arrays.stream(TrinoQueryITBase.listDirectory(testsetsDir))
+ .filter(s -> new java.io.File(ITUtils.joinPath(testsetsDir,
s)).isDirectory())
Review Comment:
Avoid using a fully-qualified class name inside the lambda; import
java.io.File (or use Path/Files) and reference File directly to match the
project’s Java import conventions.
##########
trino-connector/trino-connector-452-468/src/main/java/org/apache/gravitino/trino/connector/GravitinoConnectorFactory452.java:
##########
@@ -0,0 +1,62 @@
+/*
+ * 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;
+
+import org.apache.gravitino.client.GravitinoAdminClient;
+import org.apache.gravitino.trino.connector.catalog.CatalogConnectorContext;
+import org.apache.gravitino.trino.connector.system.GravitinoSystemConnector;
+import
org.apache.gravitino.trino.connector.system.storedprocedure.GravitinoStoredProcedureFactory;
+
+public class GravitinoConnectorFactory452 extends GravitinoConnectorFactory {
+
+ public GravitinoConnectorFactory452(GravitinoAdminClient client) {
+ super(client);
+ }
+
+ @Override
+ protected int getMinSupportTrinoSpiVersion() {
+ return 452;
+ }
+
+ @Override
+ protected int getMaxSupportTrinoSpiVersion() {
+ return 468;
+ }
+
+ @Override
+ protected String getTrinoCatalogName(String metalake, String catalog) {
+ return "\"" + metalake + "." + catalog + "\"";
+ }
+
+ @Override
+ protected boolean supportCatalogNameWithMetalake() {
+ return false;
Review Comment:
supportCatalogNameWithMetalake() returning false will make connector
initialization fail whenever singleMetalakeMode is disabled
(GravitinoConnectorFactory.checkTrinoSpiVersion throws). This effectively
disables multi-metalake mode for Trino 452-468; if that’s not intended, return
true (consistent with other version segments) and rely on getTrinoCatalogName()
to format the quoted "metalake.catalog" name.
```suggestion
return true;
```
##########
integration-test-common/src/test/java/org/apache/gravitino/integration/test/container/TrinoITContainers.java:
##########
@@ -73,9 +71,11 @@ public void launch(
env.put("TRINO_VERSION", String.valueOf(trinoVersion));
}
if (trinoConnectorDir != null) {
- Path path = Paths.get(trinoConnectorDir);
- if (!Files.exists(path)) {
- throw new Exception("Provided GRAVITINO_TRINO_CONNECTOR_DIR '" + path
+ "' does not exist");
+ File dir = new File(trinoConnectorDir);
+ if (!dir.exists() || dir.list().length == 0) {
+ throw new Exception(
Review Comment:
dir.list() can return null (e.g., when the path exists but isn’t a
directory, or on I/O error), so dir.list().length can throw NPE here. Please
also validate dir.isDirectory() and handle a null return from list() before
checking emptiness.
--
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]