[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 <zhangshiming@cvte.com>
Signed-off-by: Cheng Pan <chengpan@apache.org>
This commit is contained in:
simon 2021-10-09 14:38:55 +08:00 committed by Cheng Pan
parent afb46ec152
commit 4f8f4d9c6b
No known key found for this signature in database
GPG Key ID: 8001952629BCC75D

View File

@ -121,7 +121,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()
}