Yikf commented on code in PR #3477:
URL: https://github.com/apache/incubator-kyuubi/pull/3477#discussion_r969516608
##########
externals/kyuubi-trino-engine/src/main/scala/org/apache/kyuubi/engine/trino/session/TrinoSessionImpl.scala:
##########
@@ -109,6 +108,28 @@ class TrinoSessionImpl(
super.runOperation(operation)
}
+ override def getInfo(infoType: TGetInfoType): TGetInfoValue =
withAcquireRelease() {
+ infoType match {
+ case TGetInfoType.CLI_SERVER_NAME | TGetInfoType.CLI_DBMS_NAME =>
+ TGetInfoValue.stringValue("Trino")
+ case TGetInfoType.CLI_DBMS_VER =>
TGetInfoValue.stringValue(getTrinoServerVersion)
+ case TGetInfoType.CLI_ODBC_KEYWORDS =>
TGetInfoValue.stringValue("Unimplemented")
+ case TGetInfoType.CLI_MAX_COLUMN_NAME_LEN |
+ TGetInfoType.CLI_MAX_SCHEMA_NAME_LEN |
+ TGetInfoType.CLI_MAX_TABLE_NAME_LEN => TGetInfoValue.lenValue(0)
+ case _ => throw KyuubiSQLException(s"Unrecognized GetInfoType value:
$infoType")
+ }
+ }
+
+ private def getTrinoServerVersion: String = {
+ val trinoStatement =
+ TrinoStatement(trinoContext, sessionManager.getConf, "SELECT version()")
+ val resultSet = trinoStatement.execute()
+
+ assert(resultSet.hasNext)
+ resultSet.next().head.toString
Review Comment:
A TrinoStatement is not a SqlStatement(like a client) and a RowSet is not an
sql RowSet. they are just a statement wrapper and iterator, and I don't think
close is required
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]