Skip to content
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

Bump trino-client 411 #5975

Closed
wants to merge 5 commits into from
Closed
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: 0 additions & 1 deletion LICENSE-binary
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ org.apache.commons:commons-lang3
org.apache.derby:derby
com.google.errorprone:error_prone_annotations
dev.failsafe:failsafe
net.jodah:failsafe
com.jakewharton.fliptables:fliptables
com.github.mifmif:generex
io.grpc:grpc-api
Expand Down
5 changes: 2 additions & 3 deletions dev/dependencyList
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ commons-lang3/3.13.0//commons-lang3-3.13.0.jar
commons-logging/1.1.3//commons-logging-1.1.3.jar
derby/10.14.2.0//derby-10.14.2.0.jar
error_prone_annotations/2.20.0//error_prone_annotations-2.20.0.jar
failsafe/2.4.4//failsafe-2.4.4.jar
failsafe/3.3.2//failsafe-3.3.2.jar
failureaccess/1.0.1//failureaccess-1.0.1.jar
flatbuffers-java/1.12.0//flatbuffers-java-1.12.0.jar
Expand Down Expand Up @@ -193,8 +192,8 @@ swagger-core/2.2.1//swagger-core-2.2.1.jar
swagger-integration/2.2.1//swagger-integration-2.2.1.jar
swagger-jaxrs2/2.2.1//swagger-jaxrs2-2.2.1.jar
swagger-models/2.2.1//swagger-models-2.2.1.jar
trino-client/363//trino-client-363.jar
units/1.6//units-1.6.jar
trino-client/411//trino-client-411.jar
units/1.7//units-1.7.jar
vertx-core/4.5.1//vertx-core-4.5.1.jar
vertx-grpc/4.5.1//vertx-grpc-4.5.1.jar
zjsonpatch/0.3.0//zjsonpatch-0.3.0.jar
Expand Down
6 changes: 3 additions & 3 deletions docs/client/cli/trino_cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ kyuubi.frontend.trino.bind.port 10999 #default port

## Install

