anchovYu commented on a change in pull request #35707:
URL: https://github.com/apache/spark/pull/35707#discussion_r821183467
##########
File path:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/AnalysisTest.scala
##########
@@ -200,11 +200,15 @@ trait AnalysisTest extends PlanTest {
}
}
- protected def interceptParseException(
- parser: String => Any)(sqlCommand: String, messages: String*): Unit = {
+ protected def interceptParseException(parser: String => Any)(
+ sqlCommand: String, messages: String*)(
+ errorClass: Option[String] = None): Unit = {
Review comment:
The intention is to provide default value `None` for the errorClass and
potential future added fields like sqlState. Especcially if new fields are
added, this interface can simply be extended to
```scala
protected def interceptParseException(parser: String => Any)(
sqlCommand: String, messages: String*)(
errorClass: Option[String] = None, newField: Option[String] = None):
```
and the caller doesn't need to change its signature. For example,
``` scala
private def intercept(sqlCommand: String, messages: String*): Unit =
interceptParseException(parsePlan)(sqlCommand, messages: _*)()
private def intercept(sqlCommand: String, errorClass: Option[String],
messages: String*): Unit =
interceptParseException(parsePlan)(sqlCommand, messages: _*)(errorClass)
```
will still compile.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]