-
Notifications
You must be signed in to change notification settings - Fork 726
[#9894] feat (trino-connector): Add the version segment module to support Trino 440-445 #9895
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
929cc6c
feat(trino-connector): Add Trino 440-445 version module and optimize …
diqiu50 94192fe
fix(trino-connector): Fix method name typo in TestGravitinoConnector440
diqiu50 944a013
fix(trino-connector): Improve exception handling in GravitinoMockServer
diqiu50 10dc4cf
Fix
diqiu50 a2aaf86
fix(build): Increase network timeout for toolchain downloads
diqiu50 ec770fe
style(trino-connector): Format method signature in GravitinoMockServer
diqiu50 dbac184
Fix
diqiu50 21c30ca
Fix
diqiu50 2beabe2
Fix
diqiu50 f1ad6f2
Fix
diqiu50 ce3a963
Fix
diqiu50 19b0e90
Fix
diqiu50 46a64d3
Fix
diqiu50 cbce6af
Fix
diqiu50 496e3c0
feat: make uv venv creation idempotent
diqiu50 fa6b6c1
Fix
diqiu50 36b07e7
[#9919] fix(CI): Fix python CI pipeline fails due to runner image upg…
yuqi1129 fae16ed
[HOTFIX] fix: Fix the uv CI pipeline (#9905)
roryqi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
163 changes: 163 additions & 0 deletions
163
trino-connector/trino-connector-440-445/build.gradle.kts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) | ||
| } | ||
| } |
55 changes: 55 additions & 0 deletions
55
...tor-440-445/src/main/java/org/apache/gravitino/trino/connector/GravitinoConnector440.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.