Skip to content

Commit

Permalink
fix style
Browse files Browse the repository at this point in the history
  • Loading branch information
lsm1 committed Jan 19, 2024
1 parent a36380c commit 580eb45
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,9 @@ class TrinoSessionImpl(
override val handle: SessionHandle =
conf.get(KYUUBI_SESSION_HANDLE_KEY).map(SessionHandle.fromUUID).getOrElse(SessionHandle())

private val username: String = sessionConf
private val sessionUser: String = sessionConf
.getOption(KyuubiReservedKeys.KYUUBI_SESSION_USER_KEY).getOrElse(currentUser)

private val trinoUser: String = sessionConf
.get(KyuubiConf.ENGINE_TRINO_CONNECTION_USER).getOrElse(username)

var trinoContext: TrinoContext = _
private var clientSession: ClientSession = _
private var catalogName: String = _
Expand Down Expand Up @@ -98,7 +95,7 @@ class TrinoSessionImpl(

ClientSession.builder()
.server(URI.create(connectionUrl))
.principal(Optional.of(username))
.principal(Optional.of(sessionUser))
.source("kyuubi")
.catalog(catalogName)
.schema(databaseName)
Expand Down Expand Up @@ -136,7 +133,9 @@ class TrinoSessionImpl(
require(
serverScheme.equalsIgnoreCase("https"),
"Trino engine using username/password requires HTTPS to be enabled")
builder.addInterceptor(OkHttpUtil.basicAuth(trinoUser, password))
val user: String = sessionConf
.get(KyuubiConf.ENGINE_TRINO_CONNECTION_USER).getOrElse(sessionUser)
builder.addInterceptor(OkHttpUtil.basicAuth(user, password))
}

builder.build()
Expand Down

0 comments on commit 580eb45

Please sign in to comment.