This is an automated email from the ASF dual-hosted git repository. peacewong pushed a commit to branch dev-1.2.0 in repository https://gitbox.apache.org/repos/asf/incubator-linkis.git
commit 74d2e388732f5bcf406a99abf6427d8176ac6eac Author: casionone <[email protected]> AuthorDate: Mon Jul 25 17:12:45 2022 +0800 add wds.linkis.engineconn.max.free.time=0 for presto engine --- .../main/resources/linkis-engineconn.properties | 1 + .../presto/executer/PrestoEngineConnExecutor.scala | 3 +- .../engineplugin/presto/utils/SqlCodeParser.scala | 65 ---------------------- 3 files changed, 2 insertions(+), 67 deletions(-) diff --git a/linkis-engineconn-plugins/presto/src/main/resources/linkis-engineconn.properties b/linkis-engineconn-plugins/presto/src/main/resources/linkis-engineconn.properties index d2497cda3..9cf9bce07 100644 --- a/linkis-engineconn-plugins/presto/src/main/resources/linkis-engineconn.properties +++ b/linkis-engineconn-plugins/presto/src/main/resources/linkis-engineconn.properties @@ -20,3 +20,4 @@ wds.linkis.engineconn.plugin.default.class=org.apache.linkis.engineplugin.presto wds.linkis.engineconn.support.parallelism=true +wds.linkis.engineconn.max.free.time=0 \ No newline at end of file diff --git a/linkis-engineconn-plugins/presto/src/main/scala/org/apache/linkis/engineplugin/presto/executer/PrestoEngineConnExecutor.scala b/linkis-engineconn-plugins/presto/src/main/scala/org/apache/linkis/engineplugin/presto/executer/PrestoEngineConnExecutor.scala index 220e113b8..d30ca92cf 100644 --- a/linkis-engineconn-plugins/presto/src/main/scala/org/apache/linkis/engineplugin/presto/executer/PrestoEngineConnExecutor.scala +++ b/linkis-engineconn-plugins/presto/src/main/scala/org/apache/linkis/engineplugin/presto/executer/PrestoEngineConnExecutor.scala @@ -36,7 +36,6 @@ import org.apache.linkis.engineconn.core.EngineConnObject import org.apache.linkis.engineplugin.presto.conf.PrestoConfiguration._ import org.apache.linkis.engineplugin.presto.conf.PrestoEngineConf import org.apache.linkis.engineplugin.presto.exception.{PrestoClientException, PrestoStateInvalidException} -import org.apache.linkis.engineplugin.presto.utils.SqlCodeParser import org.apache.linkis.governance.common.paser.SQLCodeParser import org.apache.linkis.manager.common.entity.resource.{CommonNodeResource, LoadResource, NodeResource} import org.apache.linkis.manager.engineplugin.common.conf.EngineConnPluginConf @@ -80,7 +79,7 @@ class PrestoEngineConnExecutor(override val outputPrintLimit: Int, val id: Int) } override def executeLine(engineExecutorContext: EngineExecutionContext, code: String): ExecuteResponse = { - val realCode = SqlCodeParser.parse(code.trim) + val realCode = code.trim logger.info(s"presto client begins to run psql code:\n $realCode") val taskId = engineExecutorContext.getJobId.get diff --git a/linkis-engineconn-plugins/presto/src/main/scala/org/apache/linkis/engineplugin/presto/utils/SqlCodeParser.scala b/linkis-engineconn-plugins/presto/src/main/scala/org/apache/linkis/engineplugin/presto/utils/SqlCodeParser.scala deleted file mode 100644 index 6b16a72e0..000000000 --- a/linkis-engineconn-plugins/presto/src/main/scala/org/apache/linkis/engineplugin/presto/utils/SqlCodeParser.scala +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.linkis.engineplugin.presto.utils - -import org.apache.linkis.engineplugin.presto.conf.PrestoConfiguration -import org.apache.commons.lang3.StringUtils - -import scala.collection.mutable.ArrayBuffer - - -object SqlCodeParser { - val separator = ";" - val subCol = "SELECT \"SUBCOL\" AS \"COL\" FROM ( SELECT 1 AS \"SUBCOL\" ) \"SUBQUERY\" GROUP BY \"COL\"" - - def parse(code: String): String = { - val codeBuffer = new ArrayBuffer[String]() - - def appendStatement(sqlStatement: String): Unit = { - codeBuffer.append(sqlStatement) - } - - if (StringUtils.contains(code, separator)) { - StringUtils.split(code, ";").foreach { - case s if StringUtils.isBlank(s) => - case s => appendStatement(s.replaceAll("`", "\"")); - } - } else { - code match { - case s if StringUtils.isBlank(s) => - case s => - val pattern = """`[a-zA-Z_0-9 ]+`""".r.unanchored - var tmpS = s - pattern.findAllIn(s).foreach(a => { - val s1 = a.replaceAll("\\s*", "") - tmpS = tmpS.replace(a, s1) - }) - appendStatement(tmpS.replaceAll("`", "\"")); - } - } - - if(codeBuffer.size == 1) { - var code = codeBuffer(0) - code = code.trim.replaceAll("\n", " ").replaceAll("\\s+", " ") - if(code.contains(subCol)) { - codeBuffer(0) = "SELECT 1" - } - } - - codeBuffer.toArray.head - } -} --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
