HyukjinKwon commented on a change in pull request #26768:
[SPARK-30141][SQL][TESTS] Fix QueryTest.checkAnswer usage
URL: https://github.com/apache/spark/pull/26768#discussion_r354716905
##########
File path:
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/binaryfile/BinaryFileFormatSuite.scala
##########
@@ -352,15 +352,24 @@ class BinaryFileFormatSuite extends QueryTest with
SharedSparkSession {
.select(CONTENT)
}
val expected = Seq(Row(content))
- QueryTest.checkAnswer(readContent(), expected)
+ QueryTest.checkAnswer(readContent(), expected) match {
+ case Some(errorMessage) => fail(errorMessage)
+ case None =>
+ }
withSQLConf(SOURCES_BINARY_FILE_MAX_LENGTH.key ->
content.length.toString) {
- QueryTest.checkAnswer(readContent(), expected)
+ QueryTest.checkAnswer(readContent(), expected) match {
+ case Some(errorMessage) => fail(errorMessage)
+ case None =>
+ }
}
// Disable read. If the implementation attempts to read, the exception
would be different.
file.setReadable(false)
val caught = intercept[SparkException] {
withSQLConf(SOURCES_BINARY_FILE_MAX_LENGTH.key -> (content.length -
1).toString) {
- QueryTest.checkAnswer(readContent(), expected)
+ QueryTest.checkAnswer(readContent(), expected) match {
Review comment:
Can we ..
1. make `QueryTest.checkAnswer` private so that it can only be called in
its companion class `QueryTest`
2. and avoid to call `checkAnswer` in the `QueryTest` object in the tests
?
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]