This is an automated email from the ASF dual-hosted git repository. peacewong pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/linkis.git
commit f02ee0c330f2cf9a0540f58c65b1f14c96724916 Author: peacewong <[email protected]> AuthorDate: Tue Oct 10 21:09:50 2023 +0800 Result set optimization 1. Double supports NAN 2. String supports \n \t characters --- .../linkis/engineplugin/spark/executor/SQLSession.scala | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/linkis-engineconn-plugins/spark/src/main/scala/org/apache/linkis/engineplugin/spark/executor/SQLSession.scala b/linkis-engineconn-plugins/spark/src/main/scala/org/apache/linkis/engineplugin/spark/executor/SQLSession.scala index a43e285f2..77fe9ca97 100644 --- a/linkis-engineconn-plugins/spark/src/main/scala/org/apache/linkis/engineplugin/spark/executor/SQLSession.scala +++ b/linkis-engineconn-plugins/spark/src/main/scala/org/apache/linkis/engineplugin/spark/executor/SQLSession.scala @@ -146,7 +146,7 @@ object SQLSession extends Logging { ) } val taken = ByteTimeUtils.msDurationToString(System.currentTimeMillis - startTime) - logger.warn(s"Time taken: ${taken}, Fetched $index row(s).") + logger.info(s"Time taken: ${taken}, Fetched $index row(s).") // to register TempTable // Utils.tryAndErrorMsg(CSTableRegister.registerTempTable(engineExecutorContext, writer, alias, columns))("Failed to register tmp table:") engineExecutionContext.appendStdout( @@ -178,7 +178,7 @@ object SQLSession extends Logging { } .mkString("{", ",", "}") case (seq: Seq[_], ArrayType(typ, _)) => - seq.map(v => (v, typ)).map(toHiveStructString).mkString("[", ",", "]") + seq.map(v => (v, typ)).map(toHiveStructString).mkString("[\"", "\",\"", "\"]") case (map: Map[_, _], MapType(kType, vType, _)) => map .map { case (key, value) => @@ -188,7 +188,7 @@ object SQLSession extends Logging { .sorted .mkString("{", ",", "}") case (null, _) => "null" - case (str: String, StringType) => str.replaceAll("\n|\t", " ") + // case (str: String, StringType) => str.replaceAll("\n|\t", " ") case (double: Double, DoubleType) => nf.format(double) case (decimal: java.math.BigDecimal, DecimalType()) => formatDecimal(decimal) case (other: Any, tpe) => other.toString @@ -203,7 +203,7 @@ object SQLSession extends Logging { } .mkString("{", ",", "}") case (seq: Seq[_], ArrayType(typ, _)) => - seq.map(v => (v, typ)).map(toHiveStructString).mkString("[", ",", "]") + seq.map(v => (v, typ)).map(toHiveStructString).mkString("[\"", "\",\"", "\"]") case (map: Map[_, _], MapType(kType, vType, _)) => map .map { case (key, value) => @@ -213,8 +213,13 @@ object SQLSession extends Logging { .sorted .mkString("{", ",", "}") - case (str: String, StringType) => str.replaceAll("\n|\t", " ") - case (double: Double, DoubleType) => nf.format(double) + // case (str: String, StringType) => str.replaceAll("\n|\t", " ") + case (double: Double, DoubleType) => + if (double.isNaN) { + "NaN" + } else { + nf.format(double) + } case (decimal: java.math.BigDecimal, DecimalType()) => formatDecimal(decimal) case (other: Any, tpe) => other.toString case _ => null --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
