beliefer commented on a change in pull request #29608:
URL: https://github.com/apache/spark/pull/29608#discussion_r482821868



##########
File path: 
sql/core/src/test/scala/org/apache/spark/sql/ExpressionsSchemaSuite.scala
##########
@@ -152,23 +152,37 @@ class ExpressionsSchemaSuite extends QueryTest with 
SharedSparkSession {
 
     val outputSize = outputs.size
     val headerSize = header.size
-    val expectedOutputs: Seq[QueryOutput] = {
+    val (expectedMissingExamples, expectedOutputs) = {
       val expectedGoldenOutput = fileToString(resultFile)
       val lines = expectedGoldenOutput.split("\n")
       val expectedSize = lines.size
 
       assert(expectedSize == outputSize + headerSize,
         s"Expected $expectedSize blocks in result file but got " +
-          s"${outputSize + headerSize}. Try regenerate the result files.")
+          s"${outputSize + headerSize}. Try regenerating the result files.")
 
-      Seq.tabulate(outputSize) { i =>
+      val numberOfQueries = lines(2).split(":")(1).trim.toInt
+      val numberOfMissingExamples = lines(3).split(":")(1).trim.toInt
+      val missingExamples = lines(4).split(":")(1).trim.split(",")
+      val expectedOutputs = Seq.tabulate(outputSize) { i =>
         val segments = lines(i + headerSize).split('|')
         QueryOutput(
           className = segments(1).trim,
           funcName = segments(2).trim,
           sql = segments(3).trim,
           schema = segments(4).trim)
       }
+
+      // Ensure consistency of the result file.
+      assert(numberOfQueries == expectedOutputs.size,

Review comment:
       I got it. Thanks! Could you put these assert on line 163, so that it 
looks clear




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to