You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@linkis.apache.org by ca...@apache.org on 2022/09/07 15:47:44 UTC

[incubator-linkis] branch dev-1.3.1 updated: feat: scala code format alarm clear in linkis-engineplugin-elasticsearch (#3236)

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

casion pushed a commit to branch dev-1.3.1
in repository https://gitbox.apache.org/repos/asf/incubator-linkis.git


The following commit(s) were added to refs/heads/dev-1.3.1 by this push:
     new 08614200b feat: scala code format alarm clear in linkis-engineplugin-elasticsearch (#3236)
08614200b is described below

commit 08614200bd62c6fc6da854df950bb3c2e35571c5
Author: ruY <43...@users.noreply.github.com>
AuthorDate: Wed Sep 7 23:47:39 2022 +0800

    feat: scala code format alarm clear in linkis-engineplugin-elasticsearch (#3236)
---
 .../engineplugin/elasticsearch/executer/client/EsClientFactory.scala  | 3 +--
 .../engineplugin/elasticsearch/executer/client/ResponseHandler.scala  | 4 +++-
 .../executer/client/impl/ElasticSearchExecutorImpl.scala              | 3 ++-
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/linkis-engineconn-plugins/elasticsearch/src/main/scala/org/apache/linkis/engineplugin/elasticsearch/executer/client/EsClientFactory.scala b/linkis-engineconn-plugins/elasticsearch/src/main/scala/org/apache/linkis/engineplugin/elasticsearch/executer/client/EsClientFactory.scala
index ccde6fd84..eef332420 100644
--- a/linkis-engineconn-plugins/elasticsearch/src/main/scala/org/apache/linkis/engineplugin/elasticsearch/executer/client/EsClientFactory.scala
+++ b/linkis-engineconn-plugins/elasticsearch/src/main/scala/org/apache/linkis/engineplugin/elasticsearch/executer/client/EsClientFactory.scala
@@ -172,12 +172,11 @@ object EsClientFactory {
       && StringUtils.isNotBlank(password)
   ) {
     cluster.foreach {
-      case (host, port) => {
+      case (host, port) =>
         credentialsProvider.setCredentials(
           new AuthScope(host, port, AuthScope.ANY_REALM, AuthScope.ANY_SCHEME),
           new UsernamePasswordCredentials(username, password)
         )
-      }
       case _ =>
     }
   }
diff --git a/linkis-engineconn-plugins/elasticsearch/src/main/scala/org/apache/linkis/engineplugin/elasticsearch/executer/client/ResponseHandler.scala b/linkis-engineconn-plugins/elasticsearch/src/main/scala/org/apache/linkis/engineplugin/elasticsearch/executer/client/ResponseHandler.scala
index fc19dc4d4..2b3317624 100644
--- a/linkis-engineconn-plugins/elasticsearch/src/main/scala/org/apache/linkis/engineplugin/elasticsearch/executer/client/ResponseHandler.scala
+++ b/linkis-engineconn-plugins/elasticsearch/src/main/scala/org/apache/linkis/engineplugin/elasticsearch/executer/client/ResponseHandler.scala
@@ -21,6 +21,8 @@ import org.apache.linkis.common.utils.Logging
 import org.apache.linkis.engineplugin.elasticsearch.executer.client.impl.ResponseHandlerImpl
 import org.apache.linkis.storage.domain._
 
+import java.util.Locale
+
 import com.fasterxml.jackson.databind.{JsonNode, ObjectMapper}
 import com.fasterxml.jackson.databind.node.JsonNodeType
 import com.fasterxml.jackson.dataformat.cbor.CBORFactory
@@ -61,7 +63,7 @@ object ResponseHandler {
     case _ => StringType
   }
 
-  def getNodeTypeByEsType(estype: String): DataType = estype.toLowerCase match {
+  def getNodeTypeByEsType(estype: String): DataType = estype.toLowerCase(Locale.getDefault) match {
     case "long" | "integer" | "short" | "byte" | "double" | "float" | "half_float" |
         "scaled_float" =>
       DecimalType
diff --git a/linkis-engineconn-plugins/elasticsearch/src/main/scala/org/apache/linkis/engineplugin/elasticsearch/executer/client/impl/ElasticSearchExecutorImpl.scala b/linkis-engineconn-plugins/elasticsearch/src/main/scala/org/apache/linkis/engineplugin/elasticsearch/executer/client/impl/ElasticSearchExecutorImpl.scala
index e1f35a263..7237145d5 100644
--- a/linkis-engineconn-plugins/elasticsearch/src/main/scala/org/apache/linkis/engineplugin/elasticsearch/executer/client/impl/ElasticSearchExecutorImpl.scala
+++ b/linkis-engineconn-plugins/elasticsearch/src/main/scala/org/apache/linkis/engineplugin/elasticsearch/executer/client/impl/ElasticSearchExecutorImpl.scala
@@ -40,6 +40,7 @@ import org.apache.linkis.server.JMap
 import org.apache.linkis.storage.utils.StorageUtils
 
 import java.util
+import java.util.Locale
 import java.util.concurrent.CountDownLatch
 
 import org.elasticsearch.client.{Cancellable, Response, ResponseListener}
@@ -54,7 +55,7 @@ class ElasticSearchExecutorImpl(runType: String, properties: util.Map[String, St
   override def open: Unit = {
     this.client = EsClientFactory.getRestClient(properties)
     this.user = properties.getOrDefault(TaskConstant.UMUSER, StorageUtils.getJvmUser)
-    runType.trim.toLowerCase match {
+    runType.trim.toLowerCase(Locale.getDefault) match {
       case "essql" | "sql" =>
         properties.putIfAbsent(
           ElasticSearchConfiguration.ES_HTTP_ENDPOINT.key,


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@linkis.apache.org
For additional commands, e-mail: commits-help@linkis.apache.org