From 94d60ea505800bf61954f8d69ff772f569a83700 Mon Sep 17 00:00:00 2001 From: hongdongdong Date: Mon, 30 Aug 2021 16:55:03 +0800 Subject: [PATCH] [KYUUBI #1000] Use underscore instead hyphen in path ### _Why are the changes needed?_ 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 Signed-off-by: ulysses-you --- .../kyuubi/engine/spark/events/EventLoggingServiceSuite.scala | 2 +- .../src/main/scala/org/apache/kyuubi/events/KyuubiEvent.scala | 2 +- .../org/apache/kyuubi/events/EventLoggingServiceSuite.scala | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/externals/kyuubi-spark-sql-engine/src/test/scala/org/apache/kyuubi/engine/spark/events/EventLoggingServiceSuite.scala b/externals/kyuubi-spark-sql-engine/src/test/scala/org/apache/kyuubi/engine/spark/events/EventLoggingServiceSuite.scala index 8d912a30e..ae72b9db3 100644 --- a/externals/kyuubi-spark-sql-engine/src/test/scala/org/apache/kyuubi/engine/spark/events/EventLoggingServiceSuite.scala +++ b/externals/kyuubi-spark-sql-engine/src/test/scala/org/apache/kyuubi/engine/spark/events/EventLoggingServiceSuite.scala @@ -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) => diff --git a/kyuubi-common/src/main/scala/org/apache/kyuubi/events/KyuubiEvent.scala b/kyuubi-common/src/main/scala/org/apache/kyuubi/events/KyuubiEvent.scala index 39a59c573..24aa75b20 100644 --- a/kyuubi-common/src/main/scala/org/apache/kyuubi/events/KyuubiEvent.scala +++ b/kyuubi-common/src/main/scala/org/apache/kyuubi/events/KyuubiEvent.scala @@ -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) } diff --git a/kyuubi-server/src/test/scala/org/apache/kyuubi/events/EventLoggingServiceSuite.scala b/kyuubi-server/src/test/scala/org/apache/kyuubi/events/EventLoggingServiceSuite.scala index b8ea732eb..c38e5e533 100644 --- a/kyuubi-server/src/test/scala/org/apache/kyuubi/events/EventLoggingServiceSuite.scala +++ b/kyuubi-server/src/test/scala/org/apache/kyuubi/events/EventLoggingServiceSuite.scala @@ -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 =>