[KYUUBI #1421] Improve beeline print

<!--
Thanks for sending a pull request!

Here are some tips for you:
  1. If this is your first time, please read our contributor guidelines: https://kyuubi.readthedocs.io/en/latest/community/contributions.html
  2. If the PR is related to an issue in https://github.com/apache/incubator-kyuubi/issues, add '[KYUUBI #XXXX]' in your PR title, e.g., '[KYUUBI #XXXX] Your PR title ...'.
  3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][KYUUBI #XXXX] Your PR title ...'.
-->

### _Why are the changes needed?_
<!--
Please clarify why the changes are needed. For instance,
  1. If you add a feature, you can talk about the use case of it.
  2. If you fix a bug, you can clarify why it is a bug.
-->
We don't support isolation, so it's unnecessary to print isolation level.

before this PR
```
Connected to: Spark SQL (version 1.4.0-SNAPSHOT)
Driver: Kyuubi Project Hive JDBC Shaded Client (version 1.4.0-SNAPSHOT)
Transaction isolation: TRANSACTION_REPEATABLE_READ
Beeline version 1.4.0-SNAPSHOT by Apache Kyuubi
```

After:
```
Connected to: Apache Kyuubi (Incubating) (version 1.4.0-SNAPSHOT)
Driver: Kyuubi Project Hive JDBC Shaded Client (version 1.4.0-SNAPSHOT)
Beeline version 1.4.0-SNAPSHOT by Apache Kyuubi (Incubating)
```

### _How was this patch tested?_
- [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible

- [ ] Add screenshots for manual tests if appropriate

- [x] [Run test](https://kyuubi.readthedocs.io/en/latest/develop_tools/testing.html#running-tests) locally before make a pull request

Closes #1421 from ulysses-you/improve-log.

Closes #1421

2e0e168e [ulysses-you] improve

Authored-by: ulysses-you <ulyssesyou18@gmail.com>
Signed-off-by: fwang12 <fwang12@ebay.com>
This commit is contained in:
ulysses-you 2021-11-19 22:58:43 +08:00 committed by fwang12
parent 21cc217281
commit fda295865e
6 changed files with 8 additions and 21 deletions

View File

@ -402,7 +402,7 @@ class SparkOperationSuite extends WithSparkSQLEngine with HiveMetadataTests with
import org.apache.kyuubi.KYUUBI_VERSION
assert(metaData.allTablesAreSelectable)
assert(metaData.getDatabaseProductName === "Spark SQL")
assert(metaData.getDatabaseProductName === "Apache Kyuubi (Incubating)")
assert(metaData.getDatabaseProductVersion === KYUUBI_VERSION)
assert(metaData.getDriverName === "Kyuubi Project Hive JDBC Shaded Client")
assert(metaData.getDriverVersion === KYUUBI_VERSION)

View File

@ -101,8 +101,8 @@ abstract class AbstractSession(
override def getInfo(infoType: TGetInfoType): TGetInfoValue = withAcquireRelease() {
infoType match {
case TGetInfoType.CLI_SERVER_NAME => TGetInfoValue.stringValue("Kyuubi")
case TGetInfoType.CLI_DBMS_NAME => TGetInfoValue.stringValue("Spark SQL")
case TGetInfoType.CLI_SERVER_NAME => TGetInfoValue.stringValue("Apache Kyuubi (Incubating)")
case TGetInfoType.CLI_DBMS_NAME => TGetInfoValue.stringValue("Apache Kyuubi (Incubating)")
case TGetInfoType.CLI_DBMS_VER => TGetInfoValue.stringValue(org.apache.kyuubi.KYUUBI_VERSION)
case TGetInfoType.CLI_MAX_COLUMN_NAME_LEN |
TGetInfoType.CLI_MAX_SCHEMA_NAME_LEN |

View File

@ -169,9 +169,9 @@ class ThriftFrontendServiceSuite extends KyuubiFunSuite {
val resp = client.GetInfo(req)
assert(resp.getInfoValue.getStringValue === org.apache.kyuubi.KYUUBI_VERSION)
req.setInfoType(TGetInfoType.CLI_SERVER_NAME)
assert(client.GetInfo(req).getInfoValue.getStringValue === "Kyuubi")
assert(client.GetInfo(req).getInfoValue.getStringValue === "Apache Kyuubi (Incubating)")
req.setInfoType(TGetInfoType.CLI_DBMS_NAME)
assert(client.GetInfo(req).getInfoValue.getStringValue === "Spark SQL")
assert(client.GetInfo(req).getInfoValue.getStringValue === "Apache Kyuubi (Incubating)")
req.setInfoType(TGetInfoType.CLI_MAX_COLUMN_NAME_LEN)
assert(client.GetInfo(req).getInfoValue.getLenValue === 128)
req.setInfoType(TGetInfoType.CLI_MAX_SCHEMA_NAME_LEN)

View File

@ -94,7 +94,7 @@ public class KyuubiBeeLine extends BeeLine {
new Object[] {
"Beeline",
pack.getImplementationVersion() == null ? "???" : pack.getImplementationVersion(),
"Apache Kyuubi",
"Apache Kyuubi (Incubating)",
});
}
}

View File

@ -123,20 +123,6 @@ public class KyuubiDatabaseConnection extends DatabaseConnection {
beeLine.handleException(e);
}
try {
getConnection().setAutoCommit(beeLine.getOpts().getAutoCommit());
// TODO: Setting autocommit should not generate an exception as long as it is set to false
// beeLine.autocommitStatus(getConnection());
} catch (Exception e) {
beeLine.handleException(e);
}
try {
beeLine.getCommands().isolation("isolation: " + beeLine.getOpts().getIsolation());
} catch (Exception e) {
beeLine.handleException(e);
}
return true;
}

View File

@ -182,7 +182,8 @@ class SessionsResourceSuite extends KyuubiFunSuite with RestFrontendTestHelper {
.request().get()
assert(200 == response.getStatus)
val sessions = response.readEntity(classOf[InfoDetail])
assert(sessions.infoType.equals("CLI_SERVER_NAME") && sessions.infoValue.equals("Kyuubi"))
assert(sessions.infoType.equals("CLI_SERVER_NAME") &&
sessions.infoValue.equals("Apache Kyuubi (Incubating)"))
// Invalid sessionHandleStr
val handle = "b88d6b56-d200-4bb6-bf0a-5da0ea572e11|0c4aad4e-ccf7-4abd-9305-943d4bfd2d9a|0"
response = webTarget.path(s"api/v1/sessions/$handle/info/13").request().get()