[SPARK-4274] [SQL] Print informative message while logical plan analyzing failed in test

See
```
protected abstract class QueryExecution {
...
    override def toString: String =
      s"""== Parsed Logical Plan ==
         |${stringOrError(logical)}
         |== Analyzed Logical Plan ==
         |${stringOrError(analyzed)}
         |== Optimized Logical Plan ==
         |${stringOrError(optimizedPlan)}
         |== Physical Plan ==
         |${stringOrError(executedPlan)}
         |Code Generation: ${executedPlan.codegenEnabled}
         |== RDD ==
      """.stripMargin.trim
  }
```
`logical`, `analyzed` etc. will be computed(which probably cause exception) before passing into `stringOrError`, not happen inside of `stringOrError`.

Or you think we'd better to fix the `toString` here?