Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,7 @@ tasks {

val compileTrinoConnector by registering {
dependsOn("trino-connector:trino-connector-435-439:copyLibs")
dependsOn("trino-connector:trino-connector-440-445:copyLibs")
group = "gravitino distribution"
outputs.dir(projectDir.dir("distribution/${rootProject.name}-trino-connector-435-439"))
}
Expand Down
3 changes: 3 additions & 0 deletions clients/client-python/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ pyjwt[crypto]==2.10.1
jwcrypto==1.5.6
sphinx==7.1.2
furo==2024.8.6
# banks 2.4.0 does not support python 3.9.* or lower, so we limit the version here. We can also
# consider upgrading the python version to 3.10.x or higher in the future to avoid this issue.
banks==2.3.0
4 changes: 4 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ org.gradle.jvmargs=-Xmx4g
org.gradle.java.installations.auto-download=true
org.gradle.java.installations.auto-detect=true

# Increase network timeout for toolchain downloads (in milliseconds)
systemProp.org.gradle.internal.http.connectionTimeout=300000
systemProp.org.gradle.internal.http.socketTimeout=300000

# version that is going to be updated automatically by releases
version = 1.2.0-SNAPSHOT

Expand Down
10 changes: 5 additions & 5 deletions integration-test-common/docker-script/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
services:

hive:
image: apache/gravitino-ci:hive-0.1.13
image: apache/gravitino-ci:hive-0.1.20
networks:
- trino-net
container_name: trino-ci-hive
Expand Down Expand Up @@ -79,7 +79,7 @@ services:
retries: 5

trino:
image: trinodb/trino:${TRINO_VERSION:-435}
image: trinodb/trino:${TRINO_VERSION:-440}
networks:
- trino-net
container_name: trino-ci-trino
Expand All @@ -94,7 +94,7 @@ services:
entrypoint: /bin/bash /tmp/trino/init.sh
volumes:
- ./init/trino:/tmp/trino
- ${GRAVITINO_TRINO_CONNECTOR_DIR:-../../trino-connector/trino-connector-435-439/build/libs}:/usr/lib/trino/plugin/gravitino
- ${GRAVITINO_TRINO_CONNECTOR_DIR:-../../trino-connector/trino-connector-440-445/build/libs}:/usr/lib/trino/plugin/gravitino
extra_hosts:
- "host.docker.internal:host-gateway"
healthcheck:
Expand All @@ -113,7 +113,7 @@ services:
condition: service_healthy

trino-worker:
image: trinodb/trino:${TRINO_VERSION:-435}
image: trinodb/trino:${TRINO_VERSION:-440}
networks:
- trino-net
deploy:
Expand All @@ -128,7 +128,7 @@ services:
entrypoint: /bin/bash /tmp/trino/init.sh
volumes:
- ./init/trino:/tmp/trino
- ${GRAVITINO_TRINO_CONNECTOR_DIR:-../../trino-connector/trino-connector-435-439/build/libs}:/usr/lib/trino/plugin/gravitino
- ${GRAVITINO_TRINO_CONNECTOR_DIR:-../../trino-connector/trino-connector-440-445/build/libs}:/usr/lib/trino/plugin/gravitino
extra_hosts:
- "host.docker.internal:host-gateway"
depends_on:
Expand Down
2 changes: 1 addition & 1 deletion integration-test-common/docker-script/init/trino/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ fi

# Container start up
if [[ "${TRINO_ROLE}" == "coordinator" ]]; then
nohup /usr/lib/trino/bin/run-trino > /tmp/trino.out 2>&1 &
nohup /usr/lib/trino/bin/run-trino 2>&1 | tee /tmp/trino.log &

counter=0
while [ $counter -le 300 ]; do
Expand Down
16 changes: 11 additions & 5 deletions integration-test-common/docker-script/launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,20 @@ cd ${playground_dir}
LOG_DIR=../build/trino-ci-container-log
rm -fr $LOG_DIR
mkdir -p $LOG_DIR

docker compose up -d

LOG_PATH=$LOG_DIR/trino-ci-docker-compose.log

echo "The docker compose log is: $LOG_PATH"

nohup docker compose logs -f -t > $LOG_PATH &
docker compose up -d

# Stream logs directly to the log file (no console output).
nohup docker compose logs -f -t | tee -a "$LOG_PATH" &
LOG_FOLLOW_PID=$!
cleanup_log_follow() {
if [ -n "$LOG_FOLLOW_PID" ] && kill -0 "$LOG_FOLLOW_PID" 2>/dev/null; then
kill "$LOG_FOLLOW_PID" >/dev/null 2>&1
fi
}
trap cleanup_log_follow EXIT

max_attempts=300
attempts=0
Expand Down
1 change: 1 addition & 0 deletions integration-test-common/docker-script/shutdown.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ LOG_DIR=../build/trino-ci-container-log
if [ -d $LOG_DIR ]; then
docker cp trino-ci-hive:/usr/local/hadoop/logs $LOG_DIR/hdfs
docker cp trino-ci-hive:/tmp/root $LOG_DIR/hive
docker cp trino-ci-trino:/tmp/trino.log $LOG_DIR/trino.log
fi

export GRAVITINO_TRINO_CONNECTOR_DIR=/dev/null
Expand Down
7 changes: 6 additions & 1 deletion mcp-server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,12 @@ tasks {

doFirst {
println("UV executable path: ${getUvExecutable()}")
commandLine(getUvExecutable(), "venv", venvDir.absolutePath)
if (venvDir.exists()) {
logger.lifecycle("Virtual environment already exists at: ${venvDir.absolutePath}, clearing...")
commandLine(getUvExecutable(), "venv", "--clear", venvDir.absolutePath)
} else {
commandLine(getUvExecutable(), "venv", venvDir.absolutePath)
}
}

doLast {
Expand Down
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ include("authorizations:authorization-ranger", "authorizations:authorization-com
include(
"trino-connector:trino-connector",
"trino-connector:trino-connector-435-439",
"trino-connector:trino-connector-440-445",
"trino-connector:integration-test"
)
include("spark-connector:spark-common")
Expand Down
3 changes: 2 additions & 1 deletion trino-connector/integration-test/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ dependencies {
}

tasks.register("setupDependencies") {
dependsOn(":trino-connector:trino-connector:jar")
dependsOn(":trino-connector:trino-connector-435-439:jar")
dependsOn(":trino-connector:trino-connector-440-445:jar")
dependsOn(":catalogs:catalog-lakehouse-iceberg:jar", ":catalogs:catalog-lakehouse-iceberg:runtimeJars")
dependsOn(":catalogs:catalog-jdbc-mysql:jar", ":catalogs:catalog-jdbc-mysql:runtimeJars")
dependsOn(":catalogs:catalog-jdbc-postgresql:jar", ":catalogs:catalog-jdbc-postgresql:runtimeJars")
Expand Down
25 changes: 14 additions & 11 deletions trino-connector/trino-connector-435-439/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,21 @@ plugins {
`maven-publish`
}

val supportedTrinoVersion = 435
val minSupportedTrinoVersionProperty = providers.gradleProperty("minSupportedTrinoVersion").map { it.trim().toInt() }
val trinoVersionProvider =
providers.gradleProperty("trinoVersion").map { it.trim().toInt() }.orElse(minSupportedTrinoVersionProperty)

val resolvedTrinoVersion = trinoVersionProvider.get()
check(resolvedTrinoVersion >= supportedTrinoVersion) {
"Failed to build the module ${project.path} of trinoVersion=$resolvedTrinoVersion. " +
"This module requires trinoVersion >= $supportedTrinoVersion. " +
"Please set '-PtrinoVersion' in the command or set config the 'minSupportedTrinoVersion' of gradle.properties."
// This module supports Trino versions 435-439
val minTrinoVersion = 435
val maxTrinoVersion = 439

val trinoVersion = providers.gradleProperty("trinoVersion")
.map { it.trim().toInt() }
.orElse(minTrinoVersion)
.get()

// Validate version range
check(trinoVersion in minTrinoVersion..maxTrinoVersion) {
"Module ${project.path} supports Trino versions $minTrinoVersion-$maxTrinoVersion, " +
"but trinoVersion=$trinoVersion was specified. " +
"Please set '-PtrinoVersion=$minTrinoVersion' (or any version in the supported range)."
}
val trinoVersion = resolvedTrinoVersion

java {
toolchain.languageVersion.set(JavaLanguageVersion.of(24))
Expand Down
163 changes: 163 additions & 0 deletions trino-connector/trino-connector-440-445/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
/*
* 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 com.diffplug.gradle.spotless.SpotlessExtension
import net.ltgt.gradle.errorprone.errorprone
import org.gradle.internal.hash.ChecksumService
import org.gradle.kotlin.dsl.support.serviceOf

plugins {
`java-library`
`maven-publish`
}

// This module supports Trino versions 440-445
val minTrinoVersion = 440
val maxTrinoVersion = 445

val trinoVersion = providers.gradleProperty("trinoVersion")
.map { it.trim().toInt() }
.orElse(minTrinoVersion)
.get()

// Validate version range
check(trinoVersion in minTrinoVersion..maxTrinoVersion) {
"Module ${project.path} supports Trino versions $minTrinoVersion-$maxTrinoVersion, " +
"but trinoVersion=$trinoVersion was specified. " +
"Please set '-PtrinoVersion=$minTrinoVersion' (or any version in the supported range)."
}

java {
toolchain.languageVersion.set(JavaLanguageVersion.of(24))
}

dependencies {
implementation(project(":catalogs:catalog-common"))
implementation(project(":clients:client-java-runtime", configuration = "shadow"))
implementation(libs.airlift.json)
implementation(libs.bundles.log4j)
implementation(libs.commons.collections4)
implementation(libs.commons.lang3)
implementation("io.trino:trino-jdbc:$trinoVersion")
runtimeOnly("io.opentelemetry.semconv:opentelemetry-semconv:1.23.1-alpha")
compileOnly(libs.airlift.resolver)
compileOnly("io.trino:trino-spi:$trinoVersion") {
exclude("org.apache.logging.log4j")
}
testImplementation(libs.awaitility)
testImplementation(libs.mockito.core)
testImplementation(libs.mysql.driver)
testImplementation("io.trino:trino-memory:$trinoVersion") {
exclude("org.antlr")
exclude("org.apache.logging.log4j")
}
testImplementation("io.trino:trino-testing:$trinoVersion") {
exclude("org.apache.logging.log4j")
}
testRuntimeOnly(libs.junit.jupiter.engine)
}

sourceSets {
main {
java.srcDirs("../trino-connector/src/main/java")
}
test {
java.srcDirs("../trino-connector/src/test/java")
resources.srcDirs("../trino-connector/src/test/resources")
}
}

plugins.withId("com.diffplug.spotless") {
configure<SpotlessExtension> {
java {
// Keep Spotless within this module to avoid cross-project target errors.
target(project.fileTree("src") { include("**/*.java") })
}
}
}

tasks.withType<JavaCompile>().configureEach {
// Error Prone is incompatible with the JDK 24 toolchain required by this Trino range.
options.errorprone.isEnabled.set(false)
options.release.set(17)
}

tasks.withType<Test>().configureEach {
extensions
.findByType(org.gradle.testing.jacoco.plugins.JacocoTaskExtension::class.java)
?.isEnabled = false
}

tasks {
val copyRuntimeLibs by registering(Copy::class) {
dependsOn("jar")
from({ configurations.runtimeClasspath.get().filter(File::isFile) })
into(layout.buildDirectory.dir("libs"))
}

val distributionDir = rootProject.layout.projectDirectory.dir("distribution/${rootProject.name}-${project.name}")

val copyLibs by registering(Copy::class) {
dependsOn(copyRuntimeLibs, "build")
from(layout.buildDirectory.dir("libs"))
from(rootProject.layout.projectDirectory.dir("licenses")) {
into("licenses")
}
from(rootProject.file("LICENSE.trino"))
from(rootProject.file("NOTICE.trino"))
from(rootProject.file("README.md"))
into(distributionDir)
rename { fileName ->
fileName.replace(".trino", "")
}
outputs.dir(distributionDir)
}

val assembleTrinoConnector by registering(Tar::class) {
dependsOn(copyLibs)
group = "gravitino distribution"
finalizedBy("checksumTrinoConnector")
val archiveBase = "${rootProject.name}-${project.name}-$version"
into(archiveBase)
from(distributionDir)
compression = Compression.GZIP
archiveFileName.set("$archiveBase.tar.gz")
destinationDirectory.set(rootProject.layout.projectDirectory.dir("distribution"))
}

val checksumTrinoConnector by registering {
group = "gravitino distribution"
dependsOn(assembleTrinoConnector)
val archiveFile = assembleTrinoConnector.flatMap { it.archiveFile }
val checksumFile = archiveFile.map { archive ->
archive.asFile.let { it.resolveSibling("${it.name}.sha256") }
}
inputs.file(archiveFile)
outputs.file(checksumFile)
doLast {
checksumFile.get().writeText(
serviceOf<ChecksumService>().sha256(archiveFile.get().asFile).toString()
)
}
}

named("build") {
finalizedBy(copyRuntimeLibs)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* 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 io.trino.spi.connector.ConnectorMetadata;
import io.trino.spi.connector.ConnectorNodePartitioningProvider;
import io.trino.spi.connector.ConnectorSplitManager;
import org.apache.gravitino.trino.connector.catalog.CatalogConnectorContext;
import org.apache.gravitino.trino.connector.catalog.CatalogConnectorMetadata;
import org.apache.gravitino.trino.connector.catalog.CatalogConnectorMetadataAdapter;

public class GravitinoConnector440 extends GravitinoConnector {

public GravitinoConnector440(CatalogConnectorContext connectorContext) {
super(connectorContext);
}

@Override
protected GravitinoMetadata createGravitinoMetadata(
CatalogConnectorMetadata catalogConnectorMetadata,
CatalogConnectorMetadataAdapter metadataAdapter,
ConnectorMetadata internalMetadata) {
return new GravitinoMetadata440(catalogConnectorMetadata, metadataAdapter, internalMetadata);
}

@Override
public ConnectorSplitManager getSplitManager() {
ConnectorSplitManager splitManager =
catalogConnectorContext.getInternalConnector().getSplitManager();
return new GravitinoSplitManager440(splitManager);
}

@Override
public ConnectorNodePartitioningProvider getNodePartitioningProvider() {
ConnectorNodePartitioningProvider nodePartitioningProvider =
catalogConnectorContext.getInternalConnector().getNodePartitioningProvider();
return new GravitinoNodePartitioningProvider440(nodePartitioningProvider);
}
}
Loading