Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-39905][SQL][TESTS] Remove checkErrorClass() and use checkError() instead #37322

Closed
wants to merge 7 commits into from

Conversation

MaxGekk
Copy link
Member

@MaxGekk MaxGekk commented Jul 27, 2022

What changes were proposed in this pull request?

Replace all invokes of checkErrorClass() by checkError() and remove checkErrorClass().

Why are the changes needed?

  1. To prepare test infra for testing of query contexts.
  2. To check message parameters instead of entire text message. This PR is some kind of follow up of [SPARK-39349] Add a centralized CheckError method for QA of error path #36693.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

By running the modified test suites:

$ build/sbt "sql/testOnly *DatasetUnpivotSuite"
$ build/sbt "sql/testOnly *QueryCompilationErrorsSuite"
$ build/sbt "test:testOnly *QueryExecutionErrorsSuite"

@github-actions github-actions bot added the SQL label Jul 27, 2022
@MaxGekk MaxGekk changed the title [WIP][SQL][TESTS] Remove checkErrorClass() and use checkError() instead [SPARK-39905][SQL][TESTS] Remove checkErrorClass() and use checkError() instead Jul 28, 2022
@MaxGekk MaxGekk marked this pull request as ready for review July 28, 2022 05:28
@MaxGekk
Copy link
Member Author

MaxGekk commented Jul 28, 2022

cc @srielau

@MaxGekk
Copy link
Member Author

MaxGekk commented Jul 28, 2022

@cloud-fan @HyukjinKwon @gengliangwang Could you have a look at the PR, please. I wanna switch Serge's checkError completely, and extend checkError() to check query context as the next step.

"\"BIGINT\" \\(`long1#\\d+L`, `long2#\\d+L`\\)\\];(\n.*)*",
matchMsg = true)
errorSubClass = None,
sqlState = None,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does checkError provide default parameter value for errorSubClass and sqlState?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has but if I remove settings of the parameters, I am getting the errors:

overloaded method value checkError with alternatives:
  (exception: org.apache.spark.SparkThrowable,errorClass: String,parameters: Map[String,String])Unit <and>
  (exception: org.apache.spark.SparkThrowable,errorClass: String,sqlState: String,parameters: Map[String,String])Unit <and>
  (exception: org.apache.spark.SparkThrowable,errorClass: String,errorSubClass: String,sqlState: String,parameters: Map[String,String])Unit <and>
  (exception: org.apache.spark.SparkThrowable,errorClass: String,errorSubClass: Option[String],sqlState: Option[String],parameters: Map[String,String],matchPVals: Boolean)Unit
 cannot be applied to (exception: org.apache.spark.sql.AnalysisException, errorClass: String, parameters: scala.collection.immutable.Map[String,String], matchPVals: Boolean)
    checkError(

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me add the overloaded method:

 protected def checkError(
      exception: SparkThrowable,
      errorClass: String,
      parameters: Map[String, String],
      matchPVals: Boolean): Unit =

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but I think it is better to set default values in the most wide method. I will remove one overloaded method and add default values.

@github-actions github-actions bot added the CORE label Jul 28, 2022
@MaxGekk
Copy link
Member Author

MaxGekk commented Jul 29, 2022

@anchovYu @cloud-fan @HyukjinKwon @gengliangwang Could you review this PR, please.

Copy link
Member

@gengliangwang gengliangwang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the test infra work!

@MaxGekk
Copy link
Member Author

MaxGekk commented Jul 29, 2022

Merging to master. Thank you, @gengliangwang for review.

@MaxGekk MaxGekk closed this in 82cd993 Jul 29, 2022
MaxGekk added a commit that referenced this pull request Aug 2, 2022
…Error()`

### What changes were proposed in this pull request?
1. Re-implemented `validateParsingError()` using `checkError()`.
2. Removed `checkParsingError()` and replaced by `checkError()`.

### Why are the changes needed?
1. To prepare test infra for testing of query contexts.
3. To check message parameters instead of entire text message. This PR is some kind of follow up of #36693 and #37322.

### Does this PR introduce _any_ user-facing change?
No.

### How was this patch tested?
By running the modified test suites:
```
$ build/sbt -Phive -Phive-thriftserver "test:testOnly *TruncateTableParserSuite"
$ build/sbt -Phive-2.3 -Phive-thriftserver "test:testOnly *ShowPartitionsParserSuite"
$ build/sbt "sql/testOnly *QueryParsingErrorsSuite"
```

Closes #37363 from MaxGekk/checkParsingError-to-checkError.

Authored-by: Max Gekk <max.gekk@gmail.com>
Signed-off-by: Max Gekk <max.gekk@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants