From 1a9bf3600dbbff5862b366cc51cc3ee3d557eabd Mon Sep 17 00:00:00 2001 From: simon Date: Sat, 9 Oct 2021 14:38:55 +0800 Subject: [PATCH] [KYUUBI #1190] Enhance error log detection ### Why are the changes needed? When line2 is read, it does not contain `at` or `cause by`, so all of the following messages are discarded. #1190 ``` 2021-10-09 09:35:14.528 ERROR spark.SparkSQLEngine: Failed to instantiate SparkSession: org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient; org.apache.spark.sql.AnalysisException: org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient; at org.apache.spark.sql.hive.HiveExternalCatalog.withClient(HiveExternalCatalog.scala:113) at org.apache.spark.sql.hive.HiveExternalCatalog.databaseExists(HiveExternalCatalog.scala:225) at org.apache.spark.sql.internal.SharedState.externalCatalog$lzycompute(SharedState.scala:137) ``` ### _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/latest/develop_tools/testing.html#running-tests) locally before make a pull request Closes #1200 from simon824/fixut. Closes #1190 d239df0e [simon] codestyle 83cb7d83 [simon] fixut 2d399883 [simon] Merge remote-tracking branch 'upstream/master' 3d9c12d3 [simon] Merge remote-tracking branch 'upstream/master' 5b905dbd [simon] Merge remote-tracking branch 'upstream/master' Authored-by: simon Signed-off-by: Cheng Pan (cherry picked from commit 4f8f4d9c6b0b6da805d767dfb07534a906b0b2e1) Signed-off-by: Cheng Pan --- .../src/main/scala/org/apache/kyuubi/engine/ProcBuilder.scala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/ProcBuilder.scala b/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/ProcBuilder.scala index 6e48170e7..07b222f97 100644 --- a/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/ProcBuilder.scala +++ b/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/ProcBuilder.scala @@ -120,7 +120,9 @@ trait ProcBuilder { error = KyuubiSQLException(sb.toString() + s"\n See more: $engineLog") line = reader.readLine() while (sb.length < maxErrorSize && line != null && - (line.startsWith("\tat ") || line.startsWith("Caused by: "))) { + (containsIgnoreCase(line, "Exception:") || + line.startsWith("\tat ") || + line.startsWith("Caused by: "))) { sb.append("\n" + line) line = reader.readLine() }