This is an automated email from the ASF dual-hosted git repository.

bowenliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kyuubi.git


The following commit(s) were added to refs/heads/master by this push:
     new 0b1a0cb4f [KYUUBI #5183] Introducing profile scala-2.13 for 
development use
0b1a0cb4f is described below

commit 0b1a0cb4f27dcd386ca690b4380908ba5a62b98a
Author: liangbowen <[email protected]>
AuthorDate: Tue Aug 22 17:36:21 2023 +0800

    [KYUUBI #5183] Introducing profile scala-2.13 for development use
    
    ### _Why are the changes needed?_
    
    - introducing `scala-2.13` for development use only
    - adapt the common modules compilable on Scala 2.13, including
      - kyuubi-common
      - kyuubi-ctl
      - kyuubi-ha
    - use separate compile options for Scala 2.13 , skipping deprecated scala 
compiler option `-Yno-adapted-args`
    
    ### _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
    
    - [ ] [Run 
test](https://kyuubi.readthedocs.io/en/master/contributing/code/testing.html#running-tests)
 locally before make a pull request
    
    ### _Was this patch authored or co-authored using generative AI tooling?_
    
    Closes #5183 from bowenliang123/scala213-common.
    
    Closes #5183
    
    1e65a5d03 [Bowen Liang] Align scala 2.13 version with Spark to 2.13.8
    0003c8bed [liangbowen] duplicate scala-maven-plugin configs in profile
    8b448a5f0 [liangbowen] 2.13.11
    36d2284c4 [liangbowen] comment
    28b515a0c [liangbowen] comment
    865c5e55b [liangbowen] update
    52e381200 [liangbowen] ensure kyuubi-ctl module compilable on scala 2.13
    70dbc7ae2 [liangbowen] ensure kyuubi-ha module compilable on scala 2.13
    84c1e4b4d [liangbowen] ensure kyuubi-common module compilable on scala 2.13
    e116d77f5 [liangbowen] skip deprecated compiler option "-Yno-adapted-args" 
in 2.13
    26c27a2ee [liangbowen] introduce new profile scala-2.13
    
    Lead-authored-by: liangbowen <[email protected]>
    Co-authored-by: Bowen Liang <[email protected]>
    Signed-off-by: liangbowen <[email protected]>
---
 .../org/apache/kyuubi/KyuubiSQLException.scala     |  4 +-
 .../org/apache/kyuubi/config/KyuubiConf.scala      |  2 +-
 .../LdapAuthenticationProviderImplSuite.scala      |  2 +-
 .../ctl/cmd/delete/DeleteServerCommand.scala       |  2 +-
 .../ha/client/etcd/EtcdDiscoveryClient.scala       |  8 ++--
 .../zookeeper/ZookeeperDiscoveryClient.scala       | 30 ++++---------
 pom.xml                                            | 51 ++++++++++++++++++++++
 7 files changed, 68 insertions(+), 31 deletions(-)

diff --git 
a/kyuubi-common/src/main/scala/org/apache/kyuubi/KyuubiSQLException.scala 
b/kyuubi-common/src/main/scala/org/apache/kyuubi/KyuubiSQLException.scala
index c9fd8203c..570ee6d38 100644
--- a/kyuubi-common/src/main/scala/org/apache/kyuubi/KyuubiSQLException.scala
+++ b/kyuubi-common/src/main/scala/org/apache/kyuubi/KyuubiSQLException.scala
@@ -156,7 +156,7 @@ object KyuubiSQLException {
     (i1, i2, i3)
   }
 
-  def toCause(details: Seq[String]): Throwable = {
+  def toCause(details: Iterable[String]): Throwable = {
     var ex: Throwable = null
     if (details != null && details.nonEmpty) {
       val head = details.head
@@ -172,7 +172,7 @@ object KyuubiSQLException {
         val lineNum = line.substring(i3 + 1).toInt
         new StackTraceElement(clzName, methodName, fileName, lineNum)
       }
-      ex = newInstance(exClz, msg, toCause(details.slice(length + 2, 
details.length)))
+      ex = newInstance(exClz, msg, toCause(details.slice(length + 2, 
details.size)))
       ex.setStackTrace(stackTraceElements.toArray)
     }
     ex
diff --git 
a/kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala 
b/kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala
index b4102d267..515ffbc34 100644
--- a/kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala
+++ b/kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala
@@ -42,7 +42,7 @@ case class KyuubiConf(loadSysDefault: Boolean = true) extends 
Logging {
   }
 
   if (loadSysDefault) {
-    val fromSysDefaults = 
Utils.getSystemProperties.filterKeys(_.startsWith("kyuubi."))
+    val fromSysDefaults = 
Utils.getSystemProperties.filterKeys(_.startsWith("kyuubi.")).toMap
     loadFromMap(fromSysDefaults)
   }
 
diff --git 
a/kyuubi-common/src/test/scala/org/apache/kyuubi/service/authentication/LdapAuthenticationProviderImplSuite.scala
 
b/kyuubi-common/src/test/scala/org/apache/kyuubi/service/authentication/LdapAuthenticationProviderImplSuite.scala
index d822408b9..f10bf7ce2 100644
--- 
a/kyuubi-common/src/test/scala/org/apache/kyuubi/service/authentication/LdapAuthenticationProviderImplSuite.scala
+++ 
b/kyuubi-common/src/test/scala/org/apache/kyuubi/service/authentication/LdapAuthenticationProviderImplSuite.scala
@@ -47,7 +47,7 @@ class LdapAuthenticationProviderImplSuite extends 
WithLdapServer {
   }
 
   test("authenticateGivenBlankOrNullPassword") {
-    Seq("", "\0", null).foreach { pwd =>
+    Seq("", "\u0000", null).foreach { pwd =>
       auth = new LdapAuthenticationProviderImpl(conf, new LdapSearchFactory)
       val thrown = intercept[AuthenticationException] {
         auth.authenticate("user", pwd)
diff --git 
a/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/cmd/delete/DeleteServerCommand.scala
 
b/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/cmd/delete/DeleteServerCommand.scala
index 197b78645..1f4d67ee6 100644
--- 
a/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/cmd/delete/DeleteServerCommand.scala
+++ 
b/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/cmd/delete/DeleteServerCommand.scala
@@ -24,7 +24,7 @@ import 
org.apache.kyuubi.ha.client.DiscoveryClientProvider.withDiscoveryClient
 import org.apache.kyuubi.ha.client.ServiceNodeInfo
 
 class DeleteServerCommand(cliConfig: CliConfig) extends 
DeleteCommand(cliConfig) {
-  override def doRun(): Seq[ServiceNodeInfo] = {
+  override def doRun(): Iterable[ServiceNodeInfo] = {
     withDiscoveryClient(conf) { discoveryClient =>
       val znodeRoot = CtlUtils.getZkServerNamespace(conf, normalizedCliConfig)
       val hostPortOpt =
diff --git 
a/kyuubi-ha/src/main/scala/org/apache/kyuubi/ha/client/etcd/EtcdDiscoveryClient.scala
 
b/kyuubi-ha/src/main/scala/org/apache/kyuubi/ha/client/etcd/EtcdDiscoveryClient.scala
index 548628a88..d979804f4 100644
--- 
a/kyuubi-ha/src/main/scala/org/apache/kyuubi/ha/client/etcd/EtcdDiscoveryClient.scala
+++ 
b/kyuubi-ha/src/main/scala/org/apache/kyuubi/ha/client/etcd/EtcdDiscoveryClient.scala
@@ -358,11 +358,11 @@ class EtcdDiscoveryClient(conf: KyuubiConf) extends 
DiscoveryClient {
         client.getLeaseClient.keepAlive(
           leaseId,
           new StreamObserver[LeaseKeepAliveResponse] {
-            override def onNext(v: LeaseKeepAliveResponse): Unit = Unit // do 
nothing
+            override def onNext(v: LeaseKeepAliveResponse): Unit = () // do 
nothing
 
-            override def onError(throwable: Throwable): Unit = Unit // do 
nothing
+            override def onError(throwable: Throwable): Unit = () // do nothing
 
-            override def onCompleted(): Unit = Unit // do nothing
+            override def onCompleted(): Unit = () // do nothing
           })
         client.getKVClient.put(
           ByteSequence.from(realPath.getBytes()),
@@ -388,7 +388,7 @@ class EtcdDiscoveryClient(conf: KyuubiConf) extends 
DiscoveryClient {
     override def onError(throwable: Throwable): Unit =
       throw new KyuubiException(throwable.getMessage, throwable.getCause)
 
-    override def onCompleted(): Unit = Unit
+    override def onCompleted(): Unit = ()
   }
 }
 
diff --git 
a/kyuubi-ha/src/main/scala/org/apache/kyuubi/ha/client/zookeeper/ZookeeperDiscoveryClient.scala
 
b/kyuubi-ha/src/main/scala/org/apache/kyuubi/ha/client/zookeeper/ZookeeperDiscoveryClient.scala
index 0127f2df1..2db7d89d6 100644
--- 
a/kyuubi-ha/src/main/scala/org/apache/kyuubi/ha/client/zookeeper/ZookeeperDiscoveryClient.scala
+++ 
b/kyuubi-ha/src/main/scala/org/apache/kyuubi/ha/client/zookeeper/ZookeeperDiscoveryClient.scala
@@ -26,38 +26,24 @@ import scala.collection.JavaConverters._
 
 import com.google.common.annotations.VisibleForTesting
 
-import org.apache.kyuubi.KYUUBI_VERSION
-import org.apache.kyuubi.KyuubiException
-import org.apache.kyuubi.KyuubiSQLException
-import org.apache.kyuubi.Logging
+import org.apache.kyuubi.{KYUUBI_VERSION, KyuubiException, KyuubiSQLException, 
Logging}
 import org.apache.kyuubi.config.KyuubiConf
 import org.apache.kyuubi.config.KyuubiReservedKeys.KYUUBI_ENGINE_ID
-import org.apache.kyuubi.ha.HighAvailabilityConf.HA_ENGINE_REF_ID
-import org.apache.kyuubi.ha.HighAvailabilityConf.HA_ZK_NODE_TIMEOUT
-import org.apache.kyuubi.ha.HighAvailabilityConf.HA_ZK_PUBLISH_CONFIGS
-import org.apache.kyuubi.ha.client.DiscoveryClient
-import org.apache.kyuubi.ha.client.ServiceDiscovery
-import org.apache.kyuubi.ha.client.ServiceNodeInfo
-import 
org.apache.kyuubi.ha.client.zookeeper.ZookeeperClientProvider.buildZookeeperClient
-import 
org.apache.kyuubi.ha.client.zookeeper.ZookeeperClientProvider.getGracefulStopThreadDelay
+import org.apache.kyuubi.ha.HighAvailabilityConf.{HA_ENGINE_REF_ID, 
HA_ZK_NODE_TIMEOUT, HA_ZK_PUBLISH_CONFIGS}
+import org.apache.kyuubi.ha.client.{DiscoveryClient, ServiceDiscovery, 
ServiceNodeInfo}
+import 
org.apache.kyuubi.ha.client.zookeeper.ZookeeperClientProvider.{buildZookeeperClient,
 getGracefulStopThreadDelay}
 import 
org.apache.kyuubi.ha.client.zookeeper.ZookeeperDiscoveryClient.connectionChecker
 import org.apache.kyuubi.shaded.curator.framework.CuratorFramework
 import org.apache.kyuubi.shaded.curator.framework.recipes.atomic.{AtomicValue, 
DistributedAtomicInteger}
 import 
org.apache.kyuubi.shaded.curator.framework.recipes.locks.InterProcessSemaphoreMutex
 import org.apache.kyuubi.shaded.curator.framework.recipes.nodes.PersistentNode
-import org.apache.kyuubi.shaded.curator.framework.state.ConnectionState
-import 
org.apache.kyuubi.shaded.curator.framework.state.ConnectionState.CONNECTED
-import org.apache.kyuubi.shaded.curator.framework.state.ConnectionState.LOST
-import 
org.apache.kyuubi.shaded.curator.framework.state.ConnectionState.RECONNECTED
-import org.apache.kyuubi.shaded.curator.framework.state.ConnectionStateListener
+import org.apache.kyuubi.shaded.curator.framework.state.{ConnectionState, 
ConnectionStateListener}
+import 
org.apache.kyuubi.shaded.curator.framework.state.ConnectionState.{CONNECTED, 
LOST, RECONNECTED}
 import org.apache.kyuubi.shaded.curator.retry.RetryForever
 import org.apache.kyuubi.shaded.curator.utils.ZKPaths
-import org.apache.kyuubi.shaded.zookeeper.CreateMode
+import org.apache.kyuubi.shaded.zookeeper.{CreateMode, KeeperException, 
WatchedEvent, Watcher}
 import org.apache.kyuubi.shaded.zookeeper.CreateMode.PERSISTENT
-import org.apache.kyuubi.shaded.zookeeper.KeeperException
 import org.apache.kyuubi.shaded.zookeeper.KeeperException.NodeExistsException
-import org.apache.kyuubi.shaded.zookeeper.WatchedEvent
-import org.apache.kyuubi.shaded.zookeeper.Watcher
 import org.apache.kyuubi.util.ThreadUtils
 
 class ZookeeperDiscoveryClient(conf: KyuubiConf) extends DiscoveryClient {
@@ -226,7 +212,7 @@ class ZookeeperDiscoveryClient(conf: KyuubiConf) extends 
DiscoveryClient {
         info(s"Get service instance:$instance$engineIdStr and 
version:${version.getOrElse("")} " +
           s"under $namespace")
         ServiceNodeInfo(namespace, p, host, port, version, engineRefId, 
attributes)
-      }
+      }.toSeq
     } catch {
       case _: Exception if silent => Nil
       case e: Exception =>
diff --git a/pom.xml b/pom.xml
index fe418206a..ac85961fe 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2124,6 +2124,57 @@
             </properties>
         </profile>
 
+        <!-- For development only, not generally applicable for all modules -->
+        <profile>
+            <id>scala-2.13</id>
+            <properties>
+                <scala.binary.version>2.13</scala.binary.version>
+                <scala.version>2.13.8</scala.version>
+            </properties>
+            <build>
+                <pluginManagement>
+                    <plugins>
+                        <plugin>
+                            <groupId>net.alchim31.maven</groupId>
+                            <artifactId>scala-maven-plugin</artifactId>
+                            <configuration>
+                                <scalaVersion>${scala.version}</scalaVersion>
+                                <recompileMode>incremental</recompileMode>
+                                <args>
+                                    <arg>-unchecked</arg>
+                                    <arg>-deprecation</arg>
+                                    <arg>-feature</arg>
+                                    <arg>-explaintypes</arg>
+                                    
<arg>-P:silencer:globalFilters=.*deprecated.*</arg>
+                                    <arg>-P:silencer:globalFilters=.*Could not 
find any member to link for.*</arg>
+                                    <arg>-P:silencer:globalFilters=.*undefined 
in comment for class.*</arg>
+                                    <arg>-Xfatal-warnings</arg>
+                                    <arg>-Ywarn-unused:imports</arg>
+                                </args>
+                                <jvmArgs>
+                                    <jvmArg>-Xms1024m</jvmArg>
+                                    <jvmArg>-Xmx1024m</jvmArg>
+                                    
<jvmArg>-XX:ReservedCodeCacheSize=512M</jvmArg>
+                                </jvmArgs>
+                                <javacArgs>
+                                    
<javacArg>-Xlint:all,-serial,-path,-try,-processing</javacArg>
+                                </javacArgs>
+                                <compilerPlugins>
+                                    <compilerPlugin>
+                                        <groupId>com.github.ghik</groupId>
+                                        
<artifactId>silencer-plugin_${scala.version}</artifactId>
+                                        
<version>${maven.plugin.silencer.version}</version>
+                                    </compilerPlugin>
+                                </compilerPlugins>
+                                <!-- only skipping `scala:doc-jar` -->
+                                <skip>${maven.scaladoc.skip}</skip>
+                            </configuration>
+                        </plugin>
+                    </plugins>
+                </pluginManagement>
+            </build>
+        </profile>
+
         <profile>
             <id>spark-3.1</id>
             <modules>

Reply via email to