MaxGekk commented on code in PR #41476:
URL: https://github.com/apache/spark/pull/41476#discussion_r1233957875
##########
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/AnalysisErrorSuite.scala:
##########
@@ -781,11 +781,43 @@ class AnalysisErrorSuite extends AnalysisTest {
test("error test for self-join") {
val join = Join(testRelation, testRelation, Cross, None, JoinHint.NONE)
- val error = intercept[AnalysisException] {
+ val error = intercept[SparkException] {
SimpleAnalyzer.checkAnalysis(join)
}
- assert(error.message.contains("Failure when resolving conflicting
references in Join"))
- assert(error.message.contains("Conflicting attributes"))
+ assert(error.getMessage.contains("Failure when resolving conflicting
references in Join"))
+ assert(error.getMessage.contains("Conflicting attributes"))
+ }
+
+ test("error test for self-intersect") {
+ val intersect = Intersect(testRelation, testRelation, true)
+ val error = intercept[SparkException] {
+ SimpleAnalyzer.checkAnalysis(intersect)
+ }
+ assert(error.getMessage.contains(
Review Comment:
Please, use `checkError`
##########
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/AnalysisErrorSuite.scala:
##########
@@ -787,8 +787,70 @@ class AnalysisErrorSuite extends AnalysisTest {
val error = intercept[AnalysisException] {
SimpleAnalyzer.checkAnalysis(join)
}
- assert(error.message.contains("Failure when resolving conflicting
references in Join"))
- assert(error.message.contains("Conflicting attributes"))
+ checkError(
+ exception = error,
+ errorClass = "RESOLVED_PLAN_HAVE_CONFLICTING_ATTRS",
+ parameters = Map(
+ "nodeName" -> "Join",
+ "plan" -> "'Join Cross\n:- LocalRelation <empty>, [a#0]\n+-
LocalRelation <empty>, [a#0]\n",
+ "conflictingAttributes" -> "\"a\""
+ )
+ )
+ }
+
+ test("error test for self-intersect") {
+ val intersect = Intersect(testRelation, testRelation, true)
+ val error = intercept[AnalysisException] {
+ SimpleAnalyzer.checkAnalysis(intersect)
Review Comment:
cc @cloud-fan Just to-double check that errors are internal.
##########
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/AnalysisErrorSuite.scala:
##########
@@ -781,11 +781,43 @@ class AnalysisErrorSuite extends AnalysisTest {
test("error test for self-join") {
val join = Join(testRelation, testRelation, Cross, None, JoinHint.NONE)
- val error = intercept[AnalysisException] {
+ val error = intercept[SparkException] {
SimpleAnalyzer.checkAnalysis(join)
}
- assert(error.message.contains("Failure when resolving conflicting
references in Join"))
- assert(error.message.contains("Conflicting attributes"))
+ assert(error.getMessage.contains("Failure when resolving conflicting
references in Join"))
Review Comment:
Internal errors have their own error class, could you use `checkError()`,
please.
--
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]