diff --git a/integration-test/build.gradle.kts b/integration-test/build.gradle.kts index a4d8a04ed42..15c766a20ef 100644 --- a/integration-test/build.gradle.kts +++ b/integration-test/build.gradle.kts @@ -268,27 +268,28 @@ tasks.test { if (skipITs) { exclude("**/integration/test/**") } else { - // Get current project version - val version = project.version.toString() - println("Current project version: $version") - // Check whether this module has already built - val buildDir = project.buildDir - if (!buildDir.exists()) { - dependsOn(":trino-connector:jar") - } else { - // Check the version gravitino related jars in build equal to the current project version - val gravitinoJars = buildDir.resolve("libs").listFiles { _, name -> name.startsWith("gravitino") }?.filter { - val jarVersion = name.substringAfterLast("-").substringBeforeLast(".") - jarVersion != version - } + doFirst { + // Get current project version + val version = project.version.toString() + println("Current project version: $version") + + // Check whether this module has already built + val trinoConnectorBuildDir = project(":trino-connector").buildDir + if (trinoConnectorBuildDir.exists()) { + // Check the version gravitino related jars in build equal to the current project version + val invalidGravitinoJars = trinoConnectorBuildDir.resolve("libs").listFiles { _, name -> name.startsWith("gravitino") }?.filter { + val name = it.name + !name.endsWith(version + ".jar") + } - if (gravitinoJars != null && gravitinoJars.isNotEmpty()) { - delete(project(":trino-connector").buildDir) - dependsOn(":trino-connector:jar") + if (invalidGravitinoJars!!.isNotEmpty()) { + val message = "Found mismatched versions of gravitino jars in trino-connector/build/libs:\n" + + "${invalidGravitinoJars.joinToString(", ") { it.name }}\n" + + "The current version of the project is $version. Please clean the project and rebuild it." + throw GradleException(message) + } } - } - doFirst { printDockerCheckInfo() copy { diff --git a/trino-connector/build.gradle.kts b/trino-connector/build.gradle.kts index aa7fe341bec..747de13b37b 100644 --- a/trino-connector/build.gradle.kts +++ b/trino-connector/build.gradle.kts @@ -21,10 +21,7 @@ dependencies { implementation(libs.jackson.annotations) implementation(libs.jackson.databind) implementation(libs.commons.collections4) - implementation(libs.trino.spi) { - exclude("org.apache.logging.log4j") - } - implementation(libs.trino.toolkit) { + compileOnly(libs.trino.spi) { exclude("org.apache.logging.log4j") } testImplementation(libs.mockito.core) diff --git a/trino-connector/src/main/java/com/datastrato/gravitino/trino/connector/GravitinoConnector.java b/trino-connector/src/main/java/com/datastrato/gravitino/trino/connector/GravitinoConnector.java index 530dcf4cdeb..b7606aa13b1 100644 --- a/trino-connector/src/main/java/com/datastrato/gravitino/trino/connector/GravitinoConnector.java +++ b/trino-connector/src/main/java/com/datastrato/gravitino/trino/connector/GravitinoConnector.java @@ -9,7 +9,6 @@ import com.datastrato.gravitino.trino.connector.catalog.CatalogConnectorContext; import com.datastrato.gravitino.trino.connector.catalog.CatalogConnectorMetadata; import com.google.common.base.Preconditions; -import io.trino.plugin.base.security.AllowAllAccessControl; import io.trino.spi.connector.Connector; import io.trino.spi.connector.ConnectorAccessControl; import io.trino.spi.connector.ConnectorCapabilities; @@ -134,7 +133,8 @@ public void commit(ConnectorTransactionHandle transactionHandle) { @Override public ConnectorAccessControl getAccessControl() { - return new AllowAllAccessControl(); + Connector internalConnector = catalogConnectorContext.getInternalConnector(); + return internalConnector.getAccessControl(); } @Override diff --git a/trino-connector/src/main/java/com/datastrato/gravitino/trino/connector/GravitinoMetadata.java b/trino-connector/src/main/java/com/datastrato/gravitino/trino/connector/GravitinoMetadata.java index 7697aef1ddf..a576223eee5 100644 --- a/trino-connector/src/main/java/com/datastrato/gravitino/trino/connector/GravitinoMetadata.java +++ b/trino-connector/src/main/java/com/datastrato/gravitino/trino/connector/GravitinoMetadata.java @@ -168,13 +168,8 @@ public ColumnMetadata getColumnMetadata( } GravitinoTableHandle gravitinoTableHandle = (GravitinoTableHandle) tableHandle; - GravitinoTable table = - catalogConnectorMetadata.getTable( - gravitinoTableHandle.getSchemaName(), gravitinoTableHandle.getTableName()); - - String columnName = getColumnName(session, gravitinoTableHandle, columnHandle); - GravitinoColumn column = table.getColumn(columnName); - return metadataAdapter.getColumnMetadata(column); + return internalMetadata.getColumnMetadata( + session, gravitinoTableHandle.getInternalTableHandle(), columnHandle); } @Override diff --git a/trino-connector/src/main/java/com/datastrato/gravitino/trino/connector/catalog/hive/HiveConnectorAdapter.java b/trino-connector/src/main/java/com/datastrato/gravitino/trino/connector/catalog/hive/HiveConnectorAdapter.java index 28cc2762088..3cad004b6c6 100644 --- a/trino-connector/src/main/java/com/datastrato/gravitino/trino/connector/catalog/hive/HiveConnectorAdapter.java +++ b/trino-connector/src/main/java/com/datastrato/gravitino/trino/connector/catalog/hive/HiveConnectorAdapter.java @@ -41,6 +41,7 @@ public Map buildInternalConnectorConfig(GravitinoCatalog catalog Map properties = new HashMap<>(); properties.put("hive.metastore.uri", catalog.getRequiredProperty("metastore.uris")); + properties.put("hive.security", "allow-all"); Map trinoProperty = catalogConverter.gravitinoToEngineProperties(catalog.getProperties());