[KYUUBI #1000] Use underscore instead hyphen in path

<!--
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.
-->
Use underscore instead hyphen in path, friendly to sql.

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

- [ ] Add screenshots for manual tests if appropriate

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

Closes #1000 from hddong/fix-underscore.

Closes #1000

8b3459a5 [hongdongdong] Use underscore instead hyphen in path

Authored-by: hongdongdong <hongdongdong@cmss.chinamobile.com>
Signed-off-by: ulysses-you <ulyssesyou18@gmail.com>
This commit is contained in:
hongdongdong 2021-08-30 16:55:03 +08:00 committed by ulysses-you
parent d49f8bf06d
commit 94d60ea505
3 changed files with 4 additions and 4 deletions

View File

@ -94,7 +94,7 @@ class EventLoggingServiceSuite extends WithSparkSQLEngine with JDBCTestUtils {
test("statementEvent: generate, dump and query") {
val statementEventPath = Paths.get(
logRoot.toString, "spark-statement", s"day=$currentDate", engine.engineId + ".json")
logRoot.toString, "spark_statement", s"day=$currentDate", engine.engineId + ".json")
val sql = "select timestamp'2021-06-01'"
withSessionHandle { (client, handle) =>

View File

@ -22,7 +22,7 @@ import java.util.Locale
trait KyuubiEvent extends Product {
final lazy val eventType: String = {
this.getClass.getSimpleName.stripSuffix("Event")
.replaceAll("(.)([A-Z])", "$1-$2")
.replaceAll("(.)([A-Z])", "$1_$2")
.toLowerCase(Locale.ROOT)
}

View File

@ -43,9 +43,9 @@ class EventLoggingServiceSuite extends WithKyuubiServer with JDBCTestUtils {
test("statementEvent: generate, dump and query") {
val hostName = InetAddress.getLocalHost.getCanonicalHostName
val serverStatementEventPath =
Paths.get(logRoot.toString, "kyuubi-statement", s"day=$currentDate", s"server-$hostName.json")
Paths.get(logRoot.toString, "kyuubi_statement", s"day=$currentDate", s"server-$hostName.json")
val engineStatementEventPath =
Paths.get(logRoot.toString, "spark-statement", s"day=$currentDate", "*.json")
Paths.get(logRoot.toString, "spark_statement", s"day=$currentDate", "*.json")
val sql = "select timestamp'2021-06-01'"
withJdbcStatement() { statement =>