Download [trino-cli-363-executable.jar](https://repo1.maven.org/maven2/io/trino/trino-jdbc/363/trino-jdbc-363.jar), rename it to `trino`, make it executable with `chmod +x`, and run it to show the version of the CLI:
Download [trino-cli-411-executable.jar](https://repo1.maven.org/maven2/io/trino/trino-jdbc/411/trino-jdbc-411.jar), rename it to `trino`, make it executable with `chmod +x`, and run it to show the version of the CLI:

```
wget https://repo1.maven.org/maven2/io/trino/trino-jdbc/363/trino-jdbc-363.jar
mv trino-jdbc-363.jar trino
wget https://repo1.maven.org/maven2/io/trino/trino-jdbc/411/trino-jdbc-411.jar
mv trino-jdbc-411.jar trino
chmod +x trino
./trino --version
```
Expand Down
4 changes: 2 additions & 2 deletions docs/client/jdbc/trino_jdbc.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ kyuubi.frontend.trino.bind.port 10999 #default port

## Install Trino JDBC

Download [trino-jdbc-363.jar](https://repo1.maven.org/maven2/io/trino/trino-jdbc/363/trino-jdbc-363.jar) and add it to the classpath of your Java application.
Download [trino-jdbc-411.jar](https://repo1.maven.org/maven2/io/trino/trino-jdbc/411/trino-jdbc-363.jar) and add it to the classpath of your Java application.

The driver is also available from Maven Central:

```xml
<dependency>
<groupId>io.trino</groupId>
<artifactId>trino-jdbc</artifactId>
<version>363</version>
<version>411</version>
</dependency>
```

Expand Down
8 changes: 4 additions & 4 deletions docs/quick_start/quick_start.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,23 @@ For quick start deployment, we need to prepare the following stuffs:
These essential components are JVM-based applications. So, the JRE needs to be
pre-installed and the ``JAVA_HOME`` is correctly set to each component.

================ ============ ==================== ===========================================
================ ============ ==================== =======================================================
Component Role Version Remarks
================ ============ ==================== ===========================================
================ ============ ==================== =======================================================
**Java** JRE 8/11/17 Officially released against JDK8
**Kyuubi** Gateway \ |release| \ - Kyuubi Server
Engine lib - Kyuubi Engine
Beeline - Kyuubi Hive Beeline
**Spark** Engine 3.1 to 3.5 A Spark distribution
**Flink** Engine 1.16/1.17/1.18 A Flink distribution
**Trino** Engine >=363 A Trino cluster
**Trino** Engine N/A A Trino cluster allows to access via trino-client v411
**Doris** Engine N/A A Doris cluster
**Hive** Engine - 2.1-cdh6/2.3/3.1 - A Hive distribution
Metastore - N/A - An optional and external metadata store,
whose version is decided by engines
**Zookeeper** HA >=3.4.x
**Disk** Storage N/A N/A
================ ============ ==================== ===========================================
================ ============ ==================== =======================================================

The other internal or external parts listed in the above sheet can be used individually
or all together. For example, you can use Kyuubi, Spark and Flink to build a streaming
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ com.google.errorprone:error_prone_annotations
com.google.guava:guava
com.google.guava:failureaccess
com.google.j2objc:j2objc-annotations
dev.failsafe:failsafe
io.etcd:jetcd-api
io.etcd:jetcd-common
io.etcd:jetcd-core
Expand Down Expand Up @@ -252,7 +253,6 @@ io.netty:netty-transport-native-unix-common
io.perfmark:perfmark-api
io.vertx:vertx-grpc
io.vertx:vertx-core
net.jodah:failsafe

BSD License
--------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,21 +128,21 @@ class TrinoStatement(
// update catalog and schema
if (trino.getSetCatalog.isPresent || trino.getSetSchema.isPresent) {
builder = builder
.withCatalog(trino.getSetCatalog.orElse(session.getCatalog))
.withSchema(trino.getSetSchema.orElse(session.getSchema))
.catalog(trino.getSetCatalog.orElse(session.getCatalog))
.schema(trino.getSetSchema.orElse(session.getSchema))
}

// update path if present
if (trino.getSetPath.isPresent) {
builder = builder.withPath(trino.getSetPath.get)
builder = builder.path(trino.getSetPath.get)
}

// update session properties if present
if (!trino.getSetSessionProperties.isEmpty || !trino.getResetSessionProperties.isEmpty) {
val properties = session.getProperties.asScala.clone()
properties ++= trino.getSetSessionProperties.asScala
properties --= trino.getResetSessionProperties.asScala
builder = builder.withProperties(properties.asJava)
builder = builder.properties(properties.asJava)
}

trinoContext.clientSession.set(builder.build())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class SetCurrentCatalog(session: Session, catalog: String)
try {
val session = trinoContext.clientSession.get
var builder = ClientSession.builder(session)
builder = builder.withCatalog(catalog)
builder = builder.catalog(catalog)
trinoContext.clientSession.set(builder.build())
setHasResultSet(false)
} catch onError()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class SetCurrentDatabase(session: Session, database: String)
try {
val session = trinoContext.clientSession.get
var builder = ClientSession.builder(session)
builder = builder.withSchema(database)
builder = builder.schema(database)
trinoContext.clientSession.set(builder.build())
setHasResultSet(false)
} catch onError()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package org.apache.kyuubi.engine.trino.session

import java.net.URI
import java.time.ZoneId
import java.util.{Collections, Locale, Optional}
import java.util.{Locale, Optional}
import java.util.concurrent.TimeUnit

import scala.collection.JavaConverters._
Expand Down Expand Up @@ -93,27 +93,18 @@ class TrinoSessionImpl(

val properties = getTrinoSessionConf(sessionConf).asJava

new ClientSession(
URI.create(connectionUrl),
username,
Optional.empty(),
"kyuubi",
Optional.empty(),
Collections.emptySet(),
null,
catalogName,
databaseName,
null,
ZoneId.systemDefault(),
Locale.getDefault,
Collections.emptyMap(),
properties,
Collections.emptyMap(),
Collections.emptyMap(),
Collections.emptyMap(),
null,
new Duration(clientRequestTimeout, TimeUnit.MILLISECONDS),
true)
ClientSession.builder()
.server(URI.create(connectionUrl))
.principal(Optional.of(username))
.source("kyuubi")
.catalog(catalogName)
.schema(databaseName)
.timeZone(ZoneId.systemDefault())
.locale(Locale.getDefault)
.properties(properties)
.clientRequestTimeout(new Duration(clientRequestTimeout, TimeUnit.MILLISECONDS))
.compressionDisabled(true)
.build()
}

private def createHttpClient(): OkHttpClient = {
Expand All @@ -135,7 +126,8 @@ class TrinoSessionImpl(
Optional.ofNullable(keystoreType.orNull),
Optional.ofNullable(truststorePath.orNull),
Optional.ofNullable(truststorePassword.orNull),
Optional.ofNullable(truststoreType.orNull))
Optional.ofNullable(truststoreType.orNull),
true)

sessionConf.get(KyuubiConf.ENGINE_TRINO_CONNECTION_PASSWORD).foreach { password =>
require(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,9 @@ import java.util.Locale
import java.util.Optional
import java.util.concurrent.TimeUnit

import scala.collection.JavaConverters._

import com.dimafeng.testcontainers.TrinoContainer
import com.dimafeng.testcontainers.scalatest.TestContainerForAll
import io.airlift.units.Duration
import io.trino.client.ClientSelectedRole
import io.trino.client.ClientSession
import okhttp3.OkHttpClient
import org.testcontainers.utility.DockerImageName
Expand All @@ -38,8 +35,8 @@ import org.apache.kyuubi.config.KyuubiConf

trait WithTrinoContainerServer extends KyuubiFunSuite with TestContainerForAll {

final val IMAGE_VERSION = 363
final val DOCKER_IMAGE_NAME = s"trinodb/trino:${IMAGE_VERSION}"
final val IMAGE_VERSION = 411
final val DOCKER_IMAGE_NAME = s"trinodb/trino:$IMAGE_VERSION"

override val containerDef = TrinoContainer.Def(DockerImageName.parse(DOCKER_IMAGE_NAME))

Expand All @@ -56,27 +53,17 @@ trait WithTrinoContainerServer extends KyuubiFunSuite with TestContainerForAll {
}
}

protected def session(connectionUrl: String): ClientSession = new ClientSession(
URI.create(connectionUrl),
"kyuubi_test",
Optional.empty(),
"kyuubi",
Optional.empty(),
Set[String]().asJava,
null,
catalog,
schema,
null,
ZoneId.systemDefault(),
Locale.getDefault,
Map[String, String]().asJava,
Map[String, String]().asJava,
Map[String, String]().asJava,
Map[String, ClientSelectedRole]().asJava,
Map[String, String]().asJava,
null,
new Duration(2, TimeUnit.MINUTES),
true)
protected def session(connectionUrl: String): ClientSession = ClientSession.builder()
.server(URI.create(connectionUrl))
.principal(Optional.of("kyuubi_test"))
.source("kyuubi")
.catalog(catalog)
.schema(schema)
.timeZone(ZoneId.systemDefault())
.locale(Locale.getDefault)
.clientRequestTimeout(new Duration(2, TimeUnit.MINUTES))
.compressionDisabled(true)
.build()

lazy val httpClient = new OkHttpClient.Builder().build()
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ trait WithKyuubiServerAndTrinoContainer extends WithKyuubiServer with TestContai

val kyuubiHome: String = Utils.getCodeSourceLocation(getClass).split("integration-tests").head

final val IMAGE_VERSION = 363
final val DOCKER_IMAGE_NAME = s"trinodb/trino:${IMAGE_VERSION}"
final val IMAGE_VERSION = 411
final val DOCKER_IMAGE_NAME = s"trinodb/trino:$IMAGE_VERSION"

override val containerDef: TrinoContainer.Def = TrinoContainer.Def(DOCKER_IMAGE_NAME)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package org.apache.kyuubi.server.trino.api

import java.net.URI
import java.time.ZoneId
import java.util.{Collections, Locale, Optional}
import java.util.{Locale, Optional}
import java.util.concurrent.TimeUnit
import java.util.concurrent.atomic.AtomicReference

Expand Down Expand Up @@ -74,21 +74,21 @@ class TrinoClientApiSuite extends KyuubiFunSuite with TrinoRestFrontendTestHelpe
// update catalog and schema
if (trino.getSetCatalog.isPresent || trino.getSetSchema.isPresent) {
builder = builder
.withCatalog(trino.getSetCatalog.orElse(session.getCatalog))
.withSchema(trino.getSetSchema.orElse(session.getSchema))
.catalog(trino.getSetCatalog.orElse(session.getCatalog))
.schema(trino.getSetSchema.orElse(session.getSchema))
}

// update path if present
if (trino.getSetPath.isPresent) {
builder = builder.withPath(trino.getSetPath.get)
builder = builder.path(trino.getSetPath.get)
}

// update session properties if present
if (!trino.getSetSessionProperties.isEmpty || !trino.getResetSessionProperties.isEmpty) {
val properties = session.getProperties.asScala.clone()
properties ++= trino.getSetSessionProperties.asScala
properties --= trino.getResetSessionProperties.asScala
builder = builder.withProperties(properties.asJava)
builder = builder.properties(properties.asJava)
}
clientSession.set(builder.build())
}
Expand Down Expand Up @@ -123,32 +123,26 @@ class TrinoClientApiSuite extends KyuubiFunSuite with TrinoRestFrontendTestHelpe
}

private def createTestClientSession(connectUrl: URI): ClientSession = {
new ClientSession(
connectUrl,
"kyuubi_test",
Optional.of("test_user"),
"kyuubi",
Optional.of("test_token_tracing"),
Set[String]().asJava,
"test_client_info",
"test_catalog",
"test_schema",
null,
ZoneId.systemDefault(),
Locale.getDefault,
Collections.emptyMap(),
Map[String, String](
ClientSession.builder()
.server(connectUrl)
.principal(Optional.of("kyuubi_test"))
.user(Optional.of("test_user"))
.source("kyuubi")
.traceToken(Optional.of("test_token_tracing"))
.clientInfo("test_client_info")
.catalog("test_catalog")
.schema("test_schema")
.timeZone(ZoneId.systemDefault())
.locale(Locale.getDefault)
.properties(Map[String, String](
"test_property_key0" -> "test_property_value0",
"test_property_key1" -> "test_propert_value1").asJava,
Map[String, String](
"test_property_key1" -> "test_propert_value1").asJava)
.preparedStatements(Map[String, String](
"test_statement_key0" -> "select 1",
"test_statement_key1" -> "select 2").asJava,
Collections.emptyMap(),
Collections.emptyMap(),
null,
new Duration(2, TimeUnit.MINUTES),
true)

"test_statement_key1" -> "select 2").asJava)
.clientRequestTimeout(new Duration(2, TimeUnit.MINUTES))
.compressionDisabled(true)
.build()
}

}
10 changes: 2 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@
<commons-lang3.version>3.13.0</commons-lang3.version>
<delta.artifact>delta-core</delta.artifact>
<delta.version>2.4.0</delta.version>
<failsafe2.verion>2.4.4</failsafe2.verion>
<failsafe.verion>3.3.2</failsafe.verion>
<fb303.version>0.9.3</fb303.version>
<flexmark.version>0.62.2</flexmark.version>
Expand Down Expand Up @@ -213,7 +212,8 @@
<!-- https://github.com/ThreeTen/threeten-extra/issues/226 -->
<threeten.version>1.7.0</threeten.version>
<thrift.version>0.9.3</thrift.version>
<trino.client.version>363</trino.client.version>
<!-- trino-client involves kotlin runtime dependencies since 412 because of upgrading okhttp -->
<trino.client.version>411</trino.client.version>
<trino.tpcds.version>1.4</trino.tpcds.version>
<trino.tpch.version>1.1</trino.tpch.version>

Expand Down Expand Up @@ -1175,12 +1175,6 @@
<version>${protobuf.version}</version>
</dependency>

<dependency>
<groupId>net.jodah</groupId>
<artifactId>failsafe</artifactId>
<version>${failsafe2.verion}</version>
</dependency>

<dependency>
<groupId>dev.failsafe</groupId>
<artifactId>failsafe</artifactId>
Expand Down
Loading