From f796aadb8f971c4cb55fdc008575cde7a23ca8a3 Mon Sep 17 00:00:00 2001 From: Liang-Chi Hsieh Date: Thu, 22 Feb 2024 13:36:22 -0800 Subject: [PATCH] test: Expose thrown exception when executing query in CometTPCHQuerySuite --- .../org/apache/spark/sql/CometTPCHQuerySuite.scala | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/spark/src/test/scala/org/apache/spark/sql/CometTPCHQuerySuite.scala b/spark/src/test/scala/org/apache/spark/sql/CometTPCHQuerySuite.scala index 372a4ccf7..2264635d8 100644 --- a/spark/src/test/scala/org/apache/spark/sql/CometTPCHQuerySuite.scala +++ b/spark/src/test/scala/org/apache/spark/sql/CometTPCHQuerySuite.scala @@ -173,7 +173,15 @@ class CometTPCHQuerySuite extends QueryTest with CometTPCBase with SQLQueryTestH (segments(1).trim, segments(2).replaceAll("\\s+$", "")) } - assertResult(expectedSchema, s"Schema did not match\n$queryString") { + // Expose thrown exception when executing the query + val notMatchedSchemaOutput = if (schema == emptySchema) { + // There might be exception. See `handleExceptions`. + s"Schema did not match\n$queryString\nOutput/Exception: $outputString" + } else { + s"Schema did not match\n$queryString" + } + + assertResult(expectedSchema, notMatchedSchemaOutput) { schema } if (shouldSortResults) {